I tried many things since I am new it this. I am trying to keep it simple to find the issue. I was trying with shelly but did not work. Now I am trying NodeMCU ESP8266. I am using proven code I can send
It shows that it is connected
MQTT:
1565133506: New connection from 10.0.0.174 on port 1883.
1565133506: Client arduinoClient already connected, closing old connection.
1565133506: New client connected from 10.0.0.174 as arduinoClient (p2, c1, k15).
ESP8266:
WiFi connected
IP address:
10.0.0.174
Attempting MQTT connection…connected
configuration.yaml:
mqtt:
broker: 10.0.0.155
switch:
- platform: mqtt
name: “Switch1”
state_topic: “ha/switch1”
command_topic: “ha/switch1”
qos: 0
payload_on: “ON”
payload_off: “OFF”
optimistic: false
retain: true
I added “test here” to the code:
void callback(char* topic, byte* payload, unsigned int length) {
payload[length] = ‘\0’;
strTopic = String((char*)topic);
Serial.println(“test here”); //<< I added
if(strTopic == “ha/switch1”)
{
switch1 = String((char*)payload);
if(switch1 == “ON”)…
I never see that. What else should I check?