feat(ha): treat notificationComplete as stateless event like action#31686
feat(ha): treat notificationComplete as stateless event like action#31686rohankapoorcom wants to merge 3 commits intoKoenkk:devfrom
Conversation
Extend Home Assistant extension handling so notificationComplete follows the same pattern as action: clear from cached state after publish (always, unlike action which clears only with legacyActionSensor), publish the value to a dedicated MQTT topic for device triggers, and run device trigger discovery. Adds STATELESS_EVENT_PROPERTIES to list event-like state keys; skip empty values to avoid re-entrant clears. Supports Inovelli ledEffectComplete (zigbee-herdsman-converters) without overloading the action property. Made-with: Cursor
04ade77 to
d68f93f
Compare
Add integration tests for STATELESS_EVENT_PROPERTIES: MQTT device trigger discovery, dedicated topic, state clear on json output, and no device_automation when output is attribute. Made-with: Cursor
Made-with: Cursor
|
I would propose to rename |
|
The switches already send an |
|
What about |
|
There's a bunch of different values though, not just one and we need to know which one is returned: |
|
Agreed with the no-more-action-like props decision. It would too quickly become a nightmare for both dev maintenance and user usage patterns. |
I'm not 100% familiar with Z2M (I use ZHA), but yes, the switch in question broadcasts that the notification is dismissed through this event. And there are many possible values it passes along with it for combination(s) of LEDs that are no longer being used for the notification. My understanding is that it'll be much easier to code this if the Hopefully this helps and/or @rohankapoorcom or @MrDaGree could better clarify. |
If your question is do we need to know whether the notification is complete, yes. @wbyoung made a notification manager for Inovelli switches. It needs to know which notifications that were triggered are still running and the only way to know that is to get the completion event. If the question is do we need to clear the notification completion event, I believe so. The problem otherwise is that the state becomes "sticky" and the notification manager has no idea what it is referring to when the notification completion doesn't change. Here's an example workflow:
Please let me know if you can think of another way to handle this. |
|
Could this maybe be exposed as a binary which goes to |
Probably not. The notification complete contains several possible payloads (for ALL_LEDS or LED_1-LED_7 getting completed). |
|
I don't see why that would expose blocking each led as a binary, in case |
|
How would a binary help here? How do they get "reset" and set back to false? Don't we still have the same problem?
|
|
If I understand correctly, this will give the following behaviour: Start situation:
State change:
State change:
Can detect the change because
State change:
State change: Would that solve the issue? |
Summary
Extend the Home Assistant extension so
notificationCompleteis handled likeaction: clear from cached state after publish, publish to a dedicated MQTT topic for device triggers, and run device trigger discovery.Behavior
action: unchanged — clear only whenlegacyActionSensoris enabled.notificationComplete: always cleared after publish so the last LED effect completion does not linger in state.zigbee2mqtt/<device>/<key>and device trigger discovery runs.Motivation
Supports Inovelli
ledEffectComplete(from zigbee-herdsman-converters) as a one-off event without overloading theactionproperty.Related context:
Implementation
STATELESS_EVENT_PROPERTIES(action,notificationComplete).undefinedor empty string values to avoid re-entrant clears.Made with Cursor