xbmcnut wrote:I'm using R148 and I have two switches, one on GPIO12 as a sensor for my garage door and another on GPIO14 to drive the relay. The relay needs to turn on for one second then off again to emulate the integrated garage controller. The GPIO12 switch is called 'reed' and is set to 'Push Button Active Low to toggle and the GPIO14 switch is called 'relay'. This is rule I applied to turn the relay off after 1 second. The board is a NodeMCU v3 but I'll be using a low voltage Sonoff in the production unit.
If I send a MQTT message to /devicename/gpio/14 with a payload on 1, the relay turns on for one second which is great! I have the Value Name 1: for the 'reed' switch set to state so that when the door is closed, I get /garage/reed/state with either 1 or 0 (opened or closed).Code: Select all
on System#Boot do gpio,14,0 // Prevent relay turning on during boot endon on relay#state do if [relay#state]=1 timerSet,1,1 // 1 second timer endon on Rules#Timer=1 do gpio,14,0 // Turn off relay endon
hi, in a similiar setup(using udp sento> i had problems with reliability. after some weeks i found, the 1-state was not detected--> the timer never fired --> relais stayed at1. now im using "pulse" command, which includes the off command. not sure how to use it with mqtt.
Short pulses
To send a pulse to a certain pin:
http://<ESP IP address>/control?cmd=Pulse,<pin>,<state>,<duration>
Example to send an active high pulse on GPIO 2 for 500 mSeconds:
http://<ESP IP address>/control?cmd=Pulse,2,1,500