When the movement sensor detects a movement (and it is marked as armed) the ESP i am using NodeMCU lost the connection to MQTT server and don’t response. I have uploaded the same code you put and i guess i have the same circuit 🙂
Any feedback about it?
More information.. after execute the client.publish(“home/office/esp1/motion/notification”, “MOTION DETECTED”);
I lost the connection to the MQTT server… (my mqtt uses user and password) and start to receive this
Attempting MQTT connection…
failed, rc=-2 try again in 5 seconds
I need more information about your setup.
- Can you post your code on Pastebin.com?
- Everything else is working properly? For examples, the sensor is posting data to the Node-RED UI?
- When you click the Arm button, do you receive the armed message back in the Node-RED UI?