I have a GE portable motion sensor that gives a whacky responses for the ‘burglar’ entity: 8 for motion, 0 for no motion, 254 for sleep. When motion occurs, I get an ‘8’ for approx. 1 min (the timeout value set in the z-wave settings), ‘0’ when no motion is detected for 1 min (again, I’m assuming this is related to the timeout value), and all other times ‘254’. If motion is detected before the timeout, the entity returns ‘254’, and then gives ‘0’ approximately 1 min after the last motion.
I’m looking for a way to make a custom sensor that will give context to the ‘254’, making it easier to use in automations.
Ideally, I’d like the following:
burglar entity gives ‘8’ --> new sensor gives ‘on’
burglar entity gives ‘0’ --> new sensor gives ‘off’
burglar entity gives ‘254’ but previous value was ‘8’ --> new sensor gives ‘on’
burglar entity gives ‘254’ but previous value was ‘0’ --> new sensor gives ‘off’
I suspect I can do this easily using hass-variables (https://github.com/rogro82/hass-variables) by setting a variable state whenever the signal changes but I’m wondering if there is a better option, what wouldn’t involve copying code for every sensor I have.
Thanks!