Closed joepv closed 3 years ago
That should be possible.
Please enter the following address in your browser (replace the ip address with the address of your player) and send me the results- lets see if there is the battery information.
http://192.168.178.37:1400/info
... and for
http://192.168.178.37:1400/status/batterystatus
Thank you, the results are:
http://192.168.1.40:1400/info
:
{
"device": {
"id": "RINCON_XXXX",
"serialNumber": "00-AA-AA-A0-00-A0:0",
"model": "S27",
"modelDisplayName": "Roam",
"color": "Shadow",
"capabilities": [
"PLAYBACK",
"CLOUD",
"AIRPLAY",
"VOICE",
"AUDIO_CLIP"
],
"apiVersion": "1.24.1",
"minApiVersion": "1.1.0",
"name": "Tuin",
"softwareVersion": "64.3-19080",
"hwVersion": "1.33.1.8-2.9",
"swGen": 2
},
"householdId": "Sonos_xxx",
"playerId": "RINCON_XXX",
"groupId": "RINCON_XXX",
"websocketUrl": "wss://192.168.1.40:1443/websocket/api",
"restUrl": "https://192.168.1.40:1443/api"
}
http://192.168.1.40:1400/status/batterystatus
:
<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="/xml/review.xsl"?><ZPSupportInfo><LocalBatteryStatus>
<Data name="Health">GREEN</Data>
<Data name="Level">89</Data>
<Data name="Temperature">NORMAL</Data>
<Data name="PowerSource">BATTERY</Data>
</LocalBatteryStatus><!-- SDT: 0 ms --></ZPSupportInfo>
OK so we know the command but we need to wake up the device.
Are you able to create the discovery file for your Roam. Here is a link (step 1 to 9) how to generate a discovery file
Yes. I did the steps and the output can be fount at this discovery file.
Btw: I thought the Sonos App would wake the Roam, but the device was in bad Wi-Fi range. But you can press a button to send the device to deep sleep and the Sonos App doesn't wake it then. You have to press the button again is my experience.
Thanks for the discovery file - i will check with Stephan. Maybe we find a wake up command or can subscribe to an event.
Regarding btw: Try this flow ( i could not test it but should work).
[{"id":"36529dbbc172ab0b","type":"inject","z":"6d9c1459e41e6f50","name":"trigger","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":320,"y":200,"wires":[["6ad9b68e9ad8eb91"]]},{"id":"6ad9b68e9ad8eb91","type":"http request","z":"6d9c1459e41e6f50","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"http://192.168.1.40:1400/status/batterystatus","tls":"","persist":false,"proxy":"","authType":"","x":476,"y":200,"wires":[["62cae6a11f4de185","f8e28320b8ead7ab"]]},{"id":"62cae6a11f4de185","type":"debug","z":"6d9c1459e41e6f50","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":710,"y":120,"wires":[]},{"id":"f8e28320b8ead7ab","type":"xml","z":"6d9c1459e41e6f50","name":"","property":"payload","attr":"","chr":"tag","x":650,"y":200,"wires":[["a441cf5e27834a68"]]},{"id":"a441cf5e27834a68","type":"change","z":"6d9c1459e41e6f50","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.ZPSupportInfo.LocalBatteryStatus[0].Data[1].tag","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":200,"wires":[["e2a40abeeb0beb75"]]},{"id":"e2a40abeeb0beb75","type":"debug","z":"6d9c1459e41e6f50","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1030,"y":200,"wires":[]}]
I tried, and the flow works as you expected:
Node-RED debug output:
Sonos Controller for Windows 10 output:
Good to hear. Please test it over the next days and let me know the results.
That command is easy to integrate in sonos-plus as player.get.batterystatus.
Good night :-)
On Tue, Aug 17, 2021, 22:00 Joep Verhaeg @.***> wrote:
I tried, and the flow works as you expected:
Node-RED debug output: [image: image] https://user-images.githubusercontent.com/1484845/129792140-de0cd4b3-f9fa-4311-8f25-ae1fd2e0eb81.png
Sonos Controller for Windows 10 output: [image: image] https://user-images.githubusercontent.com/1484845/129792251-10e5108c-8645-4286-b648-61c60ee90292.png
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/hklages/node-red-contrib-sonos-plus/issues/165#issuecomment-900590882, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEDZCH7UBCJUTLVOAAEXQT3T5K5XFANCNFSM5CIGVPKA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .
This looks like something that isn’t in the soap api. This xml endpoint is really easy to parse, will give it a go later tonight.
5.27: player.get.batterylevel should show the current level.
Please reopen, if it does not work. I did the test with your xml file.
Description
I like to do a feature request to add the battery level for the new Sonos Roam?
What node/command (topic)/state (payload)
For example: node: Universal
or
Versions and Infrastructure
what system: Node-RED 2.0.5 running on Docker version 20.10.6 (Debian 10) node-red-contrib-sonos-plus version: 5.2.5 Node-RED version: 2.0.5 NodeJS version: v14.17.3
Screenshot: