Query Samsung TV status via REST end point#11179
Query Samsung TV status via REST end point#11179RiRomain wants to merge 2 commits intohome-assistant:devfrom RiRomain:samsung-tv-power-off-correction
Conversation
Optionally get the status of a Samsung TV using Samsung's REST end point. This avoid sending a dummy command that wake up some of the newest model.
| self.send_key('KEY') | ||
|
|
||
| def _update_status_via_rest(self): | ||
| url = "http://{}:{}/api/v2/" |
There was a problem hiding this comment.
This logic needs to be added to the upstream samsungctl library.
There was a problem hiding this comment.
I'm afraid that would be out of scope for this library, since the library just focus on control via websocket, and does not interact with the REST endpoint for now.
If it's required I'll try, but not sure my code make it to samsungctl library.
There was a problem hiding this comment.
Pull request opened in SamsungCTL library
Ape/samsungctl#71
|
@RiRomain I have the same issue with my UE40 MU6179 UXZG and tried the code from the PR. I updated the samsungtv.py and added the get_status_via_rest Flag to my configuration.yml, but it did not work. After updating I can switch off the TV using Home Assistant. Is it okay to just swap the code in samsungtv.py and restart Home Assistant, or do I need to do anything else? |
|
If you can switch it off, what is the issue? Not sure how to do it on a live hass, I used a dev instance (using pycharm on windows). |
This new method "is_tv_on()" report the status of the TV. This aim at avoiding sending a dummy key for TV using websocket, doing so can wake TV up if send during an update, or during an update status check. home-assistant/core#11179
|
fixes #12302 (I think) |
|
This PR seems to have gone stale. Rest logic needs to go into the lib being used. Closing it. You can reopen it when you're ready to finish it. |
|
I did open a request in the lib, but seems it won't be merge any time soon. Ape/samsungctl#71 |
Description:
Optionally get the status of a Samsung TV using Samsung's REST end point.
This avoid sending a dummy command that wake up some of the newest model.
Detail: When checking for update, the TV wakes up and connect to wifi. If during this time, the status was queried (by sending a dummy command), the TV would be turned ON.
This commit fixed that by checking if the REST endpoint is available instead of sending a key command.
The status of the TV will still appear as ON for a few second several time per day which could be problematic for automation, but at least the TV won't be turned ON and the status will be set back to OFF after a few seconds.
Related issue (if applicable): fixes #10905
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#4226
Example entry for
configuration.yaml(if applicable):Checklist:
If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
toxrun successfully. Your PR cannot be merged unless tests passREQUIREMENTSvariable (example).requirements_all.txtby runningscript/gen_requirements_all.py..coveragerc.