HOW TO: Automatically turn off relay after defined time
-
I've covered how to turn relays on and off using a timer, now lets look at automating the off action based on a manual activation (by Dashboard button, Action Board or manually on the sensor page)
This method will also enable an off timer on a sensor that has been turned on via an external input.
I'll assume you have nothing setup in your system yet, other than your gateway, node and relay sensor.
We'll begin with adding a button for your relay(s) on your dashboard for easy access, then we'll create an OPERATION to turn off the relay after a delay, and lastly we'll tie the whole lot together so your relay automatically turns off after you turn it on via the dashboard.
-
Adding the dashboard buttons
a) Enable edit mode on the dashboard:
b) Click the "PLUS" icon to open the "Add New Widget" dialog:
c) On the "Add New Widget" dialog, click "Sensors":
d) On the new blank widget, click the COG to enter the settings:
e) Enter the details of your sensor widget and select the sensors you want to add to the dashboard from the list:
e) Your dashboard widget should now have some nice buttons for you to manually turn your relays on and off, finalise your new widget by clicking the highlighted check mark in the top right corner of the page:
-
Create the OPERATION used to turn off the relay after an amount of time
You'll need an operation for each of the sensors (relays) you want to turn off, so repeat this step for each one.
a) Click RESOURCES > OPERATIONS > "Add Operation"
b) Give your new OPERATION a name
c) Select ENABLED
d) OPERATION TYPE: Send Payload
e) RESOURCE: Sensor Variable
f) Select relay sensor from list
g) PAYLOAD: 1 (ON)
h) DELAY: 2700 (time in seconds, 2700sec / 60 = 45min)
i) Click SAVE
-
Add a rule to automatically turn off the relay
a) Click RESOURCES > RULES > "Add Rule"
b) Give your Rule a name
c) For 'Condition type', select "STATE" and "SENSOR VARIABLE"The next line of the dialog defines the trigger for the rule, the workflow goes like this:
"WHEN THIS == (equals) THAT, DO THIS'd) For 'Trigger when', select the sensor (relay) you want to turn off with this rule
e) Select '==' (equals, as opposed to != which is 'does not equal') and select 'OFF' in the last dropdown.
f) In the bottom section (Operations), select the operation you just created to turn off the sensor (relay)
g) Hit Save!
Congrats! You can now press the button on your dashboard and know that the sensor (your relay) will turn off after your defined time!
In my system, I am using this as a manual trigger for my watering system, so I can run a sprinkler zone outside of the schedule, and not have to manually turn it off.
-
-
@zachflem said in [HOW TO: Automatically turn off relay after defined time]
For my garden lights, i disable the rule if triggered once and re-enable it after 20 hours, so that is does not keeps switching the relay on over and over again...
Very extensive tutorial!! great work!! :thumbs_up:
-
@tag for my application, I wanted to be able to manually trigger my sprinklers outside the schedule, so this seems to be working pretty well. I don't think I have a need to lock out the operation for any reason yet, but I'll keep it in mind!