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

Additional Home Assistant MQTT Discovery improvements - v2alpha #10

Closed HardcoreWR closed 3 years ago

HardcoreWR commented 3 years ago

I just committed my recent changes that will have the correct HA MQTT Discovery config. Also, this config will be created when the devices are actually found. I built functions for each device type (I noticed you did that as well in your last commit). Changed some topics, one for the actual state is JUST showing the state, and there's an extra attribute topic for all the extra data (like rssi and battery). Switchbot Meters will automatically be added to the rescan list to update the temperature more regularly. Switchbot Curtain position is inverted so Home Assistant shows the correct state for the arrow up/down buttons. HA is built around 0 being closed and 100 being open and even though you can change these values in the position_open and position_closed discovery config (and that does work well), it only allows you to open the curtain when it's already open. Inverting the position immediately solved this issue.

My curtain, bot and meter are currently working as expected with this code.

HardcoreWR commented 3 years ago

I'm sorry for the conflicts 🤣