List of possible Event Listeners #1555
-
Hi community, I have already spent many hours using the online help and search engines. But I cannot find a list of all possible event handlers of an endpoint. My very simple problem: I want to intercept every switch request for a simple on-off device. endpoint1.events.onOff.onOff$Changed.on(value => .... But I also want to react to the event when the device is already on and another on request still comes in. But of course, "always" doesn't exist. What else can I do? Thank you very much. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
The full set of events for a behavior is:
We have plans to generate proper documentation. Unfortunately there aren't tools that will do it automatically so it will take a bit of work. Regarding "onOff$Always", as you note the attribute events only trigger when attributes mutate. If you want to detect "on" or "off" commands regardless of current state then you probably want to extend OnOffServer, then override If you are looking for a generic way to do this for any command the answer is a bit more involved. If you're trying to do that give us a bit more background on your use case and we can give you additional suggestions. |
Beta Was this translation helpful? Give feedback.
-
Hi lauckhart, thank you very much for your reply.
Background: I only need it to convert voice commands from Alexa to HTTP REST calls to my SmartHome. Local fulfillment without cloud peerings. Current example: I want to turn on the "light" with name vacuum-cleaner. After the vacuum cleaner has finished his job, the "light" in Matter is still in state "on". Next time I still want to turn the "light" on again without having to turn it off first. |
Beta Was this translation helpful? Give feedback.
The full set of events for a behavior is:
attr$Changing
andattr$Changed
for for enabled attribute in the corresponding cluster definitionevent
for each enabled event in the clusterWe have plans to generate proper documentation. Unfortunately there aren't tools that will do it automatically so it will take a bit of work.
Regarding "onOff$Always", as you note the attribute events only trigger when attributes mutate. If you want to detect "on" or "off" commands regardless of current state then you probably want to extend OnOffServer, then override
on
and/oroff
to add your custom logic.If you are looking for a generic way to do thi…