-
-
Notifications
You must be signed in to change notification settings - Fork 89
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
Device Power State & HomeKit Fall Out of Sync: TV Off, HomeKit: ON #546
Comments
You would need to try to reproduce your issue and observe the log if anything appears there whenever you expect the event to happen. That way you could at least check and confirm if the event from the tv arrives. |
I captured a recording of the updates, and shared my experience on the hombridge GitHub. One contributor suggested a change to this plugin's methods for updating HomeKit. homebridge/homebridge#3700 (comment) As I try to recreate the issue I found I'm not able to recreate the issue when observing it. It works until it's been left idle for several hours. Then I find automation fails. The link shared suggests changing how the plugin updates values. |
The plugin already calls updateValue on all relevant TV updates, and I am pretty sure that it was working fine as this was explicitly done many years ago for exactly the automation use cases. |
Oddly it works perfectly in rapid succession. If I'm turning the tv on and off within a few minutes. I find it fails when the tv is left off for hours. Our use case is built around our Apple TV and LG TV both using Wifi on 5Ghz on a strong channel. At night we have a shortcut that turns the TV on by waking the AppleTV and it launches an app. We have automation for the lights in the bedroom that check to see if the TV is on when motion is detected. If it is the lights don't turn on. I'd day this works 70% of the time. Tonight I am going to enable deep logging and debugging on homebridge to see if I can capture the event. Yesterday as I was watching the activity it all worked perfectly, except the macOS Home App at one point showed the TV on when it was actually off and it didn't update until I restarted the application. I didn't see any obvious issues in the log at that time. |
Yeah you need to investigate it further as there certainly could be other issues involved like dropping network connection. |
Wanted to quality connect this thread to the discussions on the Hombridge github, I've been working through testing collecting deep logs related to devices falling out of sync with the Home App. I captured an example of the Home app failing to reflect the current power state of the LG TV, and failing to respond to power on commands from the home app. homebridge/homebridge#3700 (comment) LMK if I can provide any additional detail. There is an error present in the log (-54) shared. |
Thanks, the -54 error should be fine. The tv sometimes responds with that maybe because it was busy. |
Thank you @merdok, last night the TV's status appeared to update closer to real time as light automation worked as expected. My efforts to log the activity failed, with logs getting truncated. Will try again this evening. I am curious however, why after this error the TV's status did not reflect accurately in the home app or why I was unable to turn the tv on via the home app. |
The error should not affect anything. It just tells that the last request failed but all should continue to work fine. |
Is it possible to force it to only use SSL?
|
Not possible currently, the plugin automatically determines if it is needed. |
The TV also exposes a TelevisionSpeaker characteristic hence you are seeing this. That should not affect anything. |
Thank you for that clarification. I'm still unpacking how HB and HomeKit interact. Controller for Homekit has some major logging gaps unfortunately and the HB Debug logs are a pain to sort through when mixed timestamps. I still continue to experience issues with the LG TV NOT updating HomeKit when it's Turned on via Automation. I have a nightly automaton that turns the TV on via the connected AppleTV, the AppleTV loads an App and the TV comes on, however the HomeKit App failed to register this state change, I have to manually go into the Home App with my iPhone and turn the TV on.
Today I noticed the TV disconnects after a period of time from wifi (I can't wire it). The TV powers on via the HDMI connection with the AppleTV. The wifi connection is restored and the plugin is able to communicate. However the Home app device state does not get updated. The wifi disconnect is functioning as designed. I'm wondering if this plugin could push a refresh to the Home app once it completes its reconnection steps. Performing come kind of check to ensure HB/HK = Current Device Status after connection could resolve this issue completely. In this example I don't see a status update until 8:07pm when I open the app and tap the device in the UI, the TV is already on, it just appears off in the app. 2024-10-30T06:07:06.902Z HAP-NodeJS:Accessory [Display A1E9] Got Characteristic "Active" value: "1" I'm also seeing references to "WebOS TV 151D" a device I do not see in HomeKit and I assume is a translation layer between HB Plugin and the HomeKit "Display" device I do see in home kit. They are the
LMK what other context I can provide. I have two LG plugins however the TV "Display" is only configured with this webOS TV plugin. |
On every connection already a full update is being done of the TV status to HomeKit. But that should not matter anyway in your case because you mention that the TV disconnects from wifi and reconnects again in a very short time where it would be unlikely that something has changed. |
In the example of log data I shared, I see the reconnect but I do not see the status update reflecting the TV as on until I trigger it via the Home App directly. not clear where that command gets lost, with the second "WebTV" reference in Ciao and Display reference on HAP. |
Provided additional log data on this thread from last night: homebridge/homebridge#3700 (comment) The plugin fails to update Home App status after power on via AppleTV (HDMI). |
Thanks for the additional log |
No problem. Let me know if I can look for any patterns on my expanded log data. |
Saw the NODE.js update come through. Thank you for that. I just realized my issues were likely related to this. Homebridge alerts an update without providing much insight into Node.js dependencies. Noticed things improved when I rollback to 18 for this plugin. Thanks for the update. |
Yeah sometimes node.js might also cause issues. Good to hear that things improved on your side after a downgrade. |
Quick update. Rolled back Node, finding 18.20.4 is actually less stable for Home App device status. Is there a timeline for when this plugin will be remediated for latest HB version of Node? |
Not quite sure what you mean, this plugin supports the latest node.js version available for HB. |
Version 2.4.6 has added support for node.js v22 |
I'm running that version. I'll check again after I hear back from the developer on the LG Thinq plugin. |
Thanks for the update, i do not see anything unusual... |
I suspect the EDTIMEOUT event is occurring at moments when automation triggers fire. How can we make this more reliable for TVs? |
The timeout comes from the fact that the tv does not respond. I am not sure whether we can do something about it |
Is it possible to incorporate error handling here? The TV exists, it's' not moving IP or location, it's simply the nature of wifi I assume. Seems like the software could retry in a way that ensures Home has the actual state of the device. It's odd how a few seconds before I see "Connected" messages then the failure. Then "Connected." Generally these are around automation triggered events, Home is asking to know and the connection fails. Could logic be incorporated to not respond to Home until a connection is successful as a possible example of error handling? I'm flagging this with HomeBridge and Node as well, since the 22.12 I'm noticing odd behavior with this and the Samsung plugin as well. IDK if Node is the cause. |
Possibly, that would need to be investigated... |
Still working on collecting meaning full log data around events. I'm looking at two days of debug data that includes HAP-Node.js messages and I'm seeing a pattern. Repetitive, frequent updates of the same information by this plugin. In observing this plugin, it seems like it is over sampling the status of the TV, perhaps overwhelming homebridge and HomeKit with repetitive messages.
|
The firmware version is fetched after a connection has been established with the TV, the above log just means that the plugin lost connection to your TV and reconnects after some time. |
Thanks for that clarification. I assumed as much as I see a lot of TV meta data getting pushed a lot. It seems like a waste of energy for a static device like a TV. Given the instability of the pipe (Wifi) and its high failure rate it seems like you'd want to send the least to ensure a complete message is received. Perhaps this is not configurable. For awhile I associated this issue with the iPhone being locked and the home app not being on screen, as when doing so a device's status updates in near real time. When you can, could you point me to the code that manages the update frequency of TVs and how their status is synced with the Home App? For awhile I associated this issue with the iPhone being locked and the home app not being on screen, as when doing so a device's status updates in near real time. If there is a tell I can look for related to connection quality, let me know. I use a inSSIDer on my Mac to manually tune wifi to the least crowded channel and I have an overall wifi connection metric over 87% for the 52 devices on the network with a wired mesh network using Amplifi Alien wifi 6 routers. Devices are coded to a specific SSID ideal for their location and use case. Let me know if I can share any additional context to assist in the development of this solution . Thank you for working on this project. |
There is no update frequency, the updates are pushed from the tv whenever something changes there. You have to investigate your local network and check why your tv gets disconnected from the network so frequently. |
Thanks for the data, what does seem off for you? |
The volume of updates to Firmware version to home app is much higher than other commands. A lot of activity for a device that is used for 15-20 minute a day. Im trying to find why this tv falls out of sync with the home app so often. It's powered on via its hdmi connection when the Apple TV wakes. Idk if this method is not reported by the tv or acknowledged by the plugin. |
I mean you have to investigate why your tv disconnects so frequently, did you try to use a LAN connection to see if that results in an improvement? |
Ok, thanks for the update! Let me know when you find anything new. Happy holidays! |
Happy Holidays! |
It seems like HomeKit doesn't work well unless observed from my iPhone. If the iPhone is asleep it's hit or miss if Homekit Updates.
I have a LG TV configured with this plugin (2.4.5) and it works as expected when my iPhone is used to control it. However when the iPhone is asleep and I use the HomeApp from my iMac for example, it doesn't. Or if I want automation to trigger based on device state: If "TV ON" don't turn on lights. When this fails, I wake my phone and the device status MIGHT update. Sometimes I have to restart homebridge to get the status to reflect correctly in HomeKit.
Right now as I troubleshoot this issue, the Home app on my iMac shows the TV power is on. My iPhone how's it as Off, if I restart the home app on the iMac, the status is reflected correctly as off.
I am having issues with automation tied to device state, for example I don't want motion to turn on bedroom lights if the tv is on. This doesn't work 80% of the time.
Setup:
headless wired AppleTV as Home Hub - iOS 18.1 public beta installed (this issue predates this version).
Homebridge 1.8.4, UI 4.58.0
Node.js 20.17.0
Homebridge is running on M3 iMac. Does not sleep. iMac is Wired. TV is on 5Ghz Wifi within 8 feet of Wifi 6 AP with 100% signal strength.
Deep Log Sample:
`[9/23/2024, 8:59:47 AM] [homebridge-webos-tv] [Display] {
"returnValue": true,
"state": "Active",
"processing": "Prepare Active Standby",
"onOff": "off",
"reason": "hdmiCec"
}
[9/23/2024, 8:59:47 AM] [homebridge-webos-tv] [Display] TV power status changed, status: state: Active, processing: Prepare Active Standby,
[9/23/2024, 8:59:47 AM] [homebridge-webos-tv] [Display] Message from TV
[9/23/2024, 8:59:47 AM] [homebridge-webos-tv] [Display] {
type: 'utf8',
utf8Data: '{"type":"response","id":"67b10ee90007","payload":{"returnValue":true,"state":"Active Standby"}}'
}
[9/23/2024, 8:59:47 AM] [homebridge-webos-tv] [Display] {
"returnValue": true,
"state": "Active Standby"
}
[9/23/2024, 8:59:47 AM] [homebridge-webos-tv] [Display] TV power status changed, status: state: Active Standby,
[9/23/2024, 8:59:47 AM] [homebridge-webos-tv] [Display] Pixel refresher started!
[9/23/2024, 8:59:47 AM] [homebridge-webos-tv] [Display] Message from TV
[9/23/2024, 8:59:47 AM] [homebridge-webos-tv] [Display] {
type: 'utf8',
utf8Data: '{"type":"response","id":"67b10ee90009","payload":{"subscribed":true,"returnValue":true,"appId":"","processId":"","windowId":""}}'
}
[9/23/2024, 8:59:47 AM] [homebridge-webos-tv] [Display] {
"subscribed": true,
"returnValue": true,
"appId": "",
"processId": "",
"windowId": ""
}
[9/23/2024, 8:59:47 AM] [homebridge-webos-tv] [Display] Message from TV
[9/23/2024, 8:59:47 AM] [homebridge-webos-tv] [Display] {
type: 'utf8',
utf8Data: '{"type":"response","id":"67b10ee9000d","payload":{"returnValue":true,"category":"picture","settings":{"contrast":"100","brightness":"50","color":"60","backlight":"100"}}}'
}
[9/23/2024, 8:59:47 AM] [homebridge-webos-tv] [Display] {
"returnValue": true,
"category": "picture",
"settings": {
"contrast": "100",
"brightness": "50",
"color": "60",
"backlight": "100"
}
}
[9/23/2024, 8:59:47 AM] [homebridge-webos-tv] [Display] Picture settings changed. Current picture settings: {"brightness":50,"backlight":100,"contrast":100,"color":60}`
TV doesn't show "power state change" message.
Device Config:
{ "devices": [ { "name": "Display", "ip": "Static", "mac": "xxx", "broadcastAdr": "static", "pollingInterval": 90, "deepDebugLog": true, "silentLog": true, "hideTvService": false, "volumeLimit": 100, "volumeControl": "none", "channelControl": false } ], "_bridge": { "username": "xxx" }, "platform": "webostv" },
LMK if I can provide any additional context.
The text was updated successfully, but these errors were encountered: