At the moment I am working on a solution to control SR-201 ethernet relays during my testing I ran into some thing which raise questions.Eventually I want to publish some kind of tutorial with working examples, so I already started to store some of my files and code in a Github repository [github SR-201.
My scripts expects two parameters, an IP address for the relay board to control and a integer as command.
When I create switches on my sitemap I can use a rule with Execute commandline to call the python scripts with the required parameters. Execute commandline does not feel really nice, I’d rather solve this with the 2.0 Exec binding.
- Can I call/trigger Exec things directly from rules? The documentation suggests that things become available to the rules engine but I cannot find a working example which triggers the exec binding.
- Is it worth the effort to trigger my scripts through the Exec binding or should I just keep using excute commandline?
I was hoping to be able to trigger one thing with parameters based on which switch was toggled e.g.
Switch1 ON would trigger the Exec input with IP xx.xx.xx.xx and COMMAND 11 to turn on Relay 1. Switch 2 would then trigger for the same IP but with 12 as command to turn on relay 2.
Mappings basically allow me to this without using any rules whatsoever, but mappings with values other than ON or OFF cannot use a standard toggle switch. So I am hoping someone can point me in the right direction efficiency and manageability wise.