Custom trigger decorators #464
Unanswered
j-steve
asked this question in
Show and tell
Replies: 1 comment 1 reply
-
I'm a noob here, I do grok how you set this up. Could you point me to a documentation place or a more expanded example? Thx. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been using some custom trigger decorators that I've found useful, sharing in case others might want to do similar things:
Example usage:
zha_trigger
just simplifies the syntax for listening for Zigbee events, which is quite common in my code.on_off_trigger
is a wrapper aroundstate_trigger
which only responds to "on" and "off" values (so it won't be triggered for anomolous states like "unknown") and converts the state to a boolean for easier handling, It also converts hold duration to minutes, and always enablesstate_check_now
(so it plays nicely with unexpected system reboots).These are pretty minor but they do simplify the syntax within my code!
Beta Was this translation helpful? Give feedback.
All reactions