MQTT Stopped working when switched from Ethernet Cable to WIFI

After following the reply given here

When i switch my Ethernet Cable Connection to wifi my MQTT Stopped working. I am no more able to switch the relay on/off o my NodeMCU with ESPEasy.

EasyESP Log stats connected to Broker and everything seems to be alright. But still not able to switch relay. When my RPI3 was connected to physical ethernet cable to my router. I was able to switch normally. But now my RPI3 is connected to router using wifi MQTT stopped working.

Please advise what could be wrong ?

Check all configs for IP Address settings.
Most likely, the rPi3 has a new (different IP) on the wifi side
update your configs to use the new IP

You can also set a static IP on the rPi3:

How do you try to switch the relay? using an OH2 item, using a MQTT publish command, another way?

1 Like

I am using mqtt to operate the relay using openhabian in raspberrypi and easyesp in node mcu… I have already changed the new ip address of wifi side in cofigs… Even my nodemcu log also shows that it is connected to broker… but I am not able to operate the relay using wifi anymore but it was working fine with Ethernet…

Easyesp log

MainConfigHardwareDevicesTools

Log
373 : INIT : Booting Build nr:120
1259 : WIFI : Connecting… 1
6269 : WIFI : Connected!
6269 : INIT : I2C
6291 : MQTT : Connected to broker
6299 : Subscribed to: /MASTERSW/#
6299 : INIT : Boot OK
6299 : INIT : Normal boot
36300 : WD : Uptime 0 ConnectFailures 0 FreeMem 27808
Powered by www.esp8266.nu

how do you send the command to the mqtt topic?

This is items file in openhab

Switch MQTTLED {mqtt=">[broker:/MASTERSW/gpio/16:command:ON:1],>[broker:/MASTERSW/gpio/16:command:OFF:0]"}
Switch MQTTLED1 {mqtt=">[broker:/MASTERSW/gpio/5:command:ON:1],>[broker:/MASTERSW/gpio/5:command:OFF:0]"}

This is the sitemap file that I am using…

sitemap home
{
Frame label=“MQTT Test”
{
Switch item=MQTTLED label="LED"
Switch item=MQTTLED1 label=“LED2”
}
}

ok (they look good). post your mqtt.cfg file also please (as well as mosquitto.conf)
did you modify the mqtt.cfg (or mosquitto.conf) when you changed the connection settings to the wifi in any way?
any errors in openhab.log when OH2 tries to connect to the broker?

mqtt.cfg file was having old broken ip i.e ip of cable ethernet.

I updated the broker ip in mqtt.cfg to the new wifi ip address and its done :slight_smile:

Thanks alot…really appreciable…

1 Like