KlausMu / esp32-fan-controller

ESP32 fan controller with temperature sensor and MQTT
272 stars 48 forks source link

Add homeassistant mqtt discovery #14

Closed nhangeland closed 9 months ago

nhangeland commented 10 months ago

Discovery automatically configures the controller as a HVAC fan only device in homeassistant.

Enable by uncommenting #define useHomeassistant in config.h

image

image

KlausMu commented 10 months ago

Thanks a lot for your PR! I tried it, but for me the discovery is not really working in my HA installation. But I'm not very familiar with mqtt discovery. Maybe you can help me out. I can see in MQTT Explorer that the discovery message was sent. 20231107_195018_543_MQTT_Explorer In HA I see that only one entity was created, not more. 20231107_195251_077_chrome In the log there is nothing suspicious. Do you have an idea?

nhangeland commented 10 months ago

You should get the controls if you click the entity. Or did you think its strange because its just an entity without any parent device?

KlausMu commented 10 months ago

Hm, yes, probably you are right. I expected a device. Or at least more than one entity (one for humidity, one for temp and so on). Seems I still have to learn something about HA ... Ok, great. May I use your screenshots and add them to the wiki?

nhangeland commented 10 months ago

Of course you can use the screenshots. But wait with the merge, it seems like i'm having some problems with persistence. Discovery might need to run on a regular interval, I will look into it after work today. This is the first time i'm playing with discovery as well so still learning. I also didn't think about adding temp/humidity/altitude stats as additional entities, but it sounds like a good idea. I will play some more with it and let you know once it's ready.

KlausMu commented 10 months ago

Ok, thanks. Wiki is already finished: 06 Home Assistant

KlausMu commented 10 months ago

@nhangeland Maybe you want to jump into this discussion https://github.com/KlausMu/esp32-fan-controller/issues/15