ESP Easy + Home assistant + MQTT auto discovery

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
agroszer
Normal user
Posts: 28
Joined: 02 Jan 2023, 16:36

ESP Easy + Home assistant + MQTT auto discovery

#1 Post by agroszer » 04 Oct 2023, 10:31

Did anyone have success doing auto discovery with Home assistant MQTT with a recent EE?
Can't find much info on the internets.
Have a load of EE units with plenty of sensors, I'd somehow avoid manual configuration.

TD-er
Core team member
Posts: 8774
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESP Easy + Home assistant + MQTT auto discovery

#2 Post by TD-er » 04 Oct 2023, 11:07

As a matter of fact, I'm also interested in whether the Homie plugin/controller stuff which pretends to do something similar is atually working and if so, how it is working. (and if it will work on HA too?)

To be honest, I haven't touched that code for quite some time (and haven't written it myself) as it really needs some intensive TLC.
That code really is copy/paste/paste/paste/paste/paste, but since I don't really know how it should work, I haven't started working on it.

User avatar
Ath
Normal user
Posts: 3556
Joined: 10 Jun 2018, 12:06
Location: NL

Re: ESP Easy + Home assistant + MQTT auto discovery

#3 Post by Ath » 04 Oct 2023, 12:05

I did some work on the MQTT plugins in PR #4770, mostly to move out the /cmd and /set endpoint handling as a generic feature for all MQTT plugins, that also slightly touches the Autodiscovery, but haven't been able to actually test how it works as I'm not running OpenHAB/HA (yet) :oops:
You could test if the Controller actually supports the Autodiscovery correctly, by just enabling the controller. And it would be nice if you could also test the PR: latest Actions run
Last edited by Ath on 04 Oct 2023, 19:54, edited 1 time in total.
/Ton (PayPal.me)

agroszer
Normal user
Posts: 28
Joined: 02 Jan 2023, 16:36

Re: ESP Easy + Home assistant + MQTT auto discovery

#4 Post by agroszer » 04 Oct 2023, 17:43

Could test on ESP8266, but meeh how to get the artifacts? Seems to be unclickable at github.... I'm unlikely to build myself ;-)

User avatar
Ath
Normal user
Posts: 3556
Joined: 10 Jun 2018, 12:06
Location: NL

Re: ESP Easy + Home assistant + MQTT auto discovery

#5 Post by Ath » 04 Oct 2023, 19:56

Possibly the Actions run was already unavailable, I've started a new run here. You'll need to be logged in with your Github account to be able to download these artifacts.
/Ton (PayPal.me)

agroszer
Normal user
Posts: 28
Joined: 02 Jan 2023, 16:36

Re: ESP Easy + Home assistant + MQTT auto discovery

#6 Post by agroszer » 05 Oct 2023, 14:12

Yeah, looks like login helped with the download. Will test soon.

agroszer
Normal user
Posts: 28
Joined: 02 Jan 2023, 16:36

Re: ESP Easy + Home assistant + MQTT auto discovery

#7 Post by agroszer » 05 Oct 2023, 16:21

Updated the esp8266 firmware with ESP_Easy_mega_20231004_collection_A_ESP8266_4M1M.bin.
Setup controller as on the screenshot.
The only message I got with mqttx is:

Code: Select all

Topic: homeassistant/esp_08_1
Connected
I've set an AHT20 sensor to report with MQTT, that sends messages:

Code: Select all

Topic: homeassistant/esp_08_1/room/Temperature
24.00

Topic: homeassistant/esp_08_1/room/Humidity
43.42
esp_08 seems not to show up in HomeAssistant.

Do I need to set something else?
Attachments
Screenshot_2023-10-05_16-13-58.png
Screenshot_2023-10-05_16-13-58.png (84.04 KiB) Viewed 2525 times

User avatar
Ath
Normal user
Posts: 3556
Joined: 10 Jun 2018, 12:06
Location: NL

Re: ESP Easy + Home assistant + MQTT auto discovery

#8 Post by Ath » 05 Oct 2023, 22:18

Ah, just checked, it's the Homie controller (C014, available in Collection builds) that will send auto-discover data at controller activation. (Not sure if that's the correct way how 'Auto Discovery' should work, but it might help...)
You could try that controller, using the Home Assistant topics, to see if/how that works with your HA server.
/Ton (PayPal.me)

agroszer
Normal user
Posts: 28
Joined: 02 Jan 2023, 16:36

Re: ESP Easy + Home assistant + MQTT auto discovery

#9 Post by agroszer » 08 Oct 2023, 17:29

Does not really work on the first try...
Settings as attached.

I get messages on enabling the controller:

Code: Select all

Topic: homeassistant/esp_08_1
connect
2023-10-08 17:16:53:935

Topic: homeassistant/esp_08_1
connect
2023-10-08 17:16:53:954

Topic: homie/esp_08_1/$state
ready
2023-10-08 17:17:14:454

Topic: homie/esp_08_1/$state
ready
2023-10-08 17:17:44:442
then

Code: Select all

Topic: homie/esp_08_1/$state
ready
periodically

No answer from HASS, of course EE does not show up.
Looks like auto discovery is a bit more involved: https://www.home-assistant.io/integrati ... y-examples
Attachments
Screenshot_2023-10-08_17-19-48.png
Screenshot_2023-10-08_17-19-48.png (65.15 KiB) Viewed 2465 times

User avatar
Ath
Normal user
Posts: 3556
Joined: 10 Jun 2018, 12:06
Location: NL

Re: ESP Easy + Home assistant + MQTT auto discovery

#10 Post by Ath » 08 Oct 2023, 18:58

It looks like every MQTT server has their own topic prefix for auto-discovery, and the Homie controller uses 'homie', not 'homeassistant' :shock:
I'll see if I can pull this out of the Homie controller, and make it more generic, but no ETA yet, have quite a few tasks on my plate already, and this isn't my daytime job... 8-)
/Ton (PayPal.me)

agroszer
Normal user
Posts: 28
Joined: 02 Jan 2023, 16:36

Re: ESP Easy + Home assistant + MQTT auto discovery

#11 Post by agroszer » 08 Oct 2023, 19:50

No worries, would have been a nice-to-have thing, editing HASS configuration.yaml isn't that bad.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 3 guests