Closed tiramiseb closed 9 years ago
That will not happen, because it's not done like that internally. But you can do what you want by using a script in the condition instead of your action, and then set the condition triggers by using both of your switchs.
That will not happen, because it's not done like that internally.
And could it not change internally ? :-)
But you can do what you want by using a script in the condition instead of your action, and then set the condition triggers by using both of your switchs.
I don't get that. If I put multiple conditions, it acts as an "and", not an "or"... am I not right ?
No it can not be changed, as it's not working like that...
For the condition, yes you are right, but for script condition there is something special that you can use. Whan you add a script condition and click on it, in the window you have a special button called "Trigger inputs" and when you click on it you can choose all inputs that will trigger the script execution. Then in the condition script you need to return either true or false for the action to be run or not.
The scenario triggers twice : once when I press the switch, once when I release it. How can I limit that behaviour ?
And can I trigger this script from the Android interface ?
This trigger is just for triggering the script execution, it's up to you in the script to decide what you want to do based on the switch value like:
if calaos:getInputValue("switch1_id") == "true" then
--- do something
return true
end
if calaos:getInputValue("switch2_id") == "true" then
--- do something
return true
end
return false
And to trigger a "switch" rule from any interface it works the same as always, use a scenario button. And then add it to your condition script.
That means if I add a third switch to trigger the switch, I also have to modify the switch.
Not suitable to my needs, sorry :)
See #67 for an alternative I'm suggesting.
I don't understand what you mean... sorry.
In the condition script I have to test the value of each of the possible triggers (all the switches), with an "if" condition as you mentioned. If I have 2 switches and I add a 3rd one in the triggers, I also have to modify the script in order to check its value too. It's only done one or twice in the lifetime of the house, but the idea of data duplication makes me sad...
That was only an example. You asked for something about lua scripting, I answered with an explanation, not a solution to your specific problem.
You asked for something about lua scripting, I answered with an explanation, not a solution to your specific problem.
No, I asked how I can limit the behaviour so that the script only triggers when any of the switches is only pushed, not released. :)
Hello,
I think scripts could be more useful if they were stored as room elements instead of actions : so multiple rules could use one script (for example to have two switches make the same actions, on opposite walls of the same room).