Hi all,
I am entirely new to Node-Red, JSON, Javascript or programming in general.
I'm hoping someone can help with what on the face of it seems a very straight forward thing to do, although for now, it's waaay beyond my knowledge and skills.
What I want to do is open and close the garage door using the following.
- MQTT and Node-RED runnning on a Pi (both currently working fine)
- A Shelly 1 relay - this works fine via the shelly app (I can open and close the door no problem and can also read the status of whether or not the door is closed or open by using a reed relay to detect with the Shelly1 SW input when the door is fully closed).
- Sonoff RF bridge flashed with Tasmota
- 433 Mhz sonoff switch (This is a momentary switch which generates a single data code when pressed)
Current status with using Node-RED:
I have the Sonoff switch talking to the RF bridge and detecting when the sonoff switch button is pressed
I can use an MQTT input to recognise when the sonoff switch button has been pressed.
I can use an MQTT input to determine whether or not the Garage door is open or closed
I can send a command to the Shelly via MQTT to open or close the garage door
What I need to be able to do is:
On the press of the sonoff switch
-
Check the status of the garage door: Is it open or closed
Door is closed: shellies/shelly1-Exxxxx/input/0=1
Door is open: shellies/shelly1-Exxxxx/input/0=0 -
Depending on the door status send an MQTT command to the Shelly to either close the door if its open or open the door if its closed. (shellies/shelly1-Exxxxx/relay/0/command=on)
I've searched the web and youtube for an example I can copy but not found anything I can use or make work.
Could somebody please either point me in the direction of a tutorial I can copy or give me some pointers to what nodes I should use?
Thanks in advance ...