Jump to content
Guides for the Forum Read more... ×
Poradniki na Forum Read more... ×
  • 0
Daneasa

Bose Virtual Device ON/OFF Button

Question

Hello,

I just got an email form BOSE after a request for a example ON/OFF button for SoundTouch S20 using API codes.

I will put the informations from the email here.
 
import requests
import xml.dom.minidom
 
# Val options:
# PLAY
# PAUSE
# STOP
# PREV_TRACK
# NEXT_TRACK
# THUMBS_UP
# THUMBS_DOWN
# BOOKMARK
# POWER
# MUTE
# VOLUME_UP
# VOLUME_DOWN
# PRESET_1
# PRESET_2
# PRESET_3
# PRESET_4
# PRESET_5
# PRESET_6
# AUX_INPUT
# SHUFFLE_OFF
# SHUFFLE_ON
# REPEAT_OFF
# REPEAT_ONE
# REPEAT_ALL
# PLAY_PAUSE
# ADD_FAVORITE
# REMOVE_FAVORITE
# INVALID_KEY
 
# enter the IP address as a string:
 
ipaddr = "xx.xx.xx.xx"
 
# enter key value:
 
val= "PRESET_1"
 
# for every button press, also show the speaker info
 
infoRequest = requests.get('http://' + ipaddr + ':8090/info')
 
infoResponseXML = xml.dom.minidom.parseString(infoRequest.text)
infoResponseXML_pretty = infoResponseXML.toprettyxml()
print infoResponseXML_pretty
 
# press 
 
pressXML = "<?xml version='1.0' ?><key state=\"press\" sender=\"Gabbo\">" + val + "</key>"
press = requests.post('http://' + ipaddr + ':8090/key', data=pressXML)
pressResponseXML = xml.dom.minidom.parseString(press.text)
pressResponseXML_pretty = pressResponseXML.toprettyxml()
print pressResponseXML_pretty
 
# release
 
releaseXML = "<?xml version='1.0' ?><key state=\"release\" sender=\"Gabbo\">" + val + "</key>"
release = requests.post('http://' + ipaddr + ':8090/key', data=releaseXML)
releaseResponseXML = xml.dom.minidom.parseString(release.text)
releaseResponseXML_pretty = releaseResponseXML.toprettyxml()
print releaseResponseXML_pretty
 
 
My question is : How can i transform this in LUA language for that virtual device?
                          I'm beginner in LUA language so i need some help

Please login or register to see this image.

/emoticons/default_sad.png" alt=":(" srcset="https://forum.fibaro.com/uploads/emoticons/sad@2x.png 2x" width="20" height="20" /> .
 
I tryed like this but is not working.

Please login or register to see this image.

/emoticons/default_biggrin.png" alt=":D" srcset="https://forum.fibaro.com/uploads/emoticons/biggrin@2x.png 2x" width="20" height="20" />
Any help ? Thanks.
 
HC2 = Net.FHttp("192.168.2.128",8090)
pressXML = "<?xml version='1.0' ?><key state="press" sender="Gabbo">POWER</key>"
press = requests.post ('

Please login or register to see this link.

data=pressXML)
 
or is like this ?
 
BOSE = Net.FHttp("192.168.2.128",8090)
pressXML = "<?xml version='1.0' ?><key state="press" sender="Gabbo">PAUSE</key>"
response, status, errorCode = BOSE:POST('

Please login or register to see this link.

', data=pressXML )

Share this post


Link to post
Share on other sites

9 answers to this question

Recommended Posts

  • 0

Coucou tout le monde , j'ai créé un Vd Bose opérationnel, avec les commandes principales, je vous en fourni une première version (n'oubliai pas de remplir l'adresse Ip et le port Tcp de votre Soundtouch).

 

 

Please login or register to see this attachment.

Please login or register to see this link.

Share this post


Link to post
Share on other sites
  • 0
  • Inquirer
  • I'm back with a new information , Fibaro can't access XML library

    Please login or register to see this image.

    /emoticons/default_sad.png" alt=":(" srcset="https://forum.fibaro.com/uploads/emoticons/sad@2x.png 2x" width="20" height="20" /> 

    Share this post


    Link to post
    Share on other sites
    • 0

    As idea. I like to parse XML using this regexp:

    Please login or register to see this code.

    Share this post


    Link to post
    Share on other sites
    • 0
  • Inquirer
  • Coucou tout le monde , j'ai créé un Vd Bose opérationnel, avec les commandes principales, je vous en fourni une première version (n'oubliai pas de remplir l'adresse Ip et le port Tcp de votre Soundtouch).

     

    Thank you, loic62185, is working perfectly . 

     

    In this time I've made it in other way. With Orvibo IR reader and Wireshark .

    Please login or register to see this image.

    /emoticons/default_biggrin.png" alt=":D" srcset="https://forum.fibaro.com/uploads/emoticons/biggrin@2x.png 2x" width="20" height="20" />

     

    If someone want to try it, use TCP Port = "8090"

     

    Regards.

    Share this post


    Link to post
    Share on other sites
    • 0
    On 29/7/2016 at 5:52 AM, Daneasa said:

     

    Thank you, loic62185, is working perfectly . 

     

    In this time I've made it in other way. With Orvibo IR reader and Wireshark .

    Please login or register to see this image.

    /uploads/emoticons/default_biggrin.png" srcset="https://forum.fibaro.com/uploads/emoticons/biggrin@2x.png 2x" width="20" />

     

    If someone want to try it, use TCP Port = "8090"

     

    Regards.

     

    What's up buddy, would you mind to explain me how did you do to adquire the HEX commands via wireshark? I have my Orvibo Allone but I'm not pretty sure how can i get the hex commands, thanks!!

    Share this post


    Link to post
    Share on other sites
    • 0
  • Inquirer
  • With Wireshark on tablet , you need root and you can install it on tablet.

     

    Start the program on tablet , use the Orvibo app , in app you want to push all the buttons that you need for wireshark -> stop wireshark ...send the file in you pc ...open with wireshark on your pc .... and there you will find your codes. 

     

    Use this filter  < (ip.src eq 192.168.2.156 and ip.dst eq 192.168.2.178) and (udp.port eq 10000 and udp.port eq 10000) >

     

    src= your tablet ip.

    dst= your orbivo ip.

     

    This is an example of Turn On command :

     

    "686400aa6963accf234b41c6202020202020bd3bcd0c189d9000000000009000bcaed923010058023b048101000311000000760040206710c5015906c5016602c5016802c5016602c4015906c3016702c4016602c3016702c5016602c5016702c4016702c6016602c4016702c6016602c5015a06c4016702c5016602c5016602c6015a06c5015a06c5016602c4015906c3016702c5015a06c6015a06c5016702c5015a06c6016602c401"

     

    Cheers.

     

    Share this post


    Link to post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

    ×