Parameterised scripts
Posted: Friday 15 June 2018 10:31
As I get further into Domoticz Im appreciating the power of dzvents. I've developed a bunch of scripts to work with PIR sensors in various rooms. As I've refined my code these scripts basically all do the same thing, but with different devices.
Rather than having a script for my bathroom, a script for the hallway etc, all containing duplicated identical logic but different devices, is it possible to have a 'generic' PIR device script that is called with parameters to specify the PIR/scenes to activate etc, so the logic is only contained in a single script?
I guess I could keep the 'on = {' section specific to each situation, but within the 'execute = {' call out to a parameterised generic helper function that contains the main bulk of the logic?
TIA
Andy.
Rather than having a script for my bathroom, a script for the hallway etc, all containing duplicated identical logic but different devices, is it possible to have a 'generic' PIR device script that is called with parameters to specify the PIR/scenes to activate etc, so the logic is only contained in a single script?
I guess I could keep the 'on = {' section specific to each situation, but within the 'execute = {' call out to a parameterised generic helper function that contains the main bulk of the logic?
TIA
Andy.