void receive not work with RelayActuator.ino ?
-
Hi all,
I don't understand a problem,
My receive function is not working in the sktech relayActuator.ino
If I simply add the following code :.... void receive(const MyMessage &message) { Serial.print("--- Incoming Message ---"); // We only expect one type of message from controller. But we better check anyway. if (message.getType()==V_STATUS) { ....
I never have anything.
But in the node logs I do receive the information:
Relay OFF :345110 TSF:MSG:READ,0-180-162,s=180,c=3,t=6,pt=0,l=1,sg=0:0
Relay ON:
355655 TSF:MSG:READ,0-180-162,s=180,c=3,t=6,pt=0,l=1,sg=0:1
For information I use a gateway+W5100 in MQTT.
An idea why the receive function is not working here ?
Thank you all
-
@yourry Don't use serial print inside the receive function.
instead set a variable in receive and test for that in the main loop and then send serial from the main loop.
This is probably all the problem is........ probably.......
-
Thanks for the answer, I keep the advice.
Finally I looked for a while and the problem was with the MQTT publish syntax.
It works perfectly, the difficulty is to find the right publish MQTT request.
Thank you.
-
@skywatch said in void receive not work with RelayActuator.ino ?:
Don't use serial print inside the receive function
Why not? Receive doesn't run in interrupt context, so it should be safe to serial print from it...
-
@Yveaux I'm sure it's in the forum posts somewhere but I don't have time to look for it.
Maybe you could do a list of what is and isn't possible in void receive to mitigate further confusions?
Suggested Topics
-
Day 1 - Status report
Announcements ⢠23 Mar 2014, 22:45 ⢠hek 24 Mar 2014, 20:12 -
JSN SR04T - Temperature Influencing Readings
Troubleshooting ⢠6 Sept 2019, 07:51 ⢠Timbergetter 30 days ago -
DHT22 wrong sensor type in Home Assistant
Troubleshooting ⢠17 days ago ⢠Commodoreuno 11 days ago -
Forum Search not working?
Troubleshooting ⢠4 Oct 2023, 23:33 ⢠Gibber 2 Sept 2024, 20:28 -
Can not compile MySensors on esp8266
Troubleshooting ⢠24 Aug 2024, 15:35 ⢠TheoL 29 Aug 2024, 20:47 -
NODs stop responding, but ping works.
Troubleshooting ⢠8 Mar 2025, 19:47 ⢠Marcin 8 Mar 2025, 19:47