Commit Graph

7 Commits

Author SHA1 Message Date
Darell Tan
7fbbec79d9 Add support for motion sensors
There doesn't seem to be any distinction in Z2M between occupancy and
motion sensors, but HomeKit has separate types. Most of the sensors are
PIR, so they are technically motion sensors instead of occupancy
sensors. There are of course _real_ occupancy sensors like mmWave, but
we'll deal with those when we get there.
2023-06-16 23:08:09 +08:00
Darell Tan
ca0b667ea1 Z2M JSON exposes.values could be of numeric type
encoding/json would refuse to implicitly cast the numbers into strings.
Currently we don't use these values, so let's preserve their type using
`any` for now.

An example is `keep_time` for occupancy sensors, where it's
[30, 60, 120] seconds.
2023-06-16 22:47:12 +08:00
Darell Tan
48eabc2342 Mark old last_seen devices as "not responding"
Devices that have not received an update since a fixed timeout (24 hrs
for now), based on its last_seen time, will be marked as "not
responding" in the Home app. With this I can identify which devices are
unreachable or dead.

Also needed to upgrade hap with the fix for brutella/hap#30, or the
entire bridge will stop working.
2023-05-22 22:38:20 +08:00
Darell Tan
edade53b06 Record & persist device last_seen time
This will allow us to mark devices as non-responsive if they haven't
been seen in some time.
2023-05-21 02:20:37 +08:00
Darell Tan
e44f33aa29 Don't persist Z2M state with "zero" values
When storing Z2M state, skip properties with default "zero" values. This
should skip devices and properties that were not updated via MQTT yet.
2023-05-14 02:09:17 +08:00
Darell Tan
5c47a410cf Added test for FsStore values clobbering
It was fixed upstream during a rewrite on functions in FsStore.
See my comments on brutella/hap#28.
2023-04-27 02:14:53 +08:00
Darell Tan
84398fc53a "Initial" working version, after cleanup. 2023-04-26 23:20:07 +08:00