tavicu / homebridge-samsung-tizen

Homebridge plugin for Samsung TV's with Tizen OS
MIT License
647 stars 87 forks source link

TV switch keeps turning on and off #388

Closed franzmilec closed 3 years ago

franzmilec commented 3 years ago

While the TV is running, the main switch in the home app keeps turning on for 30 seconds and turning off for a brief moment.

franzmilec commented 3 years ago

This is the response of the TV when it's on:

{"device":{"FrameTVSupport":"false","GamePadSupport":"true","ImeSyncedSupport":"true","Language":"en_GB","OS":"Tizen","PowerState":"on","TokenAuthSupport":"true","VoiceSupport":"true","WallScreenRatio":"0","WallService":"false","countryCode":"CZ","description":"Samsung DTV RCR","developerIP":"0.0.0.0","developerMode":"0","duid":"uuid:cd0b82e0-e51f-45d0-b155-24ebff9a3f0b","firmwareVersion":"Unknown","id":"uuid:cd0b82e0-e51f-45d0-b155-24ebff9a3f0b","ip":"192.168.68.128","model":"20_NIKEM_SERO","modelName":"QE43LS05TCUXXH","name":"[TV] TV","networkType":"wireless","resolution":"3840x2160","smartHubAgreement":"true","ssid":"60:32:b1:1b:87:a3","type":"Samsung SmartTV","udn":"uuid:cd0b82e0-e51f-45d0-b155-24ebff9a3f0b","wifiMac":"8C:EA:48:EE:42:EC"},"id":"uuid:cd0b82e0-e51f-45d0-b155-24ebff9a3f0b","isSupport":"{\"DMP_DRM_PLAYREADY\":\"false\",\"DMP_DRM_WIDEVINE\":\"false\",\"DMP_available\":\"true\",\"EDEN_available\":\"true\",\"FrameTVSupport\":\"false\",\"ImeSyncedSupport\":\"true\",\"TokenAuthSupport\":\"true\",\"remote_available\":\"true\",\"remote_fourDirections\":\"true\",\"remote_touchPad\":\"true\",\"remote_voiceControl\":\"true\"}\n","name":"[TV] TV","remote":"1.0","type":"Samsung SmartTV","uri":"http://192.168.68.128:8001/api/v2/","version":"2.0.25"}

tavicu commented 3 years ago

Hi.

From what i can see your TV supports PowerState, so the only possible option is that sometimes your TV is not responding to ping.

To check if TV is on the plugin first ping it and if it's alive then it checks the PowerState value.

Try hard rebooting the TV by holding the power key on your remote until you see the Samsung logo

franzmilec commented 3 years ago

@tavicu I've done the hard reboot but the issue persists.

tavicu commented 3 years ago

Follow this topic please, https://github.com/tavicu/homebridge-samsung-tizen/issues/383

The improvements i want to make will probably fix your problem too.

PaoloCuscela commented 2 years ago

Hi @tavicu ,

I have the same issue, sometimes the TV api hangs to answer and the state of the switch goes off, when the api respond back it goes on again.

I've made a little tool that keeps calling the tv api and when there was that 5 seconds delay the tv switch went off

image

Thank you, I hope this would help you figure out how to solve this.

PaoloCuscela commented 2 years ago

I managed to solve this!

I saw the timeout device parameter in the base.js file and adjusted my config as this:

{
            "platform": "SamsungTizen",
            "app_list": true,
            "devices": [
                {
                    "name": "TV",
                    "ip": "192.168.178.61",
                    "mac": "64:07:F6:91:60:8D",
                    "refresh": 2000,
                    *"timeout": 10000,*
                    "inputs": [
                        {
                            "type": "app",
                            "name": "Netflix",
                            "value": "3201907018807"
                        },
                        {
                            "type": "app",
                            "name": "Disney+",
                            "value": "3201901017640"
                        },
                        {
                            "type": "app",
                            "name": "Prime Video",
                            "value": "3201910019365"
                        },
                        {
                            "type": "app",
                            "name": "YouTube",
                            "value": "111299001912"
                        },
                        {
                            "type": "app",
                            "name": "Apple TV",
                            "value": "3201807016597"
                        }
                    ],
                    "keys": {
                        "INFORMATION": "KEY_HOME"
                    }
                }
            ]
        }

Hope this will help someone

Deagan commented 2 years ago

I managed to solve this!

I saw the timeout device parameter in the base.js file and adjusted my config as this:

                "name": "TV",
                "ip": "192.168.178.61",
                "mac": "64:07:F6:91:60:8D",
                "refresh": 2000,
                *"timeout": 10000,*

Hope this will help someone

I am having the same issue. I have added the Delay and Timeout parameters to my config, but now it won't turn on properly. Was this solution still working for you, and can you explain what the Timeout parameter is supposed to do?

PaoloCuscela commented 2 years ago

From what I could understand it’s the time the plugin have to wait until the ping command fails,

so if the timeout is set to 1000ms, the ping command is sent and the tv does not respond until 1sec, the tv state is switched to off, increasing that value tells the plugin to wait longer before turning off the tv switch

the refresh value I think is the time between each ping commands so a lower value will make the tv state update faster

Now in my configuration I’m ok with these values:

                "refresh": 3000,
                "timeout": 5000,
tavicu commented 2 years ago

The timeout option is more for debugging! It should not be changed and especially to 5000!

if you need to change the timeout then it means somewhere is a problem! Your TV is responding very slow or is a problem with your server (until now who had the problem was because of the server, not the TV).

The TV should respond in ~250ms (ms not s)!

you could find other closed issues where we debugged and find out what responded slow! I’m from the mobile right now so it’s hard for me to search the issues.