Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


Bose Virtual Device ON/OFF Button


Daneasa

Recommended Posts

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/[email protected] 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/[email protected] 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 )
Link to comment
Share on other sites

  • 1 month later...
  • Topic Author
  • 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/[email protected] 2x" width="20" height="20" /> 

    Link to comment
    Share on other sites

    • 2 weeks later...
    Guest Roman

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

    Please login or register to see this code.

    Link to comment
    Share on other sites

    • 4 months later...

    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.

    Link to comment
    Share on other sites

  • Topic Author
  • 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/[email protected] 2x" width="20" height="20" />

     

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

     

    Regards.

    Link to comment
    Share on other sites

    • 2 months later...
    • 4 weeks later...
    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/[email protected] 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!!

    Link to comment
    Share on other sites

  • Topic Author
  • 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.

     

    Link to comment
    Share on other sites

    • 1 year later...
    • 7 months later...

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Reply to this topic...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...