Skip to content
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 (Apple Home App) - Automation - Samsung TV state #598

Closed
HeyWatchOutDude opened this issue Dec 26, 2022 · 6 comments
Closed

HomeKit (Apple Home App) - Automation - Samsung TV state #598

HeyWatchOutDude opened this issue Dec 26, 2022 · 6 comments

Comments

@HeyWatchOutDude
Copy link

Hi,

I'm using an automation on my HomePod Mini to turn the LEDs (Govee) on/off when the Samsung TV get turned on/off.

  • Turning on/off works great ... no issue there.

But now comes the strange part ... sometimes the LEDs are turning off for like 2-3 seconds and then back on even when TV is still on.

I found out how to determine the cause of that issue:

Option 1: When navigating through the TV (with remote control) the "state" never changes to "inactive" (obviously)

Option 2: I have turned off the automation for turning off the LEDs synchrone with my TV - Which also means that I have to turn off the LEDs manually.

It seems like the automation isn't using the "power state" of the TV.

Note:

  • Homebridge is up-to-date
  • Plugin is up-to-date
  • Samsung Tizen OS v5.x

Any idea how to solve that issue?

@jonnyborbs
Copy link

I have this exact same problem and it seems relatively recent. This automation was stable before, but now the Govee LEDs are constantly turning on and off, because the TV’s state is constantly fluctuating. But those fluctuations aren’t recorded in the Homebridge logs, like they are when the TV actually changes state.

@danyaero
Copy link

Hi! Im also experiencing this behaviour. It's true that I've always had it, but usually had a work around of using a dummy switch to allow the enough time for the TV to be back on and not trigger my lights and accessories accidentally. But since a few weeks ago, not even with the dummy switch im able to get things to work. In my case, even when the TV is off, there must be some packages being sent that makes homebridge think the TV is on and triggers my automations.
It happens the same as @HeyWatchOutDude, it triggers the automation and 2-3 seconds after it's turned off... very strange.
Im running the latest version of everything, and my home bridge server is setup on a Mac Mini connected via ethernet, and the TV automations are the only ones that are not behaving properly. Don't know @tavicu if there's a work around or a fix for this?

@tavicu
Copy link
Owner

tavicu commented Jan 15, 2023

Samsung don't offer us any valid option to check the real state of TV. So we make improvisations trying to get a state close to the real state of TV.

How we check if the TV is on.
First we ping the IP address, if the TV is awake then it will respond to ping. And we assume the TV is on.
But there is also a standby state of TV when it's actually off but it responds to ping. That's why if we get a ping from the TV, we also make a HTTP call to /api/v2/ which tells us if the TV is in standby or not.

That's great, but sometimes the TV don't respond to the HTTP request and it's failing, and if it does, as fallback the TV will have the state of the ping.
Why the HTTP request is failing? There are multiple reasons, slow network, older TV that respond slower or just a TV that had too much on his mind and it's responding very hard (just like a PC when you want to much from it and it starts lagging).

One scenario is that sometimes the TV wakes up to do stuff in the background even if it's OFF. If it wakes up then it will respond to ping, but at the beginning there may not respond to the HTTP request, and it will fallback to the ping status which is true(on), even if the TV is actually OFF..

The default timeout for the request is set to 250ms, that should be enough if there are no problems. The TV responds in approximate 5ms.
What you can do is to hard restart your TV. You can do this by holding the power button pressed until the TV restarts and Samsung logo appears.
You can also increase the timeout to 1000, that's 1 second. You can find how to do it here: #200 (comment)

If you want to have 100% working automations the only option with Samsung TVs are to buy a power plug which reports the power consumption in real time. Then you will be able to monitor the power consumption and see if the TV is actually ON :)

@HeyWatchOutDude
Copy link
Author

Thanks for your reply, I have already tested it with different timeout values, issue is still occurring.

As you mentioned I think I will get a "smart power adapter".

@jonnyborbs
Copy link

For me, adjusting that timeout to 1000 as advised has corrected the issue perfectly! There's a slight delay when actually turning the TV on now, which is acceptable. The Govee lights don't flap anymore and that's what counts. I'll experiment with tuning that timeout downwards to see if I can strike a better balance but this is fine as is if need be. Thanks for the tip.

@samwhu30
Copy link

samwhu30 commented Feb 2, 2023

Ah I was also going to report this. I will run the recommended steps and hopefully that will solve the issue 🤞

@tavicu tavicu closed this as completed Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants