SteidlD / homebridge-inkbird-bt-thsensor

A homebridge-plugin for the Inkbird bluetooth temperature and humidity sensors.
GNU General Public License v3.0
8 stars 2 forks source link

Error recovery improvement suggestions #26

Open FrugalCoder opened 1 year ago

FrugalCoder commented 1 year ago

I can instantiate a single nearby T/H sensor with no error, thanks. When I add a second Temp only sensor (IBS-TH2), "Slowing homebridge down #19" seems to occur. Same if I specify a T/H sensor with bad address or unreachable.

SteidlD commented 1 year ago

Hi @FrugalCoder,

actually I got a configuration with 3 sensors (1 with internal and external) running here and I also sometimes see these messages, but it works anyway here. But sometimes it's a bit slow to update the values. My suspect is not the fact having more sensors, but a mechanism I programmed giving back the last cyclically read value with the first read request and on a second read request getting the really actual value per BLE (which takes some time leading in my opinion to the warning). The idea behind this was to rapidly have a value (that might be a few minutes old), but when you force an update on your app (by pulling the screen down) you get a really fresh value. This seems to not work correctly - or maybe it works with one sensor but not with more sensor. I will think about a better way...

Since the newer version of Hoobs with the possibility to easily run several instances of homebrige, the "slowing down" doesn't really have any impact on other plugins if you run them in different instances. So this could be a work around for the time being

FrugalCoder commented 1 year ago

Some clarifications on the... Homebridge warnings/errors

Config: Homebridge on Raspberry Pi 4, 60 Insteon devices, a Big Ass Fan (Haiku L), a Nest Doorbell, 7 Nest Protects, Pushover service, and 5 BLE Sensors (on separate child bridges)

When HB starts up, or Apple Home requests an update, the code starts a scan of all BLE devices to find the match, then takes that found manufacturer data to feed back as temp/humidity. If that request is not satisfied (callback made) within 3 seconds, HB will complain so that's what the warning/error messages mean. The scan is also performed at the configured update interval, but HB won't be waiting for a request to be updated in that case, so no warnings/errors spewed. On my system, the startup period shows repeated errors and several cycles of 'not found' but seems to settle out after several timed update cycles (I've got a 15-minute refresh). Making Apple Home ask for an update will intermittently work or cause HB to do the error/warning spew and then complain about no response from the device.

Also 1) Inkbird used to offer two IBS-TH2 models, one temp only, one temp and humidity (I have both models) but didn't differentiate them. They're now instead offering IBS-TH2-Hygrometer (humidity and temp) and IBS-TH2-Temperature (temp only). Will request a pull and build a branch when I have cycles to spare.

<snip - cleaned up message>