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

Power Status Unexpectedly Changes #608

Open
dgonano opened this issue Jan 27, 2023 · 12 comments · May be fixed by #679
Open

Power Status Unexpectedly Changes #608

dgonano opened this issue Jan 27, 2023 · 12 comments · May be fixed by #679
Labels
awaiting feedback Awaiting information that was requested in the comments before any further action will be taken.

Comments

@dgonano
Copy link

dgonano commented Jan 27, 2023

The power status of my TV unexpectedly changes for a moment. Eg if TV is OFF it changes to ON for a second then OFF again, and vice versa if the TV is ON.

This triggers automations based on TV power. If you can tell me how to get you logs I'd be happy to get them for you.

edit: I see you have instructions for logs, let me get them, sorry I didn't read that first.

@dgonano
Copy link
Author

dgonano commented Jan 27, 2023

Log of my home bridge

 [37m[27/01/2023, 04:09:14] [0m  [36m[HB Supervisor] [0m Starting Homebridge with extra flags: -I -P /var/lib/homebridge/node_modules -D --strict-plugin-resolution
 [37m[27/01/2023, 04:09:14] [0m  [36m[HB Supervisor] [0m Started Homebridge v1.6.0 with PID: 23728
 [37m[27/01/2023, 04:09:15]  Loaded config.json with 0 accessories and 3 platforms.
 [37m[27/01/2023, 04:09:15]  Loaded 4 cached accessories from cachedAccessories.
 [37m[27/01/2023, 04:09:15]  ---
 [37m[27/01/2023, 04:09:15]  Loaded plugin: homebridge-zp@1.4.28
 [37m[27/01/2023, 04:09:15]  Registering platform 'homebridge-zp.ZP'
 [37m[27/01/2023, 04:09:15]  ---
 [37m[27/01/2023, 04:09:16]  Loaded plugin: @tritter/homebridge-samsung-tizen@5.2.5
 [37m[27/01/2023, 04:09:16]   Plugin '@tritter/homebridge-samsung-tizen' tried to register with an incorrect plugin identifier: 'homebridge-samsung-tizen'. Please report this to the developer! 
 [37m[27/01/2023, 04:09:16]  Registering platform '@tritter/homebridge-samsung-tizen.SamsungTizen'
 [37m[27/01/2023, 04:09:16]  ---
 [37m[27/01/2023, 04:09:16]  Loading 3 platforms...
 [37m[27/01/2023, 04:09:16]   [36m[SamsungTizen]  Initializing SamsungTizen platform...
 [37m[27/01/2023, 04:09:16]   Publishing bridge accessory (name: Homebridge 3A6A, publishInfo: { 
   username: '0E:27:27:75:3A:6A', 
   port: 51973, 
   pincode: '***-**-***', 
   category: 2, 
   bind: undefined, 
   mdns: undefined, 
   addIdentifyingMaterial: true, 
   advertiser: 'bonjour-hap' 
 }). 
Setup Payload:
X-HM://00243HGH30PWO
Enter this code with your HomeKit app on your iOS device to pair with Homebridge:
 [30m [47m                        [49m 
 [30m [47m    ┌────────────┐      [49m 
 [30m [47m    │ xxx-xx-xxx │      [49m 
 [30m [47m    └────────────┘      [49m 
 [30m [47m                        [49m 
 [37m[27/01/2023, 04:09:16]  Homebridge v1.6.0 (HAP v0.11.0) (Homebridge 3A6A) is running on port 51973.
 [37m[27/01/2023, 04:09:16]   [36m[Samsung TV]   [DEBUG] { 
   frametv: false, 
   tokenauth: true, 
   powerstate: true, 
   token: '35537953' 
 } 
 [37m[27/01/2023, 04:09:16]   Publishing external accessory (name: Samsung TV, publishInfo: { 
   username: '1C:52:D5:C8:02:A5', 
   pincode: '***-**-***', 
   category: 31, 
   port: undefined, 
   bind: undefined, 
   mdns: undefined, 
   addIdentifyingMaterial: true, 
   advertiser: 'bonjour-hap' 
 }). 
 [37m[27/01/2023, 04:09:16]  Samsung TV 5053 is running on port 41005.
 [37m[27/01/2023, 04:09:16]  Please add [Samsung TV 5053] manually in Home app. Setup Code: 378-79-975
 [37m[27/01/2023, 04:09:24]   [36m[Samsung TV]   [DEBUG] Device paired with success (token: 35537953) 

My issue looks very similar to #535, except that I seem to get consistent ping while the tv is on.

@tavicu
Copy link
Owner

tavicu commented Jan 27, 2023

Hi, please read this first

#598 (comment)

@dgonano
Copy link
Author

dgonano commented Jan 27, 2023

I had a look at that but my device seems to get consistent responses.
if I'm understanding the issue correctly (ping is okay, but https state fails to respond), is the http state tried multiple times? It seems like maybe its a mistake to just assume it's off?

@tavicu
Copy link
Owner

tavicu commented Mar 1, 2023

It seems like maybe its a mistake to just assume it's off?

It's not a mistake because the TV wakes over night in a sleep status to do background activities. Since it's on but in a sleep state it will respond to ping but it will not respond to the HTTP request.

Ignoring this flow and responding with the status of ping will result in switching ON the status when the TV is actually in the sleep state.

@tavicu tavicu added the awaiting feedback Awaiting information that was requested in the comments before any further action will be taken. label Mar 1, 2023
@dgonano
Copy link
Author

dgonano commented Mar 4, 2023

I'm not quite understanding your comment, lets check if we agree on this flow,

  1. TV is off during the night (no ping, no http)
  2. TV wakes in sleep state to do background activities (yes ping, no http)
  3. TV turns back off (no ping, no http)
    Do we agree that the TV status in HomeKit should remain off? If so, it seems like the ping state shouldn't be used?

One of my issues is that the TV status changes to ON temporarily during the day/night and activates an automation connected to TV power state.

@tavicu
Copy link
Owner

tavicu commented Mar 4, 2023

Correct. For what you described the TV should not respond to http request and the status should remain off.

But first please tell me what TV you have. Because the HTTP request is made only if the TV supports reporting PowerState, if the TV don't support it then only the ping will matter. From my knowledge TV's starting from 2019 are reporting the PowerState.

To check if it does you can access http://TV_IP:8001/api/v2/ and on that page you should have a key named PowerState. If you don't have it then the plugin checks only for the ping.

Screenshot 2023-03-04 at 19 12 43

I do have a good news but it will take some time to implement it.
This week I have tested an endpoint that Samsung TVs have and where they report the speaker volume and it can also be controlled :). But what does this endpoint do is that is reporting instant when the TV wakes or goes to sleep :). So using this new method we will be able to determine the state of the TV instant.

The bad news is that it will take some time to implement it because I am working on rewriting the plugin on a new structure with newer technologies. And this feature will be available with this new version (6.0.0) when will be ready. Also I don't know what is reporting on Frame TVs since I don't have one, but when I will be close to release I will buy one for testing.

I will create a discussion when it will be ready for testing and anyone will be able to install the beta version.

@CezaryCiosek
Copy link

CezaryCiosek commented May 9, 2023

Hi, @tavicu. Response from http://TV_IP:8001/api/v2/ return "PowerState" on or off but still Tv trigger HomeKit automatizations. Its super annoying because I have HomeKit automatizations related with tv and now lights are turning on/off for the whole night

@fadiallos
Copy link

Hi @tavicu I think I have the same issue as described on this thread, but my tv does not show powerstate TV ~2018... I guess I should wait for plugin version 6.0.0?
Are you working towards an ETA?

Otherwise loving the plugin, especially the apple remote control.

@tavicu
Copy link
Owner

tavicu commented Oct 7, 2023

Hi @tavicu I think I have the same issue as described on this thread, but my tv does not show powerstate TV ~2018... I guess I should wait for plugin version 6.0.0? Are you working towards an ETA?

Otherwise loving the plugin, especially the apple remote control.

Unfortunately I don't have an ETA because I am writing everything from the scratch using newer technologies.

Also have a newborn which takes almost all my time :)

But i'll do my best to finish ASAP since now I can use again my plugin. Almost a year ago I have migrated to Home Assistant and I don't like their integration with Samsung TVs. Now they released a new version that allows to add TVs from HomeKit to Home Assistant and I will be able to use this plugin :)

@Niklas31
Copy link

I recently bought a Samsung Freestyle Projector and tried to implement the feature. It only shows ON and OFF buttons on HomeKit (which is OK for me, since I only want light to turn on ir off depending on projector state), but it is 90% of the time on in HK. When I just turned off, it shows as off, but 30 minutes later it is back on. Looking this thread I think it has something to do with PowerState coming blank from the HTTP ping:

{"device":{"EdgeBlendingSupport":"true","FrameTVSupport":"false","GamePadSupport":"true","ImeSyncedSupport":"true","Language":"pt_BR","OS":"Tizen","PowerState":"","TokenAuthSupport":"true","VoiceSupport":"true","WallScreenRatio":"-1","WallService":"false","countryCode":"BR","description":"Samsung DTV RCR","developerIP":"0.0.0.0","developerMode":"0","duid":"uuid:23a27eb8-ac78-4996-b788-d758dacd699f","firmwareVersion":"Unknown","id":"uuid:23a27eb8-ac78-4996-b788-d758dacd699f","ip":"192.168.4.106","model":"23_KANTSU2E_PJT_FHD","modelName":"SP-LFF3CLMXXZD","name":"Freestyle","networkType":"wireless","resolution":"1920x1080","smartHubAgreement":"true","ssid":"84:70:d7:34:0b:e8","type":"Samsung SmartTV","udn":"uuid:23a27eb8-ac78-4996-b788-d758dacd699f","wifiMac":"54:44:A3:5F:C8:DE"},"id":"uuid:23a27eb8-ac78-4996-b788-d758dacd699f","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":"Freestyle","remote":"1.0","type":"Samsung SmartTV","uri":"http://192.168.4.106:8001/api/v2/","version":"2.0.25"}

Could it be that?

@Niklas31
Copy link

Adding to my previous commet, right after powering off, the PowerState shows as "StandBy" and then as "". The problema is probably with blank

@fadiallos
Copy link

Hi @tavicu I think I have the same issue as described on this thread, but my tv does not show powerstate TV ~2018... I guess I should wait for plugin version 6.0.0? Are you working towards an ETA?
Otherwise loving the plugin, especially the apple remote control.

Unfortunately I don't have an ETA because I am writing everything from the scratch using newer technologies.

Also have a newborn which takes almost all my time :)

But i'll do my best to finish ASAP since now I can use again my plugin. Almost a year ago I have migrated to Home Assistant and I don't like their integration with Samsung TVs. Now they released a new version that allows to add TVs from HomeKit to Home Assistant and I will be able to use this plugin :)

Congrats on the newborn! they are a joy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting feedback Awaiting information that was requested in the comments before any further action will be taken.
Projects
None yet
5 participants