ollo69 / ha-samsungtv-smart

📺 Home Assistant SamsungTV Smart Component with simplified SmartThings API Support configurable from User Interface.
Apache License 2.0
432 stars 57 forks source link

State does not update properly? #309

Open jockebq opened 4 months ago

jockebq commented 4 months ago

Renamed my TV from Samsung QN95B to just Samsung and since then I have been having problems with state not working as it should. Removed the TV from Home Assistant and added it once again. Still the same issue. Tried switching from WiFi to Ethernet and still having the same problem.

I don’t know why this started happening, and how to solve it? It was working good before!

NuvioDev commented 4 months ago

Same here, cannot update the tv on status since last 4 days. I have tried to change port settings but no luck. Seems there is a problem with the power on status.

anthonymkz commented 4 months ago

Same here. Recently power state has not been updating. I have to reload the integration to get it to update.

ronyn77 commented 4 months ago

Same here... the power state hasn't been updating anymore. I have a Samsung S95C, and until now it worked without any problems. However, after updating Home Assistant, the media player entity shows as turned off all the time. The only way to bring it back on is to restart Home Assistant.

KimuraFTW commented 4 months ago

NOTE: This proposes using an alternative integration. I realize this does not solve the problem with THIS integration, but it MAY work with this integration if you execute similar steps. I haven't tried (yet). I just wanted something that works for now and am posting this because someone else might as well.

Device: Samsung QN85B

I started having this problem after updating my Home Assistant and Home Assistant OS versions recently ( ~ last week or so ). My status stopped updating when the tv was turned on/off. Ultimately I ended up switching back to the Samsung integration, which had its own set of annoyances but is working ( for now, at least ).

After switching to the Samsung integration, I kept having an issue where notifications kept popping up for permission requests when (presumably) the state was being polled. This kept happening even after my HA instance was added as an allowed device and notifications were turned off. Here are the steps as I took them if anyone is interested. I just did this today so there could be unnecessary steps included. ( I didn't have issues beyond the tv connection, but you may want to back up your HA configuration before doing this just to be safe )

  1. Uninstalled the Samsung Tv Smart integration
  2. On my Samsung tv, navigated to Settings -> connection -> External Device manager -> Device Connect Manager -> Device List
  3. Deleted the Home Assistant device entry
  4. Restarted Home Assistant
  5. On the Samsung Tv, went back to the device connect manager and set "Access Notification" to "First Time Only"
  6. Installed the Samsung Smart Tv Integration ( be sure to keep the entity name(s) the same so you don't have any issues with any existing functionality related to your tv )
  7. Multiple notifications requesting permission(s) popped up on the tv, which I allowed
  8. Went back to the Device List and verified that Home Assistant showed up as an allowed device
  9. In the Device Connect Manager, I set the "Access Notification" to "Off"
  10. Restarted Home Assistant
  11. Was prompted for permission one more time ( not sure why )
  12. Turned off the tv and verified that the on/off state updated in HA
  13. Turned on the Tv and verified that the on/off state updated in HA without being prompted for permission

I understand that this is just an alternative and not a solution or even a workaround using this integration, but if you just want something that works for now, I suppose it's worth a shot. 🤷🏿‍♂️ Good luck! 👍🏿

I'll report back if I manage to figure out a way to get it working using the Samsung Tv Smart integration

derekjwhitten commented 4 months ago

In the last few days I've been seeing different behaviour for my Samsung Frame. Previously the media_player would have a status of 'on' if art mode was on. Now the media_player is off but there's a new art_mode_status which toggles on/off. This is actually a good thing because it makes it easier to distinguish between art mode on vs TV on.

However, I've found that after the TV goes to sleep, next time art mode comes on the new art_mode_status stays off. It only works again after I've fully turned on the TV.

Not sure if this is the same issue you're reporting, and whether it is new intended behaviour or a change on the Samsung side?

jjavin commented 4 months ago

I have the same problem, after turning off the TV when I turn it on again it does not update the status. I have to restart the integration

anthonymkz commented 4 months ago

Just as an FYI, reloading the configuration does seem to update the status in the integration. Until this is fixed I've added the homeassistant.reload_config_entry Service at the beginning of all my automations so it will reload the integration before running the automation to avoid any issues.

ronyn77 commented 4 months ago

Just as an FYI, reloading the configuration does seem to update the status in the integration. Until this is fixed I've added the homeassistant.reload_config_entry Service at the beginning of all my automations I have using this integration telling it to reload the integration before running the automation to avoid any issues.

Great idea, I've used it before for different purposes, but I forgot about it. Thanks for the reminder!

edzards commented 4 months ago

I am facing exactly the same issue since the last update.

Uny02 commented 4 months ago

Same here. Multiple requests from HA every few seconds.

jockebq commented 4 months ago

Is there any solution to this?

gaussey commented 4 months ago

I’m having an issue with adjusting the volume which I think is related, I can turn the volume up or down a few ticks and then it stops responding and I have to mute and unmute for volume state to update again. Looking at the attribute states in developer tools volume level disappears at the same time as it stops responding.

Seafo commented 4 months ago

I had the same issue. But I installed Samsung smartthings integration. This gave me a reliable on/off switch for my Frame TV in HA. Then I made an automation that reload the custom TV integration every time smarthings tell HA that the TV turns on. Has worked very well so far.

KimuraFTW commented 4 months ago

Just for the record, I have 6 Samsung Tvs running through a matrix at my house and the only affected tv has been the QN85B. The others are CU7000s, MU6300s, and NU6900s and they haven't shown any issues. So it seems that either some models are unaffected or that this issue is triggered somehow.

jockebq commented 4 months ago

Just for the record, I have 6 Samsung Tvs running through a matrix at my house and the only affected tv has been the QN85B. The others are CU7000s, MU6300s, and NU6900s and they haven't shown any issues. So it seems that either some models are unaffected or that this issue is triggered somehow.

I only have one, a QN95B, which is affected!

d4icon commented 4 months ago

Same problem here.

Only work when restart integration

webjib commented 3 months ago

Same here with a Frame 2022. I’ve stopped using the integration because of that :( can’t find a solution except reloading the integration constantly…

madcowGit commented 3 months ago

I have the same issue: Samsung The Frame 32LSO3B (2023)

stibbzy commented 3 months ago

Same problem with my 2020 Frame TV, however my Samsung M7 Smart Monitor’s state is working fine with the integration. EDIT: OK, seems I was able to resolve by removing the TV from the Smartthings app and re-adding it.

skyw33 commented 3 months ago

Same problem with my Frame TV. If I send a media_player.turn_on service to the tv, it will turn it on, but the status of the tv remains off. However, once the tv is on, if I send a "SamsungTV Smart: Set Art Mode" service, the entity remains off, but the entity attribute changes to "art_mode_status: on". If I then send another "media_player.turn_on" service when art mode is "on", then the samsung tv entity WILL update and show a status of "on". I.e. I am able to get the entity to update the power status, but it requires that the art mode is "on" first. Can others with Frame TVs confirm that this method works for them?

@ollo69 does this give any insight into what might be happening?

madcowGit commented 3 months ago

Or are there any logs I can provide or look into for clues?

mytasker commented 3 months ago

So, looks like I'm not alone on this.

My work around is to reload the integration (using the below) If you manually reload the integration, it will show the correct entity state after that.

So, add the below to your automation script:

Replace the entity device name to your device - on mine I named it smarthingstv )

service: homeassistant.reload_config_entry
metadata: {}
data: {}
target:
  entity_id: media_player.smarthingstv 
skyw33 commented 3 months ago

Thank you @mytasker ! This workaround is working very well for me.

bradnak commented 3 months ago

I'm also seeing this issue on my S95BA. As others have noted, reloading the config correctly detects the state. Still, I would like it to update automatically because I have an energy consumption integration connected to the device's state.

olythoreau commented 3 months ago

Also have the mediaplayer for this integration incorrectly reporting as off when the TV is on for my S95B. Got rid of the problem by uninstalling and reinstalling all integrations related to Samsung TVs, and doing the trick with my "Allow Access" notifications mentioned above. However, when I use the Ambient mode, it breaks again. It also breaks my app buttons, which will turn the TV off if I press them. Strangely, if I press the app buttons again, they do not turn the TV on. I noticed one instance where ambient mode does not break the power status of the tv reporting correctly... If I initiate ambient mode using the app button in HA I created when the TV is already off, and then switch to another app, the powered on/off status still reports correctly. Naturally, I have get power status from SmartThings enabled.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 7 days.

circa1665 commented 1 month ago

Not stale

d4icon commented 1 month ago

I seem to also have this problem with my Samsung 43 Serif. But I found a decent workaround and that is to set the TCP port in the advanced setting to 0 so it uses ICMP for power status instead.

mmm but.... is 0 by default.... no?

aheagel commented 1 month ago

I seem to also have this problem with my Samsung 43 Serif. But I found a decent workaround and that is to set the TCP port in the advanced setting to 0 so it uses ICMP for power status instead.

mmm but.... is 0 by default.... no?

I have the smartthing credentials so my tcp port was like 9xxx but i removed my last comment as it only worked decently for 5 min and now I'm back to square one again.

mytasker commented 1 month ago

Based on what you mentioned there @aheagel I ran the command below to check which network ports my TV is reporting in use.

nmap -sT 192.168.178.42

Then, double confirmed the port using a second application (WireShark) and I could see my TV's IP address (above) constantly talking via the port:

8001 open "vcom-tunnel"

So, for everyone still having the issue, please try the port above. If it does not work, try to run a scan against your TV IP address. If you use the Nmap application (found at https://nmap.org) - you will be looking for a port with the description "vcom-tunnel".

Then, go to the integration Samsungtv_Smart > click on Configure > check the box to "Show options menu" > click on Submit > click on Advanced Options > then change the TCP port to what you found - in my case 8001

That should do it. I've done multiple HomeAssistant restarts and ON/OFF on the TV to double confirm it still working after it all.

If that is too much to find the correct port, please just use the work around above.

@skyw33 @olythoreau, this may help you as well.

Cheers,

PS: If port 8001 fixes everyone's issue. Then, we may be lucky to get it implemented in the next update. Otherwise, if everyone port is different, then it would be hard, and best is to just follow the documentation that mention about it: https://github.com/ollo69/ha-samsungtv-smart (search for "power status")

jwgstr commented 1 month ago

I'm also been experiencing these issues. I just checked and I also have vcom-tunnel available at port 8001. I updated the configuration as recommended and everything is working fine so far (still works through multiple ON/OFF cycles). Will report back as I have a chance to use it more. My problem with losing state has definitely been intermittent; hard to pin down even.

One thing I noticed though too while testing just now was that when reloading the configuration it seemed to revert the port (or at least it no longer showed up in the menu for me). Not sure if this messing up anyone's testing but I thought I'd mention it just in case.

edzards commented 1 month ago

For me it's also port 8001. However, when using this port, when the TV is turned off, after a couple of minutes the power state changes to "on" and then a few seconds later to "off" again - this then happens in 5 minute-intervals which is very inconvenient if you want to use the integration for automations. Anyone else facing the same issue?

bradnak commented 1 month ago

For me it's also port 8001. However, when using this port, when the TV is turned off, after a couple of minutes the power state changes to "on" and then a few seconds later to "off" again - this then happens in 5 minute-intervals which is very inconvenient if you want to use the integration for automations. Anyone else facing the same issue?

Yes this happens to me too.

Condla commented 1 month ago

Same here. I confirm that this is workaround gives you the on/off state more reliably, but every few minutes the tv shows on then off again, when it's in fact off m

twister36 commented 1 month ago

This integration has been very flaky from the start.... I gave up on using it for the majority of my actions and use SmartThings' API directly: https://developer.smartthings.com/docs/devices/capabilities/capabilities-reference/

I installed a smart outlet on my TV and if the power is over 50W, then I know the TV is on and then I tell my automation to query the Smarthings API every 3 seconds. You call the API to check the TV status, or turn the device on/off....

It's so far been 100% reliable.

Example to turn on your TV: POST: https://api.smartthings.com/v1/devices/{device_id}/commands

body = { "commands": [ { "component": "main", "capability": "switch", "command": "on" } ] }

kamashkin commented 1 month ago

I may have the wrong advice, but for those who have a problem, try this PR: https://github.com/ollo69/ha-samsungtv-smart/pull/300

I have a Samsung The Frame 2022 connected via wifi + smartthings token. everything works perfectly

mytasker commented 1 month ago

This integration has been very flaky from the start.... I gave up on using it for the majority of my actions and use SmartThings' API directly: https://developer.smartthings.com/docs/devices/capabilities/capabilities-reference/

I installed a smart outlet on my TV and if the power is over 50W, then I know the TV is on and then I tell my automation to query the Smarthings API every 3 seconds. You call the API to check the TV status, or turn the device on/off....

It's so far been 100% reliable.

Example to turn on your TV: POST: https://api.smartthings.com/v1/devices/{device_id}/commands

body = { "commands": [ { "component": "main", "capability": "switch", "command": "on" } ] }

Another zero-cost solution is to install the original Samsung integration for HA: https://www.home-assistant.io/integrations/samsungtv

Then use power status from that integration to reload the "SmarthingsTV integration" as the "smarthingstv" offers way more control when compared to the original/support by HA.

The automation below takes around 2 seconds to reload the integration. So, it is a good/reliable option; It only runs once as the TV is detected as ON; and all your automations related to "SmarthingTV" may NOT require any change or, probably a 5 seconds delay before running if the TV is OFF and you are trying to turn it ON

alias: Reload smarthingstv integration
description: ""
trigger:
  - platform: state
    entity_id:
      - media_player.livingroomtv
    from: "off"
    to: "on"
condition: []
action:
  - metadata: {}
    data: {}
    target:
      entity_id: media_player.smarthingstv
    action: homeassistant.reload_config_entry
mode: single
mytasker commented 1 month ago

I may have the wrong advice, but for those who have a problem, try this PR: #300

I have a Samsung The Frame 2022 connected via wifi + smartthings token. everything works perfectly

I just copied the file, and I'll give it test as well @kamashkin

bradnak commented 4 weeks ago

Yes, I've also manually copied the file from #300. I haven't had it running for too long yet but I think at least the power state isn't endlessly toggling in HA now.

edzards commented 3 weeks ago

I also tried this PR for some time. After having changed the TCP port back to 0 (from 8001), the integration now seems to work properly. Many thanks for providing the bugfix!

mytasker commented 2 weeks ago

YES! The https://github.com/ollo69/ha-samsungtv-smart/pull/300 is the fix for this one. Working well for the past 2 weeks.