Commit Graph

9 Commits

Author SHA1 Message Date
Darell Tan
b1949c73fd Handle unknown device types
For devices that we have no idea how to handle, i.e. no services or
expose entries were processed, we return ErrUnknownDeviceType and skip
it during AddDevicesFromJSON(). This prevents a device from showing up
where HomeKit says it's not supported.
2023-08-04 23:49:51 +08:00
Darell Tan
ba9a42b64e Added quiet mode for reduced verbosity
This is useful to reduce clutter if you're running the service and it's
writing logs to the main syslog.
2023-08-04 00:56:30 +08:00
Darell Tan
59b049faea Add config options for ListenAddr & Interfaces
These options are helpful when the bridge is running on a multi-homed
device like a wireless router.
2023-08-03 23:28:52 +08:00
Darell Tan
3cfc3f68b0 Added debug mode for more verbose logging
Also had to rename the existing DEBUG consts to DEVMODE, so as to not
confuse the two. DEVMODE is meant for developers and cannot be enabled
on-the-fly, whereas debug mode is for users to check that the bridge is
working, MQTT messages are received etc.

Update logging is throttled to avoid spurious messages for uncoalesced
MQTT updates and motion sensors. On my network with 10 devices, an
update is logged every 1-2 minutes on average.
2023-08-03 21:32:14 +08:00
Darell Tan
54aa0795c3 Fix for unacknowledged numeric Z2M state updates
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.
2023-06-25 02:34:34 +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
84398fc53a "Initial" working version, after cleanup. 2023-04-26 23:20:07 +08:00