kiwi-cam / homebridge-broadlink-rm

[This fork supports TV accessories] Broadlink RM Mini and Pro plugin for homebridge: https://github.com/nfarina/homebridge
Apache License 2.0
304 stars 95 forks source link

Temperature Trigger Automation broken with 4.18 and 4.5.0 Beta 0 #733

Open JasonGoldenDDT opened 1 month ago

JasonGoldenDDT commented 1 month ago

Describe the bug Temperature trigger based HomeKit automations fail unless iPhone is awake when using 4.18 and 4.5.0 beta 0. I have two home automation routines that control the climate in my bedroom. One turns off the AC when the broadlink RM Mini 4 temperature sensor registered below 73 degrees. When the temperature rises above 74 degrees it turns on the AC.

It looks like this when it works.
Screenshot 2024-09-24 at 8 38 45 AM

Yesterday I upgraded to 4.18 to see if the issue has been resolved by recent iOS, macOS, Homebridge, Node, etc. updates.

Last night again I found under 4.18 the temperature automation did not fire unless my iPhone was awake. I only use this automation at night, so I tried 4.5.0 beta 0 to see if the issue was resolved in newer versions of the software. You can see this in the chart from last night with the large spike in temp. I rolled back to 4.17 and automation returned to normal.

Since iOS 17.6 I've noticed some devices don't update reliably unless observed in the home app, and their status can fall out of sync between devices.

I have an headless Apple TV 4K wired, a turned wifi network with an 88% - 100% experience metric (Alien router x 2 wired backbone).

This issue pre-dates public beta software. Actually installed the beta to see if it would resolve these issues.

To Reproduce Steps to reproduce the behavior:

  1. Create temperature trigger automation that turns a device on when a temp a broadlink RM Mini 4 temp sensor reads temp below X.
  2. Lock iPhone and monitor.

Expected behavior Temp Automation responds in near real-time to temperature trigger events, without the iPhone awake.

Screenshots Screenshot 2024-09-24 at 8 44 04 AM Screenshot 2024-09-24 at 8 44 14 AM

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context LMK what additional information I can provide.

JasonGoldenDDT commented 1 month ago

Spent an hour with screen recordings of 4.4.18, 4.4.17 and 4.5.0. beta 2.

I ran through multiple test routines with temperature trigger automations and recorded the screens of Home, Homebridge logs, and LG AC App for reference.

It appears that the only thing that forces the automation to run is either manually testing the automation via the home app, or reloading the home app on the iPhone or other device.

I'm sharing this finding with Homebridge as well. I have trace debugging enabled.

The zip file is 4.16 gb in size with 3 screen recordings for each version of the plug in and the related logs exported. It would be too time consuming to strip these files of identifying information, but I'm willing to share them privately with the developer directly to support resolution of this issue.

Screenshot 2024-09-24 at 10 10 10 AM
JasonGoldenDDT commented 1 month ago

Okay, weird. Not sure what he issue is, but it appears HomeKit or Homebridge may have an update frequency I'm not able to see in the Homebridge Logs.

With all Home Apps closed, and just the web UI for Homebridge open I watched with version 4.5.0 beta 2 installed with both HAP and CIAO, the automation IS triggered but it overshoots by a degree on average... the above 85 gets triggered when HB reflects 86... the below 84 gets triggered when HB sees 83 or even 82...

I've adjusted the refresh rate for the temperature sensor to 100 ms and debug trace logging is enabled.

This may be an issue with HomeKit's refresh rate on the temperature data. I also noticed that automation data was out of sync, after restarting the hub (headless appletv wired) the automation was pointed to the wrong sensor. Ugh.

This may not be an issue after all, just a limitation with HomeKit.

JasonGoldenDDT commented 1 month ago

I received some feedback from the homebridge GitHub that clarified how HomeKit handles temperature values and updates.

https://github.com/homebridge/homebridge/issues/3700#issuecomment-2372582579

They suggest adjusting how this plugin handles updates. Currently the automation works but it over/under shoots the set temperature by a few degrees, likely due to conversions in F to C, but also in the method used to update HomeKit.

kiwi-cam commented 1 month ago

Thanks for doing all the research for me @JasonGoldenDDT. The latest beta will hopefully help with this. Let me know how it goes.

JasonGoldenDDT commented 1 month ago

Happy to do what I can to progress this work forward. It saves us money every month.

Screenshot 2024-09-25 at 7 56 39 AM

Last night was perfect using 4.5.0 Beta.2 with a 100ms on the temp sensor. LMK what other context I can provide. I did update my AppleTVs to 18.1 public beta (22J5552d). I've been providing apple with feedback on automation performance as well. HomePod sensors are useless for automation triggers in my case.

Screenshot 2024-09-25 at 8 03 22 AM Screenshot 2024-09-25 at 8 03 59 AM Screenshot 2024-09-25 at 8 04 07 AM

{ "name": "Broadlink Temperature", "type": "temperatureSensor", "disabled": false, "host": "xxx", "temperatureUpdateFrequency": 100, "logLevel": "warning" }, { "name": "Air Con RM", "type": "air-conditioner", "disabled": false, "host": "xxx", "units": "F", "temperatureUpdateFrequency": 60000, "ignoreTemperatureWhenOff": true, "defaultCoolTemperature": 15.5556, "sendTemperatureOnlyWhenOff": true, "minTemperature": 15.5556, "maxTemperature": 30, "replaceAutoMode": "cool", "minimumAutoOnOffDuration": 300, "turnOnWhenOff": true, "preventResendHex": true, "coolOnly": true, "noHumidity": true, "noHistory": true, "logLevel": "warning", "data": { "off": "26004800000121931336131213121212131213111312133613121336133613121312133613361312133613121212131213121311131213361312133613361337123713361336131213000d050000000000000000000000000000", "on": [ { "data": "26004800000121931336131213121212131213111312133613121336133613121312133613361312133613121212131213121311131213361312133613361337123713361336131213000d050000000000000000000000000000", "pause": 0.5 }, { "data": "2600480000011f951237121312121114111411131114113812131138123810141213123711391113113811391113113911381114101411391113111411381114111410391138121311000d050000000000000000000000000000" } ], "cool15.5556": { "pseudo-mode": "cool", "data": "260058000001209411371313111411141014121311141138121211391237111411131238113812131014113911131138111411141114113811381213113811141039113812371114110005700001244d12000c4a0001264b11000d050000000000000000000000000000", "sendCount": 2, "interval": 0.5 } } },

I did see this error messages soon after my shortcut ran. The shortcut turns on the AC and turns on and adjust fan speeds for two Dyson fans. The RM Mini 4, shown as a 'Pro' controls the AC, sending the "ON" message. Each Dyson Fan has its own RM Mini 3 attached to it.

[homebridge-broadlink-rm-pro] This plugin generated a warning from the characteristic 'On': Characteristic not in required or optional characteristic section for service Fanv2. Adding anyway.. See https://homebridge.io/w/JtMGR for more info. [9/24/2024, 8:00:06 PM] [homebridge-broadlink-rm-pro] This plugin generated a warning from the characteristic 'On': Characteristic not in required or optional characteristic section for service Fanv2. Adding anyway.. See https://homebridge.io/w/JtMGR for more info. [9/24/2024, 8:00:06 PM] [Broadlink RM] Daryl's Fan setSwitchState: already 1 (no data sent - B) [9/24/2024, 8:00:06 PM] [homebridge-broadlink-rm-pro] This plugin generated a warning from the characteristic 'On': Characteristic not in required or optional characteristic section for service Fanv2. Adding anyway.. See https://homebridge.io/w/JtMGR for more info. [9/24/2024, 8:00:06 PM] [homebridge-broadlink-rm-pro] This plugin generated a warning from the characteristic 'On': Characteristic not in required or optional characteristic section for service Fanv2. Adding anyway.. See https://homebridge.io/w/JtMGR for more info.

Here is a sample of the Dyson fan programming:

{ "name": "Daryl's Fan", "type": "fan", "host": "XXX", "logLevel": "warning", "defaultNowTemperature": 20, "alwaysResetToDefaults": false, "persistState": true, "resendHexAfterReload": false, "hideRotationDirection": false, "stepCycle": true, "allowResend": false, "data": { "on": "26004800421919181719172f192d191717191719171a19181818191818181817192d192c19000caf46171a171918192d172e181819171917191819181917191818181917182d182d18000d050000000000000000000000000000", "off": "26004800441818191818182e182e1818181818181819181918181818181918181718181818000cd8481918181819182e182e1818181718181819181918191818181818181818181718000d050000000000000000000000000000", "swingToggle": "26004800421918191719182e162f181818181817181a1719182e182e18181818182d182d18000d03471917191818182e172f17191817181818191819172e182e17191818182d172f17000d050000000000000000000000000000", "clockwise": "26004800411a171a1719172f172e1719171917181730171a1630162f1719172f172e172e17000cda481817191917192d192d181816191917182f1818192d192d1917192c192d182d19000d050000000000000000000000000000", "counterClockwise": "26002400441719181917192d192c1917191719161919192d19171917192d19161917192c19000d050000", "fanSpeed10": [ { "data": "26004800441819171918192c192d191719161917192e192d192d192d192d192c192c192d19000ca8461719171a17192c1a2c191719161a16192e192d192d192d192c1a2c192c192c1a000d050000000000000000000000000000", "sendCount": 10, "interval": 0.3 } ], "fanSpeed20": [ { "data": "26004800431819171918192c1a2c191719161a16192e192d192d192d192c1a2c1917191619000cd2481719171a17192c1a2c191719161a16192e192d192d192d192d192c1917191619000d050000000000000000000000000000", "sendCount": 10, "interval": 0.3, "pause": 0.2 }, { "data": "26004800421918191818182e182e181817181818171a182e1818182e1818182e172e182d18000cea49171a171917192d192d19161a1619171918192d19171a2c1917192d192c192c19000d050000000000000000000000000000" } ],

JasonGoldenDDT commented 1 month ago

Still monitoring this... last night experienced a glitch in temperature trigger...

Screenshot 2024-09-26 at 1 37 01 PM

Working through this issue in this thread:

https://github.com/homebridge/homebridge/issues/3700#issuecomment-2378080983

Because I'm noticing multiple plugins where home falls out of sync with the device. I'm running a detailed log. When testing it works as expected, but over night it has a tendency to fail. Planning to capture detailed trace and HAP logging tonight.

Also, noticed this error on version 4.5.0 beta.2: [9/26/2024, 1:00:33 PM] [homebridge-broadlink-rm-pro] This plugin generated a warning from the characteristic 'On': Characteristic not in required or optional characteristic section for service Fanv2. Adding anyway.. See https://homebridge.io/w/JtMGR for more info.

Not sure if this a configuration change I need to make or not.

JasonGoldenDDT commented 1 month ago

Wanted to share this latest debug log data with you:

https://github.com/homebridge/homebridge/issues/3700#issuecomment-2397656751

I'm still on 4.5.0-beta.2 and I updated Node.JS to 20.18 last week when homebridge flagged it.

I think the plug in is sending commands to close together? I have detailed log data I can share, I provided snippets in this thread around where I see temperature fluctuations overnight.

In reviewing the log it looks like the plugin is sending on and off commands to close together. LMK if I can provide more log detail.

JasonGoldenDDT commented 1 month ago

Added a full debug log from over night (10/11/2024). It appears this plugin might be sending duplicate signals, not sure.

https://github.com/homebridge/homebridge/issues/3700#issuecomment-2407946742

JasonGoldenDDT commented 4 weeks ago

Still trying to troubleshoot issues with AC falling out of sync with Home app. In reviewing recent log data, I'm wondering if I've configured the plugin correctly as I believe the plug in is sending hex codes multiple times?

I'm finding the Home App shows the AC as on when it's actually off. I have the LG ThinQ set up as a fall back.

Screenshot 2024-10-14 at 8 24 54 AM

Screenshot 2024-10-14 at 8 24 22 AM

I'm wondering if you have an example of using the Auto Features of this plugin, rather than creating an automation in the home App to keep the temp within a set range. The AC does not have a remote with a display

overnight detailed log data: homebridge 3.log.zip

Model Number: LW1217ERSM1.AT1AUSH

Screenshot 2024-10-14 at 8 27 54 AM

AC Config { "name": "Air Con RM", "type": "air-conditioner", "disabled": false, "host": "eb", "units": "F", "temperatureUpdateFrequency": 60000, "ignoreTemperatureWhenOff": true, "defaultCoolTemperature": 15.5556, "sendTemperatureOnlyWhenOff": true, "minTemperature": 15.5556, "maxTemperature": 30, "replaceAutoMode": "cool", "minimumAutoOnOffDuration": 300, "turnOnWhenOff": true, "preventResendHex": true, "coolOnly": true, "noHumidity": true, "noHistory": true, "logLevel": "trace", "data": { "off": "26004800000121931336131213121212131213111312133613121336133613121312133613361312133613121212131213121311131213361312133613361337123713361336131213000d050000000000000000000000000000", "on": [ { "data": "26004800000121931336131213121212131213111312133613121336133613121312133613361312133613121212131213121311131213361312133613361337123713361336131213000d050000000000000000000000000000", "pause": 0.5 }, { "data": "2600480000011f951237121312121114111411131114113812131138123810141213123711391113113811391113113911381114101411391113111411381114111410391138121311000d050000000000000000000000000000" } ], "cool15.5556": { "pseudo-mode": "cool", "data": "260058000001209411371313111411141014121311141138121211391237111411131238113812131014113911131138111411141114113811381213113811141039113812371114110005700001244d12000c4a0001264b11000d050000000000000000000000000000", "sendCount": 2, "interval": 0.5 } } },

Turning off:

[10/14/2024, 5:18:01 AM] [Broadlink RM] Air Con RM setTargetTemperature: 15.5556 [10/14/2024, 5:18:01 AM] [Broadlink RM] [DEBUG] Air Con RM Potential sendTemperature (15.5556) [10/14/2024, 5:18:01 AM] [Broadlink RM] [INFO] Air Con RM Configuration found for cool15.5556 with pseudo-mode. Pseudo-mode will replace the configured mode. [10/14/2024, 5:18:01 AM] [Broadlink RM] [DEBUG] (eb) Sending command:6a with payload: da0002000000260058000001209411371313111411141014121311141138121211391237111411131238113812131014113911131138111411141114113811381213113811141039113812371114110005700001244d12000c4a0001264b11000d050000000000000000000000000000 [10/14/2024, 5:18:01 AM] [Broadlink RM] Air Con RM sendHex (10.0.145.12; e8:16:56:06:df:eb) 260058000001209411371313111411141014121311141138121211391237111411131238113812131014113911131138111411141114113811381213113811141039113812371114110005700001244d12000c4a0001264b11000d050000000000000000000000000000 [10/14/2024, 5:18:01 AM] [Broadlink RM] Air Con RM getTargetTemperature: 15.5556 [10/14/2024, 5:18:01 AM] [Broadlink RM] Air Con RM setTargetHeatingCoolingState: 0 [10/14/2024, 5:18:01 AM] [Broadlink RM] [DEBUG] (e8:16:56:06:df:eb) Sending command:6a with payload: da000200000026004800000121931336131213121212131213111312133613121336133613121312133613361312133613121212131213121311131213361312133613361337123713361336131213000d050000000000000000000000000000 [10/14/2024, 5:18:01 AM] [Broadlink RM] Air Con RM sendHex (.12; :eb) 26004800000121931336131213121212131213111312133613121336133613121312133613361312133613121212131213121311131213361312133613361337123713361336131213000d050000000000000000000000000000 [10/14/2024, 5:18:01 AM] [Broadlink RM] Air Con RM sentTemperature (15.5556) [10/14/2024, 5:18:01 AM] [Broadlink RM] [DEBUG] (:eb) Payload received:0200000000000000000000000000 [10/14/2024, 5:18:01 AM] [Broadlink RM] Air Con RM setCurrentHeatingCoolingState: 2 [10/14/2024, 5:18:01 AM] [Broadlink RM] Air Con RM setCurrentHeatingCoolingState: already 2 (no data sent - B) [10/14/2024, 5:18:01 AM] [Broadlink RM] Air Con RM setCurrentHeatingCoolingState: 0 [10/14/2024, 5:18:01 AM] [Broadlink RM] [DEBUG] (eb) Payload received:0200000000000000000000000000

Turning On:

[10/14/2024, 5:04:40 AM] [Broadlink RM] [DEBUG] (eb) Sending command:6a with payload: 040024 [10/14/2024, 5:04:40 AM] [Broadlink RM] [DEBUG] Broadlink Temperature addTemperatureCallbackToQueue (requested temperature from device, waiting) [10/14/2024, 5:04:40 AM] [Broadlink RM] [DEBUG] (eb) Payload received:0a0024000000173e294e050000000000 [10/14/2024, 5:04:40 AM] [Broadlink RM] [DEBUG] Broadlink Temperature onTemperature (23.62) [10/14/2024, 5:04:40 AM] [Broadlink RM] [DEBUG] Broadlink Temperature onHumidity (41.78) [10/14/2024, 5:04:40 AM] [Broadlink RM] [DEBUG] Broadlink Temperature Logging data to history: temp: 23.62, humidity: 41.78 [10/14/2024, 5:04:40 AM] [Broadlink RM] **Fakegato-timer: addData Broadlink Temperature { time: 1728918280, temp: 23.62, humidity: 41.78 } immediate: false [10/14/2024, 5:04:41 AM] [Broadlink RM] Air Con RM setTargetHeatingCoolingState: 2 [10/14/2024, 5:04:41 AM] [Broadlink RM] Air Con RM sending "on" hex before sending temperature [10/14/2024, 5:04:41 AM] [Broadlink RM] [DEBUG] (eb) Sending command:6a with payload: da000200000026004800000121931336131213121212131213111312133613121336133613121312133613361312133613121212131213121311131213361312133613361337123713361336131213000d050000000000000000000000000000 [10/14/2024, 5:04:41 AM] [Broadlink RM] Air Con RM sendHex (2; eb) 26004800000121931336131213121212131213111312133613121336133613121312133613361312133613121212131213121311131213361312133613361337123713361336131213000d050000000000000000000000000000 [10/14/2024, 5:04:41 AM] [Broadlink RM] Air Con RM setTargetTemperature: 15.5556 [10/14/2024, 5:04:41 AM] [Broadlink RM] [DEBUG] Air Con RM Potential sendTemperature (15.5556) [10/14/2024, 5:04:41 AM] [Broadlink RM] [INFO] Air Con RM Configuration found for cool15.5556 with pseudo-mode. Pseudo-mode will replace the configured mode. [10/14/2024, 5:04:41 AM] [Broadlink RM] [DEBUG] (eb) Sending command:6a with payload: da0002000000260058000001209411371313111411141014121311141138121211391237111411131238113812131014113911131138111411141114113811381213113811141039113812371114110005700001244d12000c4a0001264b11000d050000000000000000000000000000 [10/14/2024, 5:04:41 AM] [Broadlink RM] Air Con RM sendHex (12; :eb) 260058000001209411371313111411141014121311141138121211391237111411131238113812131014113911131138111411141114113811381213113811141039113812371114110005700001244d12000c4a0001264b11000d050000000000000000000000000000 [10/14/2024, 5:04:41 AM] [Broadlink RM] Air Con RM getTargetTemperature: 15.5556 [10/14/2024, 5:04:41 AM] [Broadlink RM] Air Con RM sentTemperature (15.5556) [10/14/2024, 5:04:41 AM] [Broadlink RM] [DEBUG] (eb) Payload received:0200000000000000000000000000 [10/14/2024, 5:04:41 AM] [Broadlink RM] Air Con RM setCurrentHeatingCoolingState: 2 [10/14/2024, 5:04:41 AM] [Broadlink RM] Air Con RM getCurrentHeatingCoolingState: 2 [10/14/2024, 5:04:41 AM] [Broadlink RM] Air Con RM getTargetHeatingCoolingState: 2 [10/14/2024, 5:04:41 AM] [Broadlink RM] [DEBUG] (eb) Payload received:0200000000000000000000000000 [10/14/2024, 5:04:42 AM] [Broadlink RM] [DEBUG] (eb) Sending command:6a with payload: da00020000002600480000011f951237121312121114111411131114113812131138123810141213123711391113113811391113113911381114101411391113111411381114111410391138121311000d050000000000000000000000000000 [10/14/2024, 5:04:42 AM] [Broadlink RM] Air Con RM sendHex (12; eb) 2600480000011f951237121312121114111411131114113812131138123810141213123711391113113811391113113911381114101411391113111411381114111410391138121311000d050000000000000000000000000000 [10/14/2024, 5:04:42 AM] [Broadlink RM] [DEBUG] (eb) Payload received:0200000000000000000000000000 [10/14/2024, 5:05:19 AM] [Broadlink RM] [DEBUG] Sending keepalive to 17 : 80 [10/14/2024, 5:05:19 AM] [Broadlink RM] [DEBUG] Sending keepalive to 18 : 80 [10/14/2024, 5:05:19 AM] [Broadlink RM] [DEBUG] Sending keepalive to 10 : 80 [10/14/2024, 5:05:19 AM] [Broadlink RM] [DEBUG] Sending keepalive to .12 : 80 [10/14/2024, 5:05:49 AM] [Broadlink RM] [DEBUG] (eb) Sending command:6a with payload: 040024 [10/14/2024, 5:05:49 AM] [Broadlink RM] [DEBUG] Broadlink Temperature addTemperatureCallbackToQueue (requested temperature from device, waiting)