It’s possible to connect home assistant switch trough mqtt platform for switching gpio state on ESP12E with ESPEasy firmware? I try with this configuration but not working.
NOTE!!! There seem to be a bug i R78 which I use.
Eventhough I have set it up to listen to xxxxx/esp1/# (and logs confirm that it receives the message) it does not work with the leading xxxxx/ (led allways off)! This caused me lots of headache until I tested with just espname!!!
Thanks for this but can you confirm yours is working as written? I have ESPEasy R105 and the command topic for GPIO control is /ESP01/gpio/14 with a payload of 1 or 0 (tested with mqtt.fx). You have /set at the end which will not control the output? Also, under ESPEasy, I could not find any reference to getting status updates from the gpio other than maybe /ESP01/status/gpio/14 but I could not get that to work. In your case, “esp4/gpio/14/set” does not provide a status of the gpio pin or does yours?
Thanks. I’m tracking /ESP01/# and I see the payload heading to the GPIO but nothing back. Wondering if ESPEasy has a status mechanism at all for MQTT. Know you can get pin status with a http request but that complicates my home automation integration.
@runtime Did you get yours working as I’ve cracked this now and I’m in the process of writing a semi definitive guide to using ESPEasy with MQTT on HA. I’ve tested it with Sonoff and NodeMCU and under the latest build (R121), it works extremely well.
I’m trying to get this to work, but am not succeeding yet.
I have ESPEasy build R120 on a Wemos D1 Mini with a relay shield on top of it.
With mosquitto_pub -t /WemosD1/gpio/5 -m 1 i can turn the relay on.
With mosquitto_pub -t /WemosD1/gpio/5 -m 0 i can turn it off again.
With mosquitto_sub -h 192.168.4.14 -p 1883 -v -t '/WemosD1/#' i can see that the GPIO is turned on/off: /WemosD1/gpio/5 1 /WemosD1/gpio/5 0
I created a switch in HASS:
Not sure if you’ve already solved the issue but if not and for future reference I have relay connected to Lolin board on ESPeasy and it works just fine via MQTT.
Relay connected to GPIO 16 on ES8266 called Esp01 with reversed logic so the on is 0 and off is 1 in my example.
Here is my HA config:
I’ve been trying to install 120 with limited success. Doesn’t work via Arduino but via some Windows tool I found it works out, but I have a variety of other problems - anyone with solid recommendation on version to use?
I have four Lolin V3 boards running on ESPeasy 120 without any issues.
Installed it with their batch application in the zip file.
I had some problems with previous version 83 (not sure about the number). The problem was that I had MQTT server down and when it failed to connect for about a minute it restarted and tried again. When switched to standalone in settings I was able to configure all devices and then start MQTT server.
You can always check standard things like different power adapters or wiring or if it’s going into deep sleep.
Can’t help you more without details.
Late reply, but i am still having some problems with ESPEasy and MQTT.
Controlling the relay works with this HASS code: - platform: mqtt name: "Wemos D1 MQTT" command_topic: "/WemosD1/gpio/5" payload_on: "1.0" payload_off: "0.0" qos: 1 retain: true value_template: '{{ value.x }}'
But i also want to get the state, so HASS always knows the real state of the relay. I have read some posts online and it seems that you guys use some logic on the ESPEasy to read a button, switch a LED and such, based on the state of the relay.
However, i don’t need that. My ESP only has a relay connected, which i want to switch with MQTT and read the status.
Can someone explain how to read the status without any additional rules/switches in ESPEasy?
I created a ‘Switch input’ in ESPEasy on the same GPIO as my relay (GPIO5). I can see in the ESPEasy interface that it turns to ‘1’ and ‘0’ when i turn the relay on and off. I can also see the status being sent to MQTT now mqtt@mqtt-vm:~$ mosquitto_sub -h 192.168.4.14 -p 1883 -v -t '/WemosD1/relais/state' /WemosD1/relais/state 0 /WemosD1/relais/state 1 /WemosD1/relais/state 0 /WemosD1/relais/state 1 /WemosD1/relais/state 0 /WemosD1/relais/state 1
I can turn the relay on with HASS, but directly after that, the toggle switch in HASS jumps back to the ‘off’ position. However, the relay itself stays on. I don’t know what to try next now… This is the HASS code i use now: