svrooij / node-sonos-ts

:speaker: Sonos control library, use this library in your own appliction.
https://sonos-ts.svrooij.io/
MIT License
81 stars 18 forks source link

Feature request: Battery status #176

Closed hubecker closed 3 months ago

hubecker commented 1 year ago

Battery status feature request

I like to get the battery status of my Sonos Move

With the following URL

http://<IP>:1400/status/batterystatus

you get the battery status

the Browser shows the follwing:

Bildschirm­foto 2023-02-15 um 23 20 26

The HTTPBody of the request:

<?xml version="1.0" ?><?xml-stylesheet type="text/xsl" href="/xml/review.xsl"?><ZPSupportInfo><LocalBatteryStatus><Data name="Health">UNKNOWN_batteryHealth</Data><Data name="Level">100</Data><Data name="Temperature">NORMAL</Data><Data name="PowerSource">SONOS_CHARGING_RING</Data></LocalBatteryStatus><!-- SDT: 0 ms --></ZPSupportInfo>

svrooij commented 1 year ago

Thanks Hubert, I'll have a look next week.

RlfSt commented 1 year ago

The output for a Sonos Roam is the same:

<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="/xml/review.xsl"?>
<ZPSupportInfo>
<LocalBatteryStatus>
<Data name="Health">GREEN</Data>
<Data name="Level">100</Data>
<Data name="Temperature">NORMAL</Data>
<Data name="PowerSource">SONOS_CHARGING_RING</Data>
</LocalBatteryStatus>
<!-- SDT: 0 ms -->
</ZPSupportInfo>
hubecker commented 1 year ago

Of course only when WLAN connected, not in bluetooth mode.

Don't know how to handle this one: Would be also great to handle the mode meaning switching from WLAN to bluetooth and back. But i don't know if there is an API, because even in the APP it is not possible.

arndth commented 1 year ago

Any updates for this request?

svrooij commented 3 months ago

Anyone who wants can create a pr for this, I don't own such a device so cannot test it myself.