The alarm panel defaults to a hard-coded 0 state ("Home" mode), which immediately would result in an alarm after restarting Node-RED in case a "Home"-sensor triggers at this time.
I would like to avoid enabling the default use of persistent storage for global context variables. It would be sufficient for my environment to just start with a disabled alarm panel (state 3) instead of "Home"-mode (state 0).
To achieve this I extended the code to have a default/fallback state configurable instead of having it hard-coded to 0. It would be used whenever Node-RED is started without an existing global 'SecuritySystemCurrentState_' + node.nodeId variable.
This defaultState option as well defaults to 0, so it shouldn't disturb existing setups.
Note: For quite better solution to address this topic see #23 .
The alarm panel defaults to a hard-coded
0
state ("Home" mode), which immediately would result in an alarm after restarting Node-RED in case a "Home"-sensor triggers at this time.I would like to avoid enabling the default use of persistent storage for global context variables. It would be sufficient for my environment to just start with a disabled alarm panel (state
3
) instead of "Home"-mode (state0
).To achieve this I extended the code to have a default/fallback state configurable instead of having it hard-coded to
0
. It would be used whenever Node-RED is started without an existing global'SecuritySystemCurrentState_' + node.nodeId
variable.This
defaultState
option as well defaults to0
, so it shouldn't disturb existing setups.Note: For quite better solution to address this topic see #23 .