-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Track HS2WD-E siren in a virtual state #8834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/devices/heiman.ts
Outdated
| clearTimeout(globalStore.getValue(entity, 'state_timer')); | ||
| globalStore.clearValue(entity, 'state_timer'); | ||
| if (siren_on) { | ||
| const duration = Math.min(values.duration, 240); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
240 is a placeholder for the actual max duration for now
That's fine
What is the use case for this? Do you want to publish siren OFF after a certain time? |
Yes, exactly . Not sure how other warning devices return their state, through ias Zone Status maybe, but this one doesn't return anything, which make it's use as an HA siren a bit tricky I wanted to copy the idea of the occupancy sensors that don't reset their state, but as those timers are created from within fromZigbee convertSet they have access to |
|
We have to add a |
The HS2WD-E does not report on its state. Attempts to track current state by tracking duration and siren mode/duraition
this is the last *read* value when setting max_duration, it updates the state if Optimistic is on, but the cluster attribute cache is still on the old one... need to set the value, and force a refresh for it to be taken in account
b2756c1 to
4265f6d
Compare
|
Beside the naming of the meta and the virtual state, |
src/converters/toZigbee.ts
Outdated
|
|
||
| // Track and maintain a virtual state of the siren | ||
| // is on if duration set, and either strobe with dutycycle or alarm is set | ||
| const virtualState = meta.mapped.meta?.virtualState?.warning; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What holds us from not enabling this for every device?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I simply have no clue how other warning devices return their state ... as this siren doesn't support most of the options, it might not be the best example device to generalize
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it conforms against the ZCL spec so should be fine, let's try it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made available to all warning devices🤞
The siren_state will still needs to be exposed
| /** | ||
| * Maintain a virtual state for devices that don't report it | ||
| */ | ||
| virtualState?: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be removed now.
| await endpoint.read("ssIasWd", ["maxDuration"]); | ||
| }, | ||
| exposes: [ | ||
| e.binary("siren_state", ea.STATE, "ON", "OFF").withDescription("Alarm state (Virtual)"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be added to every device having tz.warning, maybe good to add it to exposes.ts
|
This pull request is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days |
The HS2WD-E siren does not report back its state.
As the siren command has a duration (and a max duration config) , it will stop at some point, but the triggering system as no way to know that.
Attempts to track current state by looking at the mode, duration (and strobe) when the command is sent.
This is not ready to merge.
2 open questions :
convertSetcontext with a delay ? there is no easypublishavailable as in fromZigbeeconvertmetabe the right place to turn on this virtual state ?