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
539 stars 66 forks source link

v2alpha HA MQTT Discovery #9

Closed devWaves closed 3 years ago

devWaves commented 3 years ago

v2alpha initial commit

HardcoreWR commented 3 years ago

Thanks for the merge. I've made some changes over the last couple of days but haven't committed them yet.

* The discrepancy between the Switchbot Curtain and Home Assistant where the curtain clearly says it's open, even the Home Assistant icon shows that the curtain is open but the only button we can press is Open. I'm not 100% sure if this is an issue with the discovery config or something with Home Assistant.

It appears that Home Assistant is built in a way that open is 100 and closed is 0. You can change the position_open: 100 and position_closed: 0 and this does invert the slider for the curtain. However, the problem with the buttons are still there. If the curtain is open I can only press the open button. I fixed this by inverting the position of the curtain so open is 0 and closed is 100. After adjusting the discovery configuration everything is working as expected.

* When I received the Meter I noticed you can change the format of the temperature (Celsius vs Fahrenheit) on the fly with just a button on the back. I'm working on a mechanism to update the discovery config when this is changed.

Almost finished with this. I'm experiencing some weird behavior where it keeps using the Celsius value even the value_template: {{ value.F }} is set.

* Split the payloads out for the Curtain and Bot state (OPEN, CLOSED, ON, OFF, 0-100) and the extra attributes (battery, position, rssi) so the state of the Curtain and Bot will show the state that we've given.
* * For example; Switchbot Bot is OFF, we toggle it ON but the state goes to OFF immediately because the state payload still says it's OFF and will only update after every  seconds.

Not done yet

Sorry if I'm going too slow, I'm doing this in the few spare hours I have after my day-job and family 😄

HardcoreWR commented 3 years ago
* When I received the Meter I noticed you can change the format of the temperature (Celsius vs Fahrenheit) on the fly with just a button on the back. I'm working on a mechanism to update the discovery config when this is changed.

Almost finished with this. I'm experiencing some weird behavior where it keeps using the Celsius value even the value_template: {{ value.F }} is set.

Okay. after some debugging I started realizing this functionality did work but it didn't show me Fahrenheit because the server settings were configured to use Metric instead of Imperial. At this point I'm starting to doubt if this is useful at all because it's converting the temperature to whatever setting you use in Home Assistant anyway.

devWaves commented 3 years ago

Sorry if I'm going too slow, I'm doing this in the few spare hours I have after my day-job and family 😄

no problem. Priorities. People can wait a bit when it's a free solution 😁