Are Z-wave constants available in AppDaemon somehow? For example, currently my code for my door lock might look something like this:
def lock_state_change(self, entity, attribute, old, new, kwargs):
if (new == 0x16):
self.log("Door opened")
elif(new == 0x17):
self.log("Door closed")
else
self.log("Unknown door state {}".format(new))
I’d rather have it look more like this:
def door_state_change(self, entity, attribute, old, new, kwargs):
if (new == ZWaveConstants["Notifications"]["AccessControl"]["DoorOpen"]):
self.log("Door opened")
elif(new == ZWaveConstants["Notifications"]["AccessControl"]["DoorClosed"]):
self.log("Door closed")
else
self.log("New door lock state {}".format(ZWaveConstants["Notifications"]["AccessControl"][new]))
I’m completely new to Python, so perhaps that’s not a very python-y syntax, but you get my point I hope. The intention of the last row would be to convert, for example, the new state 0x0B to text “Lock Jammed” so I don’t need to type in every possible state when I’m not sure if the lock even uses all of them.
The notifications and events are available here: http://zwavepublic.com/sites/default/files/SDS12652-13%20-%20Z-Wave%20Command%20Class%20Specification%20N-Z.pdf starting on page 69. There’s 11 pages of them so I don’t want to start typing if someone has already done the heavy lifting.