Hello everyone, I would need a little help as I have reached my coding limits between these two platforms.
I managed to link MQTT with NodeRed which sends a message to the Arduino to send a 433 code but it doesn’t work.
I specify that the Arduino code seems to send something to the transmitter because I added an indicator LED that blinks well but no reaction from my 433 device.
Here is the part of the flow:
a = ‹ « SendRadioCode » ›
msg.payload=« {"function_name":" » + a + « ","Code":" » + msg.payload + « "}% »;
return msg;
which gives a send of this type:
« {"function_name":"SendRadioCode","Code":5588308}% »
On the Arduino side, here is the reception code retrieved from Gladys V3:
void executeFunction(String json_data) {
StaticJsonBuffer<200> jsonBuffer;
JsonObject& v = jsonBuffer.parseObject(json_data);
//we decompose the string
if ( v[« function_name »] == String(« SendRadioCode ») ) {
SendRadioCode(v[« code »]);
}
}
And that’s it…
If you manage to understand everything and have a bright idea, I’m interested…
I was asking you if you had an RFlink setup, that is, an Arduino Mega, a transmitter, and a receiver, and in the Mega you inject the Rflink program (open source project)
Oh yes, I had briefly looked into that during the V3 era, but I came across rflink and since I had a mega, I went ahead with the installation and it’s much less of a hassle with the code. If you come by with a Mega 2560, I made a tutorial on Node-RED and rflink that works well (for me), you’ll just need to do a bit of coding under Node-RED.
Hello @tiboys! Does the Arduino part alone work well? If you take your Arduino, connected to your computer with the Arduino software, does it work well?
Hi @pierre-gilles, the same thing happens when I connect the Arduino to a local NodeRed.
Reception is fine with button modification in Gladys via MQTT, but transmission does not work.
« {"function_name":"SendRadioCode","Code":5591380}% »
The message is sent to the Arduino and the LED connected to the transmitter blinks, but the 433 devices do not react.
The format of the sent code seems to respect the one expected by the Arduino since the LED blinks, but it is impossible to know where it is stuck.
I tested with another 433 reception Arduino, but it does not pick up anything, as if the sent code was not « appropriate ».
Bingo, the request in the Arduino serial monitor activates the 433 device:
{« function_name »:« SendRadioCode »,« code »:« 5588308 »}%
So it must be between NodeRed and the Arduino..
It must be in this request that it hangs then:
a = ‹ « SendRadioCode » ›
msg.payload=« {"function_name":" » + a + « ","code": » + msg.payload + « }% »;
return msg;
@pierre-gilles, I reviewed your very instructive video.
I didn’t realize, but in fact the logs you’re talking about correspond to the debug.
I’ve been using it since the beginning to see where it’s stuck.
Well, I’m really a fool. I just realized I had a capitalization problem in the « Code » while the Arduino was expecting « code ». I wasn’t rigorous enough about the case of the values
Thanks @Psoy for your post, sorry I didn’t see your response. I’ll check out your tutorial and keep it on hand.
Thanks to both of you.