I would like to create a switch that when clicked if it is ON it executes the disable alarm script
if it is OFF, it executes the enable alarm script.
This is not so difficult, with the exec binding.
But I would like also to update the alarm switch state when the output of the alarm status script has changed, because the alarm can also be enabled/disabled from the physical interface.
How can I achieve this?
I’m sorry for this question but I don’t know how to do it.
Hi,
firstly, thank you fro your reply.
I’m using OH2.5
For controlling my alarm I have the three python scripts listed before. So I guess I need to use the Exec binding to execute those scripts.
OH 2.5 is not scheduled to be released until the end of this year. There are various testing & Unstable versions now though. Which one? Milestone 4 was released within the past day.
And which SNAPSHOT version? They are released nightly.They are expected to have errors which can be reported through GitHub.
Snapshot versions are not usually recommended for daily use unless developing a binding.
Have a go. Try it. Come back to us if are stuck or publish your working code.
We will help if you make an effort but we will not write code for you.
I can write it for you but I’ll charge…
Hi,
I’ve checked out your links and finally I found a solution.
I’ve used a secondary item that maintains the state of the alarm.
Then there’s a rule that is triggered when that item changes.
This is myItems.items Switch Allarme "Allarme" ["Switchable"] String Stato_allarme {channel="exec:command:alarm_state:output"}
This is myThings.things (obviously I’ve used the Exec Binding) Thing exec:command:alarm_state [command="C:\\Python27\\python.exe C:\\openwebnet\\stato_allarme.py", interval=10 , autorun=true ]
These are the rules:
rule "Alarm state changed from 0 to 1"
when
Item Stato_allarme changed from 0 to 1
then
Allarme.sendCommand(ON)
end
rule "Alarm state changed from 1 to 0"
when
Item Stato_allarme changed from 1 to 0
then
Allarme.sendCommand(OFF)
end
rule "Alarm received ON command"
when
Item Allarme received command ON
then
executeCommandLine("C:\\Python27\\python.exe C:\\openwebnet\\enable_alarm.py")
end
rule "Alarm received OFF command"
when
Item Allarme received command OFF
then
executeCommandLine("C:\\Python27\\python.exe C:\\openwebnet\\disable_alarm.py")
end
Can you share the 3 python scripts as well?
It may be useful for others until the OpenWebNet binding will support alarm.
I also suggest you add BTicino in the thread title so that is more focused.
Hi, so with this solution you no longer need F422? is a 3477 enough? I refer to cases where I only have the burglar alarm system without lights and roller shutters.
Download my scripts from here and put them in /home/openwebnet for example
Install the Exec binding in your openhab instance (more info here)
Use executeCommandLine(“/path/to/python/installation/python /home/openwebnet/enable_alarm.py”)
command in your .rules file when you want to execute a script
Unfortunately I was unable to manage the scripts.
I have given up for myself as I am not a programmer a mountain too high to climb …
However I solved it like this:
I installed a 3477 on the anti-theft scs bus.
I have configured the first Aux 1 channel ON and the second Aux 1 channel OFF. Then I have 2 shelly 1s that will command the two interface contacts.
This is a tip for everyone who has only the alarm scs bus at home.
Then I also ran a rule that allows me to use the shelly contacts alternately.