OpenWonderLabs / python-host

The python code running on Raspberry Pi or other Linux based boards to control SwitchBot.
Apache License 2.0
379 stars 84 forks source link

battery level still not possible? #37

Open zen85 opened 2 years ago

zen85 commented 2 years ago

Current Situation

I have 3 switchbots running and operate them via node-red with this command: sudo python3 python-host/switchbot_py3.py -d XX:XX:XX:XX:XX:XX -c on

i have many devices with batteries running in my flat and i want to keep an overview of what will need batteries soon. Unfortunatly this project does not give me that possibility and i wondered if it would be possible to implement this since other pythonlibraries seem to be able to do that.... unfortunatly these lack documentation and i dont know hot to get these running in node-red.

iE: https://github.com/Danielhiversen/pySwitchbot

is this even a planned feature?

Proposed Change

Make a command that gives me a batterylevel

Additional Context

No response

Jaxom99 commented 1 year ago

On the 7.1 version, the code reports the battery status of any bot in the bot/bot_name/attributes topic as a JSON element, {"mode":"Press","state":"OFF","batt":87,"rssi":-47} and also on the bot/bot_name/battery topic as a % of charge.

I believe your need is fulfilled :smile: