My first advice is not to run any Blynk code on your hardware device. Use MQTT for communication between the device and your server, and use the Blynk ws contrib for communication between Node-Red and your Blynk server.
Secondly, I can’t see why you’re using API calls to the server. This is totally unnecessary when you’re using the Blynk ws contrib.
The syntax of this looks a bit odd to me:
If you only want msg.payloads of “1” to be passed through then I think you need some curly brackets around the
return msg;
line of code.
Have you read this topic:
Pete.