Anyone using ESPEasy with Home Assistant?

@tarikul You should be running OpenHAB MQTT and I would download and install MQTT.fx as that is a helpful tool for debugging MQTT (in Windows) without having to fluff with the command line. I would upgrade your device to R147 as R120 does not contain the retain flag setting which is kind of mandatory for home automation devices (temp/humidity excluded). Who knows, that may even fix your MQTT connection issues? I too am running the native MQTT broker under Hassbian on Pi3 and all of my ESPEasy devices connect to it using OpenHAB MQTT just fine although I’m running at least version R123.

Thanks for the reply again.

I believe the payload of mqtt message is JSON formatted. Hence, if has to be extracted by some means. In deed, python program is doing the extraction and showing the desired value when we configure the component in YAML. That is what I think anyway. So, if the MQTT payload is not the standard format obviously the default component wouldn’t work as expected. However, custom python script can be written to extract the values by regex matching. But, that would be difficult and overkill for the simple task. I believe you are not using the embedded broker. Do you ?

I still think, in my case some broker parameters need to be changed. But without knowing which parameters OpenHAB MQTT are using and mismatching with my broker, I can’t progress.

Thanks @xbmcnut I was also thinking this anyway. Yeah I saw in your post you mentioned to use OpenHAB MQTT, thats why I didn’t even try to configure HA with Domoticz broker configured on ESP. Usually, I use MQTTBox in Chrome for quick testing. But in this case, I wanted to see the full message details with the topic format and payload. Anyway, I will upgrade the firmware first and report back how it goes. Thanks again for the quick suggestion.

ESPEasy when configured with a temp/humidity device will just publish the value to MQTT broker so the temperature would just come in as say 23. No need to be any harder than that. I’ve just configured ESPEasy yesterday with a DS18b20 temperature sensor and this is publishing to %devicename%/dallas/temperature. That payload data is being picked up by my MagicMirror installation and displaying my office temperature in the bottom left-hand corner shown below. Neat!

Just a thought, have you set the ESP unit number to a unique number between 1 and 32? It can’t be zero.

1 Like

Yeah… I mistakenly omitted this step in the beginning and I was not even able to see the data readings.

Hooray! It works now. I just re flashed with R147. No trouble connecting my broker anymore. Now my pir sensor is also working along with the temperature/humidity sensor. I found the data structure is simple esp1/livingroom/temp ‘payload’ which can be readily readable by HA. What a lesson! Thanks guys for your help and suggestion anyway.

2 Likes

That is great. Had a feeling the firmware would resolve your issue. Good luck. Don’t forget to tick the MQTT Retain Msg: setting under Tools > Advanced.

1 Like

Hi @tarikul

Hooray! It works now. I just re flashed with R147. No trouble connecting my broker anymore. Now my pir sensor is also working along with the temperature/humidity sensor. I found the data structure is simple esp1/livingroom/temp ‘payload’ which can be readily readable by HA. What a lesson! Thanks guys for your help and suggestion anyway.

Good news to listen that worked

Thank for the guide, I’ve followed your project and it all works bar one thing.
When I press the button the relay state changes to 1 but then a few seconds later it changes back to 0.
How can I make it keep the state of 1 until the button is pressed again to make it 0?

I don’t know if it’s; A) code, B) wiring C) Type of physical button i used.

setup is exactly like your’s, running GIT version: v2.0.0-dev8
my wiring (now plugged into D6):

Can you post your HA code for this device? It’s either a rule issue or MQTT is changing the device state back. A little bit more info about your connection would be helpful.

SUCCESS!!! I had to change the Relay “Switch Button Type” to Active High or Active low, normal is what kept sending it back to 0

  • platform: mqtt
    name: “lamp button”
    state_topic: “/ESP02/relay/state”
    command_topic: “/ESP02/gpio/13”
    payload_on: “1”
    payload_off: “0”
    qos: 1
    retain: true

I did notice in your guide both default states are 0 and my relay is always 1 as below

this is the output when I press the button once:

rest of my setup:

Has anyone got the Sonoff TH10/TH16: Temperature And Humidity Monitoring WiFi Smart Switch working with HA and/or ESPEasy?

https://www.itead.cc/sonoff-th.html

It probably works with ESPeasy, but it might be even easier using Sonoff-Tasmota https://github.com/arendst/Sonoff-Tasmota

It seems to support the temperature sensor.