devWaves / SwitchBot-MQTT-BLE-ESP32

Allows for multiple SwitchBot bots and curtains to be controlled via MQTT sent to ESP32. ESP32 will send BLE commands to switchbots and return MQTT responses to the broker. Also supports Temperature, Motion, Contact sensors
MIT License
549 stars 68 forks source link

Battery Status as a separate subject #60

Closed Trrw closed 2 years ago

Trrw commented 2 years ago

Hello,

Would it be possible to send the battery status as a separate subject? Also for example /switchbot/esp32/curtain/curtainone/battery

The value is currently stored in the attribute topic with json.

Thank you!

devWaves commented 2 years ago

I am adding a battery and rssi topic in version 7, just working out last issues

for bot and curtain I added a minor hack to send a battery percentage 1% message when they return a battery low error message when trying to control and it doesnt work

Trrw commented 2 years ago

Thank you for the work! Would it also be possible to create a own subject (to controll) for the position of the Switchbot curtain?

devWaves commented 2 years ago

You can already set the position by sending a number between 1-100 to the curtain set topic

mclever commented 2 years ago

Ran into an issue today where last battery update to HA showed 55% but the battery was actually dead. Batt % went right up to 100 after replacement so no sure what happened

devWaves commented 2 years ago

@mclever the switchbot battery seems to be weird like that. I had one go from 100% to 77% when I controlled it. Not much I can do there, but the hack I added will help

@mclever @Trrw I have just made updates to a v7.0-preRelease here https://github.com/devWaves/SwitchBot-MQTT-BLE-ESP32/tree/v7alpha

Can you try the v7.0-preRelease and let me know if it works for you?

just ignore the new settings related to "mesh"

This version has the new separate topics for battery and rssi for each device type. It also has the "hack" to send a battery of 1% if a command is sent to the device but it fails because it return a battery low error

mclever commented 2 years ago

Forgot about updating since everything is working so great. Thanks again for this awesome solution!

Had one of my switchbots stop fingering at 55% battery today and was still sending link quality. I'll probably just set an automation to alert at battery =55% for next time since I'm reading about all the BLE issues.

devWaves commented 2 years ago

v7.0 release and adds topics for battery and rssi as well as the included battery hack to send 1% battery is devices respond with low battery warning on command attempt