-
-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HomeKit & LG ThinQ App & Device Out of Sync #287
Comments
Quick update, I continue to find that HomeKit falls out of sync with Device. I have adjusted the "ping" value to 30 seconds from 600 to further troubleshoot the issue. Testing this morning found HomeKit reported the device as on when it was off . This breaks automation triggered by AC status and keeps temperature triggers from firing as they see the state of the device incorrectly. please let me know what info I can share here to help narrow this issue down. It's unclear if it's a breakdown between HomeKit, homebridge, or LG server. |
I'm troubleshooting this issue today and noticed this value come across in the debug log: airState.energy.onCurrent":1030 This occurred after I power cycled the AC using the LG app as I was trying to determine possible causes for HomeKit falling out of sink. Is this value used by the plug in to report device status? [4/16/2024, 10:27:34 AM] [homebridge-lg-thinq] [Air Conditioner] Received snapshot: {"airState.windStrength":6,"airState.bellSound.control":1,"fwUpgradeInfo":{"upgSched":{"upgUtc":"0","cmd":"none"}},"static":{"deviceType":"401","countryCode":"US"},"airState.tempState.current":26,"airState.diagCode":0,"airState.lightingState.displayControl":1,"airState.wDir.hStep":0,"mid":72394897,"airState.energy.onCurrent":1030,"airState.reservation.sleepTime":0,"airState.quality.sensorMon":0,"airState.tempState.target":16,"airState.DR.northAmerica":0,"airState.operation":1,"airState.reservation.targetTimeToStart":0,"meta":{"allDeviceInfoUpdate":false,"messageId":"oen04ZnQT3iKQdrDaVagIw"},"online":true,"airState.opMode":0,"airState.reservation.targetTimeToStop":0,"airState.filterMngStates.maxTime":250,"airState.filterMngStates.useTime":125,"timestamp":1713299232435} |
no, plugin only use when AC fall of sync, any |
For some reason the homebridge log gets truncated, I can't see overnight activity. I've pasted some log samples below. I cleared homebridge device cache this morning in an effort to troubleshoot this issue. Now I don't have the ability to configure automation off of device status. The AC fell off the "An Accessory is Controlled" list. Previously I could trigger other automation based on when the AC powered on/off. Unclear how to restore this. It seems like the UI isn't aligned with the config. For example I don't have the "fan controls" option checked, but the fan controls appear in Home Kit. This model of AC does not have an oscillate function, but it appears in the device details UI in HomeKit. The Plugin is configured to "Cool Only" yet the HomeKit UI shows heating as an option. It's difficult to tell if the homebridge sees the device accurately. Here's what I see when I manually power the AC on with HomeKit:
What I see when I manually power off the AC using HomeKit:
Let me know what else I can try/provided... I may need to move over to IR control and drop LG's server. |
I've gone through the log and identified the Status change events and some examples of Errors returned... lmk if I can provide any additional log data. `Examples of State Change: [4/18/2024, 9:06:30 PM] [homebridge-lg-thinq] Set power on = 0 - current status = true [4/18/2024, 9:16:27 PM] [homebridge-lg-thinq] Set power on = 1 - current status = false [4/18/2024, 10:11:12 PM] [homebridge-lg-thinq] Set power on = 1 - current status = true Error Event: [4/18/2024, 10:01:15 PM] [homebridge-lg-thinq] Set power on = 0 - current status = true [4/19/2024, 6:30:12 AM] [homebridge-lg-thinq] Set power on = 0 - current status = true |
Continuing to troubleshoot. I've just uninstalled the plugin 1.8.4 and reinstalled it. Here's the message I received when the plugin boots:
|
this error mean LG server cannot connect to AC, AC maybe disconnected at this time
hmm, too many request in a short time, I don't know if LG can serve it thought you should try IR controller to local control AC, maybe it's better in your case |
This was me sampling log data. Can logic be added to this plugin to verify device status after a period of time after state change? Can you clarify the logic the plug in uses to assess the status of the device? what is the equation for Set Power On ? How does this plug in handle errors? Does it use the "response messages" to verify actions were completed? I could move back to IR, but knowing the state of the ac is important. Is there a reason why I can no longer use device state to trigger automation? It was there before I uninstalled and reinstalled the plugin. |
when state changed, plugin receive a mqtt message from LG, for some reason if mqtt not work, plugin will interval request to LG server to get a new state (that is
based on error code responsed from LG, I have a ton of error code and I can't understand all of them
try rollback to older version, I don't have AC there so I can't make sure everything worked perfectly |
Thank you for that clarification. I just nuked HomeKit, using the Apple profile to delete the database and spent the day rebuilding it. what can I provide to assist in resolving? I've reviewed the debug log and it's unclear to me why Homekit continues to fall out of sync. Is there a log I should review to see how Homebridge is interacting with HomeKit and this Plugin? |
I'm seeing a pattern. The plugin seems to fall out of sync between 12 am and 2 am HST. Oddly I can't see the log data from this period. Not sure why, but Homebridge logs get truncated and I don't see any activity until 3:00 am. I see this message, not sure what is causing the cut off in log data.
|
Continuing to track this issue. Overnight plugin fell out of sync 3 times. Each time I downloaded the log and it appears the issue occurs when the plug in re-auths with the server? HomeKit shows the device is on. It's not. here around 1:20 am, I noticed the AC was off, homekit shows it as on:
and again here:
it's unclear where the breakdown is here. The log shows the AC is ON. Oddly the log never shows the AC turning off, which I know it did. |
maybe you right
|
I've migrated to Broadlink RM to control the AC until this plugin becomes more stable for Air Conditioners and my use case. This approach is still my preferred method given the two-way communication, however it seems like its prone communication errors between LG, Homebridge, and Homekit which break my automation. To summarize, I use HomeKit automation to turn the ac on and off based on a Hue Motion sensor's temperature reading. This allows me to zone cool my apartment and save money. Thank you for building this plugin. Please let me know if I can provide any data to assist in refining its design. |
Rolled back to 1.8.3, after noting 1.8.4 was incorrectly showing the AC as on when it was off. It would keep reverting back to on even after power cycling the AC. Prior to Roll back this was the log:
after roll back:
the config file's "refresh interval" is set to 600, however the plug in seems to still ping more frequently than expected. I do not have thinkV1 enabled. |
Some observations from troubleshooting:
Questions; can additional logic be added to account for these MQTT messages that are triggered by the Device? Could for example this message:
Trigger the plugin to do a full query of the device state with the LG server? Homekit only reflects the AC as on AFTER I launch the LG app on my phone:
|
Continuing to troubleshoot and observe behavior of this plugin with LG AC. I am using broadlink Mini 3 to turn the AC on and OFF and I'm seeing status messages from the LG server that are not getting posted to HomeKit on all devices correctly. Mac Book shows on, iPad shows off. Restarting Home app resolves. Timing unclear. |
This appears to be an issue with LG's API server. Controls are passed through their AWS service and that service has issues resulting in delays and incomplete messages. I've shared my experience with LG as it affects their own app, with the device showing on long after it's been turned off. I have to rely on IR using Broadlink RM4 to control the AC instead. |
I've continued to track this issue, as it's a high impact on our daily lives and actually affects our power bill. Recently I spent a few hours recording the behavior and sharing my experience on the homebridge GitHub. I received the following feedback: homebridge/homebridge#3700 (comment) It suggest that some plugins may not be using the ideal method for updating HomeKit status. This could lead to the home app falling out of sync with the device's actual status. I have a screen recording that captures behavior between Homebridge, LG App, and the Home App. When left idle the home app shows the AC ON when it's actually off. To work around this issue I added additional logic to automation scripts to send and IR command, then check of the LG Plug in shows the device as on or off... if off send the On command via the LG plugin. It's improved the reliability, but there are still moments when the two fall out of sync. Perhaps this suggestion method change will resolve that issue. |
The plugin already calls updateValue and updateCharacteristic on every mqtt message received |
try pull test version |
Quick update, was able to capture full logs for overnight activity. Here are some notable events. I continue to see the app and device fall out of sync. With the Home app seeing the device as "on" when it's actually off. For context, over night I have two temp triggers that look a broadlink rm mini 4 to control the climate in our bedroom. When the automation is triggered it turns the AC on or off using IR, then it checks if the device actually turned on or off with an if statement that looks at the LG ThinQ Plugin Air Conditioner. If the device is off when it should be on it sends the "on" command using the ThinQ plugin an attempt to keep them in sync. This approach has improved reliability. I did notice the AC would appear "Off" when it was actually on at one point in the Home App. Generally when this happens the LG App itself will show the device status incorrectly as well. I'm wondering if the plugin should attempt a second time when it receives the "0111" error as it did here. An error with the plug-in overnight.
|
error |
I understand that a command can't be sent when the server returns an error, but can this plugin record the state of the device at the time of this error and set a clock to check again that it remains in sync after say, 2-3 minutes until the error clears? Given wifi is inherently unstable for most people it would be awesome of technology accounted for this instability by incorporating additional checks to over some communication gaps like this. Today it seems like the status just stays until the user tries again, ideally the software would attempt again when an error is received after a set period to ensure it's in sync. |
hmm, so strange if it's not sync because I have a backup method |
In my efforts to troubleshoot the issue I increased that to 1000 to reduce the number of pings to the LG server thinking it was getting flagged on their end and blocked. I reverted it back to 60 today, I'll see if it makes a difference over night. |
was able to capture a full debug log last night (10/11/2024) with examples of automation failures. |
hmm, I can't understand all of your automation |
Describe The Bug:
Device falls out of sync with software. Works 80% of the time. In this example the AC was off, HomeKit thought it was on, and the LQ App reports the correct status.
To Reproduce:
Create a HomeKit automation using a temperature sensor to trigger on/off action on AC.
One Trigger turns the AC on when the temp drops below 74 F, the other turns the AC off when the temperature rises above 75 F.
The AC is set to 60, its AC temperature sensors repositioned to "disable" it.
Expected behavior:
Consistently triggered actions. AC remains in sync with HomeKit.
Logs:
Pending - 4/6
Plugin Config:
{
"country": "US",
"language": "en-US",
"auth_mode": "token",
"refresh_token": "",
"username": "",
"password": "",
"devices": [
{
"id": "",
"name": "Air Conditioner",
"type": "AC",
"serial_number": "***",
"ac_mode": "COOLING",
"ac_fan_control": false,
"ac_temperature_unit": "F"
}
],
"thinq1": false,
"refresh_interval": 600,
"platform": "LGThinQ"
}
Screenshots:
Environment:
The text was updated successfully, but these errors were encountered: