ESPEasy Mega with HASS?

Hi

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 :frowning:
Here is setup of MQTT client in Easy Mega interface:

Hi,

I’m using it, but i have select OpenHab MQTT and i have no user/passwd for the moment. It works without problem in rev10.

What have you added to configuration.yaml?

For now nothing, I was expecting to see messages appear in Mosquitto logs or HASS ones but nothing appears :frowning: 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 :frowning: 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:

platform: mqtt
state_topic: ‘esp/salon/Temperature’
name: ‘Temperature’
unit_of_measurement: ‘°C’

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 :frowning:

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 :wink: 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 :wink:

sensor:
  - platform: bitcoin
    currency: EUR
    display_options:
      - exchangerate
  - platform: mqtt
    state_topic: 'esp/salon/Temperature'
    name: 'Temperature'
    unit_of_measurement: '°C'
  - platform: mqtt
    state_topic: 'esp/salon/Humidity'
    name: 'Humidité'
    unit_of_measurement: '°C'
  - platform: mqtt
    state_topic: 'els/Lierre/Humidité'
    name: Lierre
    unit_of_measurement: '°C'

That looks like mine, so it should work.

Are you sure that HA is connecting to the broker? The broker log should put out a message like

1497182743: New connection from ::1 on port 1883.
1497182743: New client connected from ::1 as paho/1DCE00252FD99C5FED (c1, k60).

when HA starts up.

@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 ? :wink:

Hi, try this to check what is writen in mosquitto :

mosquitto_sub -v -u <USERNAME> -P <PASSWORD> -t "/#"

@Minims here are results and it looks like my ESP is well posting updates so problem on HA side :frowning:

root@raspberrypi:/var/log# mosquitto_sub -v -u vincen -P 2543isvpdj -t "/#"
/esp/Lierre/Humidite 27.80
/esp/salon/Temperature 27.80
/esp/salon/Humidity 57.60
/esp/Lierre/Humidite 27.50

but finally found out what was problem ! I was missing the leading / on mqtt declaration for each sensor :frowning: Added it and now all three sensors update connectly and display data correctly :smiley:

Thanks for all your help guys :wink:

1 Like