tavicu / homebridge-samsung-tizen

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

Problem with Samsung QN900A #383

Closed llKoull closed 2 years ago

llKoull commented 3 years ago

Hi!

I've got a Samsung QN900A (QE75QN900ATXXC) and i paired it with my homebridge bridge but sometimes, when i check my home status, i see that the TV is ON. There is no one in my home, i have no automations and if i check the status with the Smartthings app it says that it's OFF.

If i go home the TV is OFF and if try to turn on the TV with Siri it says that it's already ON. I have to take the remote, turn it ON and then turn it OFF using the Home app. Then, the status is correct for some hours until it says that the TV is ON again :S

Any idea if it can be some kind of misconfiguration or if it's a problem with the TV?

I know that this is not a regular TV model and if you need that i check something in the TV's API or the menus or something, just tell me 😉

Thanks for all your work!

Best regards!

tavicu commented 3 years ago

Hi, sorry for the late response.

The plugin checks if the TV is on by sending a ping command and then if the TV responds it checks the PowerState from the api (which i'm sure your TV supports it).

Is this happening only when you are outside your network?

I'm asking this because from my opinion HomeKit is kind of ... trash when it comes to automations and real status of devices. :)

llKoull commented 3 years ago

Hi @tavicu!

Thanks for your answer! Yes, my tv has the PowerState element in the API response but i don’t know if i have to activate any special thing in the plugin’s settings because of that.

And it happens when i’m also at home and no automation should be made. Sometimes the tv gets on by itself or sometimes it’s off but the homekit’s app is reporting that it’s on (the smartthings app, for example, reports that it’s off correctly).

tavicu commented 3 years ago

The plugin checks at pairing if the device is supporting powerstate and saves it in a config file.

The path for the file is like this: ~/.homebridge/accessories/samsung-tizen.json Or where your homebridge instance is saved.

You could check if powerstate have set true value

llKoull commented 3 years ago

Hi @tavicu!

I cannot see this information in the json file.

I attach a screenshot with the information that it contains and my plugin's configuration.

Thanks!

Captura de pantalla 2021-08-05 a las 10 18 55 Captura de pantalla 2021-08-05 a las 10 19 00 Captura de pantalla 2021-08-05 a las 10 18 34
llKoull commented 3 years ago

Hi @tavicu!

I'm going to copy my full config:

"platforms": [ { "name": "Config", "port": 80, "auth": "form", "theme": "auto", "tempUnits": "c", "lang": "auto", "platform": "config" }, { "devices": [ { "name": "Samsung TV", "ip": "192.168.1.2", "mac": "BC:7E:8B:AB:A3:32", "uuid": "QN990", "options": [ "Frame.RealPowerMode" ], "inputs": [ { "type": "app", "name": "Netflix", "value": "3201907018807" }, { "type": "app", "name": "YouTube", "value": "111299001912" }, { "type": "app", "name": "Prime Video", "value": "3201910019365" }, { "type": "app", "name": "Disney+", "value": "3201901017640" }, { "type": "app", "name": "Apple TV", "value": "3201807016597" }, { "type": "app", "name": "Apple Music", "value": "3201908019041" }, { "type": "app", "name": "Spotify", "value": "3201606009684" }, { "type": "app", "name": "Gallery", "value": "3201710015037" }, { "type": "app", "name": "Internet", "value": "3201907018784" }, { "type": "app", "name": "SmartThings", "value": "3201910019378" } ], "keys": { "INFORMATION": "KEY_HOME" } } ], "platform": "SamsungTizen" } ]

I don't know if it can help you 😉

Thanks!!!

tavicu commented 3 years ago

The last picture with samsung-tizen.json is the right file. Strange that none of the settings are saved, only the token. That's why the plugin never checks the powerstate.

Turn on your TV and then restart the homebridge server. The settings are updated at every reboot of the server and only if the TV is on.

After that check the json file and see if it changed.

llKoull commented 3 years ago

Hi @tavicu!

Thanks for your answer, I did these steps and it didn't change. Just to be sure that i'm doing it correctly i make a video of all the process. This is the link: https://ydray.com/get/l/EZ16281638246168/BPonL7ardx4

Thanks!!

llKoull commented 3 years ago

Hi @tavicu!

Any new on this? Shall i do any other test? Just tell me if you need something.

Thanks! ;)

tavicu commented 3 years ago

Hi @llKoull,

Sorry for the delay. It's a very busy period at my work and can't do anything extra.

Your problem is that the plugin don't check for PowerState because it's not saved in the json.

Since no other option is saved in json (only token) I think the problem is that the plugin can't access /api/v2/ info or is taking too much for your TV to respond to the api.

I have a few ideas in mind to improve how the settings are saved. But until i have some time to do it i won't be able to help you unfortunately.

I will keep this issue open and i will tag you when the improvements i'm making are released.

llKoull commented 3 years ago

Thanks for your effort @tavicu!

I'll be attentive to test your ideas when you do a new release 😉

tavicu commented 3 years ago

In my previous debugs and with the newer versions of TV I've seen a lot of people having this problem of not saving the settings in config.

I planned a long time ago to make the changes but unfortunately i didn't had time for anything because of my work and some problems on personal plan :).

llKoull commented 3 years ago

No problem @tavicu!

But it's not possible to add those settings manually. I saw the config file and it's just a simple json file. Can i try to add manually the settings that are not being stored?

I don't know the Key/values that i have to add, but if you tell me them, i can do the test 😉

Thanks!

tavicu commented 3 years ago

Ofc you could add them :). Let's try. Here is an example of json: {"bbdf32a6-4e6f-4f24-b7db-e8bf92fac228":{"frametv":false,"tokenauth":true,"powerstate":true,"token":"46209793"}}

Replace the UUID and the token with what you already have. Of just add the "frametv":false,"tokenauth":true,"powerstate":true to your current json

llKoull commented 3 years ago

Thanks @tavicu! I just added this configuration. Let's see if it fixes the issue ;)

seansweda commented 3 years ago

FWIW, I have a Q60A and it exhibits similar behavior. I've observed situations where homekit's power status is inconsistent with the actual TV's power status. I've also intermittently run into situations where the state is consistent (homekit/off, TV/off) but it is not possible to actually power up the TV using homekit (homekit switch briefly goes on, TV fails to power on, then switch returns to off state).

I can confirm that my samsung-tizen.json file only has the token. When I use curl to pull api/v2/ I see it return "PowerState" in the json. I've tried manually adding "powerstate" to the local config file but it did not seem to improve anything.

tavicu commented 2 years ago

Ok. So the main problem was because of ... me :)

Last time when i made some big changes i forgot to change a function that checks if TV is online before fetching informations. So every time the plugin was trying to get the settings the function will exit because it will see TV as offline.

I fixed it and also made some improvements that every time the request is made to update the settings on the storage file. Until now they were saved only on the first fetch.

The changes are pushed in the main branch but i did not released a new version yet. I still have some things to do and i will release it this week.

llKoull commented 2 years ago

Oooh cool!

Thanks for your support @tavicu ! Now i have my hombridge disconnected because it was failing a lot but i’m going to configure it again to test this update once you elease it! ˆ_ˆ

tavicu commented 2 years ago

v5.1.0 released

tzclucian commented 2 years ago

@tavicu I still get this issue.

Running 5.1.0. The TV powers on for couple of seconds then in homekit the TV icon immediately shows it's off altough the TV is on.

I've tried starting from scratch and even updating the accessories config file by myself but this keeps happening.

Any hints?

PS: My api info includes a powerstate: on field. Model: QE75Q80TATXXH

I also get this logs when restarting Homebridge

Starting to advertise 'Homebridge E0FC 869C' using bonjour-hap backend!
[10/6/2021, 1:05:43 PM] Homebridge v1.3.4 (Homebridge E0FC) is running on port 51449.
Preparing Advertiser for 'TV 9D48' using bonjour-hap backend!
Starting to advertise 'TV 9D48' using bonjour-hap backend!
[10/6/2021, 1:05:43 PM] TV 9D48 is running on port 56244.
[10/6/2021, 1:05:43 PM] Please add [TV 9D48] manually in Home app. Setup Code: 936-45-292
[10/6/2021, 1:06:15 PM] [TV] TV is offline
llKoull commented 2 years ago

I have not tried it on my TV yet. I was thinking of trying it this weekend.

tavicu commented 2 years ago

@tzclucian The problem you are having it's not related to this issue that was fixed here. So please create another issue.

But the plugin checks first if the TV responds to ping and after that if TV supports PowerState field then it makes a request and check that field.

So your problem may be because your TV is not responding to ping or the http request or it takes very long and it gets cancelled.

But start another issue and will se there

tzclucian commented 2 years ago

@tavicu thank you for your reply. I've created #417

llKoull commented 2 years ago

Hi @tavicu !

i want to inform you that i installed the last version in my hombridge and now it is working perfectly! The issues have gone, the status in homekit is always correct and the TV is not turning on alone 😄

Thanks for all your work!