I have a system designed using an ESP32 control board and Node-Red for the web interface. The system has an alarm that can be armed from either the Raspberry Pi running Node-Red or from the ESP32 board. There is an LED on the ESP32 and the Raspberry Pi that blinks fast when the system is armed and slow when unarmed. When I arm the system from the Pi, I can easily change the LED flash rate on the ESP32 by publishing a message that the ESP32 is subscribed to. When arming the system from the ESP32, changing the flash rate on the Pi is not so easy. The system cannot be armed or disarmed with the web interface. That may be a future addition.
I am able to change the Pi LED flash rate when the system is armed from the ESP32. The way I do this is with a C program that is running in the background. When the system is armed from the ESP32, it publishes to topic /esp32/door/arm with a message of either "one" or "two". One indicates armed and two indicates unarmed. The Raspberry Pi is subscribed to this topic and writes the "one" or "two" to a text file. The C program checks this text file every 5 seconds and retrieves the "one" or "two". If the value read is different than the previous value read from the file, it changes the flash rate on the Pi LED.
I just wanted input from anyone here that can think of a better way of doing it than the method I am currently using. The C program running on the Pi controls the Pi flash rate and also monitors for the arm push button being pressed to arm the system. I am using the wiringPi library to control the GPIO pins. Maybe when the subscribed topic comes in, have it run another program and pass the "one" or "two" to the program as an argv argument?? I don't know if this is possible or not.