hi guys!
how i can disable rule by button?
for example: if button1 pressed then disable rule automode-on
thanks…
-
How to disable rule by pressing button
-
I am not sure that this is possible.
But you can add a variable like “rule-is-active” and link this variable to your switch. In the rule you simple implement the variable with an “and”. Now you can switch on and off the rule.pimatic rocks!!!
-
It’s not possible.
I worked around this by using a variable in my rules. if the variable $cvblock is 0 then my heater may be turned on, if I set the variable $cvblock to 1 it cannot turn on."if $woonkamer-temp.temperature <= ($thermostaat.temperatureSetpoint - $cvmarge) for 5 minutes and $cvsummermode = 0 and $cvblock = 0 then turn Centrale verwarming on and set $cvstarttemp to $woonkamer-temp.temperature"
So if you make a button and a rule to change the variable, and edit your orignal rule to use that variable that would disable your original rule.
Follow my domotica project on http://maredana.nl
-
That’s possible by a script using the REST-API.
You only need to fill in
- id_OF_YOUR_RULE
- name_OF_YOUR_RULE
- USERNAME:PASSWORD
and set “active” to true or false
#!/bin/bash curl --silent\ -X PATCH \ --header "Content-Type:application/json" \ --data ' { "rule" : { "id": "id_OF_YOUR_RULE", "name": "name_OF_YOUR_RULE", "active": true, "logging": true}}' \ --user "USERNAME:PASSWORD" \ http://127.0.0.1/api/rules/id_OF_YOUR_RULE > /dev/null
Store that script in a path accessible by pimatic and make it executable (chmod u+x). Plus store another script for turning rule off (set “active”: false)
You might add a ShellSwitch to your config:
{ "class": "ShellSwitch", "id": "RuleSwitch", "name": "Turn my Rule:", "onCommand": "path to your on script.sh", "offCommand": "path to your off script.sh", "xOnLabel": "On", "xOffLabel": "Off" }
Important: Make a copy of your config.json in advance!
Cheers,
DerIng
Edit: Thanks to Icesory the DummySwitch in the first version was replaced by a ShellSwitch. So no need for an additional rule anymore …
-
@DerIng what is with a ShellSwitch? You can access the script direct without extra rules.
And the script can be extended by a given state.pimatic rocks!!!
-
But the easiest way is simple this.
Add a dummy switch. I call it Rule_Active.
Then is the rule like the followingif ["your rule stuff"] and state of Rule_Active is equal to on then "your rule stuff"
pimatic rocks!!!