So far Z2M state updates were only boolean (the device `state` on/off),
but after introducing `brightness` values, Z2M state updates may not be
recognized/acknowledged. Unmarshalled Z2M numeric values are always
float64, but updates sent out via MQTT might not be. As a result, the
values may not directly equal and may never match.
To solve this, cast the outgoing expected value into a float64 to
compare against the received Z2M value, which is already a float64.
The exposes entry looks similar to a switch, except the type is a
"light" and it has `state` and `brightness`. Tested only on single
channel dimmers.
Also added a PercentageTranslator to translate between the HomeKit
`brightness`, which is a percentage, to/from an arbitrary numeric value
in Z2M.
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.
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.
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.