Files
core/homeassistant/components
Andrew Hayworth 05586de51f Set lock status correctly for Schlage BE469 Z-Wave locks (#18737)
* Set lock status correctly for Schlage BE469 Z-Wave locks

PR #17386 attempted to improve the state of z-wave lock tracking for
some problematic models. However, it operated under a flawed
assumptions. Namely, that we can always trust `self.values` to have
fresh data, and that the Schlage BE469 sends alarm reports after every
lock event. We can't trust `self.values`, and the Schlage is very
broken. :)

When we receive a notification from the driver about a state change,
we call `update_properties` - but we can (and do!) have _stale_
properties left over from previous updates. #17386 really works best
if you start from a clean slate each time. However, `update_properties`
is called on every value update, and we don't get a reason why.
Moreover, values that weren't just refreshed are not removed. So blindly
looking at something like `self.values.access_control` when deciding to
apply a workaround is not going to always be correct - it may or may not
be, depending on what happened in the past.

For the sad case of the BE469, here are the Z-Wave events that happen
under various circumstances:

RF Lock / Unlock:
- Send: door lock command set
- Receive: door lock report
- Send: door lock command get
- Receive: door lock report

Manual lock / Unlock:
- Receive: alarm
- Send: door lock command get
- Receive: door lock report

Keypad lock / Unlock:
- Receive: alarm
- Send: door lock command get
- Receive: door lock report

Thus, this PR introduces yet another work around - we track the current
and last z-wave command that the driver saw, and make assumptions based
on the sequence of events. This seems to be the most reliable way to go
- simply asking the driver to refresh various states doesn't clear out
alarms the way you would expect; this model doesn't support the access
control logging commands; and trying to manually clear out alarm state
when calling RF lock/unlock was tricky.

The lock state, when the z-wave network restarts, may look out of sync
for a few minutes. However, after the full network restart is complete,
everything looks good in my testing.

* Fix linter
2018-12-07 21:17:34 +01:00
..
2018-12-06 00:30:33 +01:00
2018-11-15 14:30:37 +01:00
2018-12-04 13:24:18 +01:00
2018-12-06 09:20:53 +01:00
2018-12-02 16:32:53 +01:00
2018-12-04 10:08:40 +01:00
2018-12-06 00:30:33 +01:00
2018-12-06 00:30:33 +01:00
2018-12-05 09:31:07 -05:00
2018-11-21 20:55:21 +01:00
2018-12-07 07:12:59 +01:00
2018-12-06 10:38:26 +01:00
2018-10-14 17:11:39 +02:00
2018-11-15 14:30:37 +01:00
2018-12-02 16:32:53 +01:00
2018-12-06 11:54:44 +01:00
2018-12-06 00:30:33 +01:00
2018-12-02 16:32:53 +01:00
2018-12-06 00:30:33 +01:00
2018-12-06 00:30:33 +01:00
2018-11-06 10:36:52 +01:00
2018-11-26 14:30:21 +01:00
2018-12-07 07:06:35 +01:00
2018-12-06 16:25:58 +01:00
2018-12-07 07:09:05 +01:00
2018-12-06 00:30:33 +01:00
2018-12-06 00:30:33 +01:00
2018-11-30 16:31:35 +01:00
2018-12-05 21:17:02 +01:00
2018-12-02 16:32:53 +01:00
2018-12-06 00:30:33 +01:00
2018-12-06 00:30:33 +01:00
2018-12-06 00:30:33 +01:00
2018-12-05 18:19:30 +01:00
2018-12-06 00:30:33 +01:00
2018-12-06 00:30:33 +01:00
2018-12-06 00:30:33 +01:00
2018-12-06 11:54:44 +01:00
2018-10-01 08:52:42 +02:00
2018-12-07 19:33:06 +01:00
2018-12-06 00:30:33 +01:00
2018-11-30 11:18:24 +01:00
2018-12-06 00:30:33 +01:00
2018-12-06 00:30:33 +01:00
2018-12-06 00:30:33 +01:00
2018-11-27 15:44:09 +01:00
2018-12-06 00:30:33 +01:00
2018-12-06 00:30:33 +01:00
2018-12-06 00:30:33 +01:00
2018-10-01 08:52:42 +02:00
2018-11-30 21:28:35 +01:00
2018-12-07 11:06:38 +01:00
2018-10-02 07:32:03 +02:00
2018-10-21 19:54:51 +02:00
2018-12-03 11:13:06 +01:00
2018-10-30 21:23:44 +01:00
2018-10-01 08:52:42 +02:00
2018-10-01 08:52:42 +02:00
2018-10-03 06:28:08 +02:00
2018-10-01 08:52:42 +02:00
2018-10-01 08:52:42 +02:00
2018-10-01 08:52:42 +02:00
2018-12-02 15:51:04 +01:00
2018-10-01 08:52:42 +02:00
2018-10-01 08:52:42 +02:00
2018-10-02 11:03:09 +02:00
2018-10-01 08:52:42 +02:00
2018-10-01 08:52:42 +02:00
2018-10-28 23:03:27 +01:00
2018-10-02 10:23:37 +02:00
2018-10-01 08:52:42 +02:00
2018-10-01 08:52:42 +02:00
2018-10-17 23:09:05 +02:00
2018-10-01 08:52:42 +02:00
2018-12-05 05:42:27 -05:00
2018-10-01 08:52:42 +02:00
2018-11-21 23:31:08 -08:00
2018-11-30 08:45:40 -05:00
2018-10-01 08:52:42 +02:00
2018-10-01 08:52:42 +02:00
2018-10-01 08:52:42 +02:00
2018-10-01 08:52:42 +02:00
2018-10-28 13:57:44 +01:00
2018-10-01 08:52:42 +02:00
2018-10-01 08:52:42 +02:00
2018-10-01 08:52:42 +02:00
2018-12-01 19:27:21 +01:00
2018-10-01 08:52:42 +02:00
2018-09-18 14:59:39 +02:00
2018-10-02 11:03:09 +02:00
2018-10-25 23:15:20 +03:00
2018-12-06 11:54:44 +01:00
2018-10-31 09:10:28 +01:00
2018-10-01 08:52:42 +02:00
2018-10-01 08:52:42 +02:00
2018-11-04 17:22:03 +01:00
2018-10-02 11:03:09 +02:00
2018-10-01 08:52:42 +02:00
2018-10-29 15:50:44 +01:00
2018-11-14 09:40:43 -05:00
2018-11-08 18:49:00 +01:00
2018-10-01 08:52:42 +02:00
2018-12-05 07:03:27 -05:00
2018-11-30 14:00:26 -07:00
2018-10-24 18:59:52 +02:00