Hi,
When executing a shell command the command usually returns 0 on success, and something else on failure. The return value of a command can be displayed using echo $?
. So, to make the return value compatible for the ShellPresenceSensor the 0 has to be transformed to a 1 and other return values should be transformed to a 0. I do this in the following way:
if <some command>; then echo 1; else echo 0; fi
I think it would be nice to have an invert option in the ShellPresenceSensor which inverts the state of the command. That way the following could be used:
<some command>; echo $?
Or maybe it is possible if the return value of the command is handled directly by the ShellPresenceSensor where a return value of 0 is interpreted as present and any other return value as not present.
I think the same could apply to the getStateCommand of the ShellSwitch
Also I think it would be good if true/false and on/off values would be validated case insensitive.