Did someone tried to use ESP: Easy Mega firmware for ESP2866 with HASS ? I have flashed it on one of my ESP2866 board and setup it but I have issues to get MQTT working with it !
I have setup a mqtt profile in it (Domoticz profile) and I can see it connect to my MQTT broker in MQTT logs, and on ESP it tells that connection is OK but nothing appears in HASS
Here is setup of MQTT client in Easy Mega interface:
For now nothing, I was expecting to see messages appear in Mosquitto logs or HASS ones but nothing appears Is it mandatory to declare it in configuration file ?
HA doesn’t do anything with MQTT unless you tell it to do so in the configuration.yaml file.
Adding an MQTT section will cause it to connect to your broker, and then adding an MQTT component such as a Sensor or switch will cause it to subscribe to or publish messages.
@gpbenton Thanks for clarification, I’m just completely lost how to find the subject under which my ESP is publishing on my Mosquitto ! I tried MQTT Snooper service on my android phone to check messages posted by the ESP on my broker but that app doesn’t work as it doesn’t display any messages posted on my broker tested with Owntracks I have setup since a while !).
oki problem fixed with ESP that is positng now correctly to my broker. Needs to figure out how to display it in HASS now !
On Mosquitto messages posted by the ESP are basic text with just the numeric value of the sensor ! it’s not a JSON payload so I did that in HASS:
state_topic being the same as the one displayed on message posted by ESP to Mosquitto ! but I get none value displayed in frontend, just like it’s not able to get numerical value from MQTT message
You can be sure that this is something HA does. You just have something not quite right.
Firstly, can you post all of the sensor: section of your configuration.yaml, using the instructions in the code block link in the blue box at the top of this page. That way, someone will be able to spot any problems with it. Without getting the displaying the formatting correctly, people can’t see the problems.
@gpbenton oki I thought just the code for that sensor was enough but here is full sensor section of my config file Side note I have other stuffs using my MQTT broker that are working fine so problem is not betweehn ESP and MQTT broker but definitively how to tell at HASS to decode the data received
@gpbenton I saw these in logs of mine so looks like HA is well connected to it no ?
Jun 27 11:47:55 raspberrypi mosquitto[11993]: 1498556875: Client mqtt disconnected.
Jun 27 11:48:29 raspberrypi mosquitto[11993]: 1498556909: New connection from 127.0.0.1 on port 1883.
Jun 27 11:48:29 raspberrypi mosquitto[11993]: 1498556909: New client connected from 127.0.0.1 as mqtt (c1, k60, u'vincen').
Jun 27 11:59:17 raspberrypi mosquitto[11993]: 1498557557: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
Jun 27 12:14:10 raspberrypi mosquitto[11993]: 1498558450: Client mqtt disconnected.
Jun 27 12:14:21 raspberrypi mosquitto[11993]: 1498558461: New connection from 127.0.0.1 on port 1883.
Jun 27 12:14:21 raspberrypi mosquitto[11993]: 1498558461: New client connected from 127.0.0.1 as mqtt (c1, k60, u'vincen').
Jun 27 12:29:18 raspberrypi mosquitto[11993]: 1498559358: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
Jun 27 12:39:04 raspberrypi mosquitto[11993]: 1498559944: Client 636341493540002530 disconnected.
Jun 27 12:59:19 raspberrypi mosquitto[11993]: 1498561159: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
And I use alsw Owntracks throught MQTT and it updates fine so HA si definitively well connected to it no ?
but finally found out what was problem ! I was missing the leading / on mqtt declaration for each sensor Added it and now all three sensors update connectly and display data correctly