Hello Home Assistant community.
Starting with Home Assistant I have some trouble to sent MQTT messages from
Home Assistant (running on a raspberry) to an ESP8266 Wemos D1 (configured with ESPEasy Mega).
I just want to swith off the built-in LED on the ESP8266.
Therefore I want to publish a MQTT message from HA and receive this message on the ESP8266.
A rule is running to check the incoming message for the correct payload and turn off the LED.
I publish the MQTT message from the Mosquitto MQTT Broker from HA.
With the MQTT Explorer I can see the published messages, but the ESP8266 do not response.
I think I make mistakes to send the MQTT messages correctly…
Could someone help me and provide some information to solve this, please?
Via HTTP I can switch off/on the LED:
Off:
http://192.168.1.37/control?cmd=GPIO,2,1
On:
http://192.168.1.37/control?cmd=GPIO,2,0
In addition the other way round (from ESP8266 to HA) is working well.
A DHT22 sensor attached to the ESP8266 is sending via MQTT the values for temperature and humidity.
Below are pictures of the configuration and what I tried so far.
Cheers and many thanks in advance!
EDIT1:
Obviously I cannot attach all pictures I made from my configuration.
So, here are written details about the configuration I used for ESP Easy Mega.
EDIT 2:
I attached an “all in one picture” and hope this will allow you to understand the details
Unit Name:
ESP_Sensor_GZ (_1 attached automatically by ESP Easy)
MQTT Controler Client ID:
ESP_Sensor_GZ_MQTT
Controller Subscribe:
%sysname%/#
Controller Publish:
%sysname%/%tskname%/%valname%
Generic - MQTT
Name: ESP_Sensor_GZ_MQTT_Import
MQTT Topic:
ESP_IN
Value:
Incoming_val
ESPEasy Rules I tried:
// Working
On MQTTimport#Connected do
Publish,%sysname%/status,MQTT_Import_is_now_operational
Endon
// Not Working
On ESP_Sensor_GZ_MQTT_Import#Incoming_val=1 do
GPIO,2,1
Endon
// Not Working
On ESP_IN#Incoming_val=1 do
GPIO,2,1
Endon
On HA side I tried via Mosquitto to publish MQTT messages with several different topic without success.
Topic:
/ESP_Sensor_GZ_MQTT/Incoming_val
Paylod: 1
/ESP_Sensor_GZ_MQTT/ESP_IN
Paylod: 1
/ESP_Sensor_GZ_MQTT_Import/ESP_IN
Paylod: 1
…and different variants of it. Including with and without leading “/”