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

Turning OFF the TV, HASSIO retain state ON #13

Closed
rcxrbt opened this issue Apr 27, 2020 · 38 comments
Closed

Turning OFF the TV, HASSIO retain state ON #13

rcxrbt opened this issue Apr 27, 2020 · 38 comments

Comments

@rcxrbt
Copy link

rcxrbt commented Apr 27, 2020

The problem
Problem is like #issue10, but a bit different.

When I try to switch OFF the TV from HASSIO or from IR Control, TV power OFF perfectly but... HASSIO retain "TV State ON" or, if it going OFF, after about 25 seconds, return ON.

image

  • Also happen sending key KEY_POWER using the service media_player.play_media.
  • Also happen tapping "toggle button" on media_player.samsungtv TAB
  • On SmartThings APP TV stay in correct state OFF.

image

Environment

  • Hardware: Raspberry Pi3
  • HASSIO release: 0.108.9
  • SamsungTV Smart Integration release: v0.2.1 (via HACS)
  • TV model: RU7170 (UE50RU7170UXZT)
  • SmartThings integration NOT configured

Please help me to enable log, if you need more details.

@spider7611
Copy link

spider7611 commented Apr 27, 2020

Have a same problem from today. :(
Tryed go back last working version, but the problem is remaining.

After HA restart want to switch off on media player card (which is on after restart???) and show this error:

`Logger: homeassistant.components.websocket_api.http.connection.139623124608592
Source: custom_components/samsungtv_smart/api/samsungws.py:204
Integration: websocket_api (documentation, issues)
First occurred: 12:13:11 (1 occurrences)
Last logged: 12:13:11

socket is already closed.
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 134, in handle_call_service
connection.context(msg),
File "/usr/src/homeassistant/homeassistant/core.py", line 1232, in async_call
await asyncio.shield(self._execute_service(handler, service_call))
File "/usr/src/homeassistant/homeassistant/core.py", line 1255, in _execute_service
await handler.func(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
self._platforms.values(), func, call, required_features
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 412, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 600, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 443, in _handle_entity_call
await result
File "/config/custom_components/samsungtv_smart/media_player.py", line 782, in async_turn_off
await self.async_send_command("KEY_POWER")
File "/config/custom_components/samsungtv_smart/media_player.py", line 621, in async_send_command
self.send_command, payload, command_type, retry_count, key_press_delay
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/samsungtv_smart/media_player.py", line 592, in send_command
self._ws.send_key(payload, key_press_delay)
File "/config/custom_components/samsungtv_smart/api/samsungws.py", line 484, in send_key
key_press_delay,
File "/config/custom_components/samsungtv_smart/api/samsungws.py", line 204, in _ws_send
connection.send(payload)
File "/usr/local/lib/python3.7/site-packages/websocket/_app.py", line 153, in send
if not self.sock or self.sock.send(data, opcode) == 0:
File "/usr/local/lib/python3.7/site-packages/websocket/_core.py", line 253, in send
return self.send_frame(frame)
File "/usr/local/lib/python3.7/site-packages/websocket/_core.py", line 278, in send_frame
l = self._send(data)
File "/usr/local/lib/python3.7/site-packages/websocket/_core.py", line 448, in _send
return send(self.sock, data)
File "/usr/local/lib/python3.7/site-packages/websocket/_socket.py", line 135, in send
raise WebSocketConnectionClosedException("socket is already closed.")
websocket._exceptions.WebSocketConnectionClosedException: socket is already closed.`

@spider7611
Copy link

Now it is workong again for me. Don't know what was the problem...

@ollo69
Copy link
Owner

ollo69 commented Apr 27, 2020

Can you clarify which version is working for you and which not?

@spider7611
Copy link

Now on the newest 0.2.1

@rcxrbt
Copy link
Author

rcxrbt commented Apr 27, 2020

If i try to turno OFF... "socket is already closed."

Log Details (ERROR)
Logger: homeassistant.components.websocket_api.http.connection.1779210736
Source: custom_components/samsungtv_smart/api/samsungws.py:204
Integration: websocket_api (documentation, issues)
First occurred: 1:46:52 PM (1 occurrences)
Last logged: 1:46:52 PM

socket is already closed.
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 134, in handle_call_service
connection.context(msg),
File "/usr/src/homeassistant/homeassistant/core.py", line 1232, in async_call
await asyncio.shield(self._execute_service(handler, service_call))
File "/usr/src/homeassistant/homeassistant/core.py", line 1255, in _execute_service
await handler.func(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
self._platforms.values(), func, call, required_features
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 412, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 600, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 443, in _handle_entity_call
await result
File "/config/custom_components/samsungtv_smart/media_player.py", line 782, in async_turn_off
await self.async_send_command("KEY_POWER")
File "/config/custom_components/samsungtv_smart/media_player.py", line 621, in async_send_command
self.send_command, payload, command_type, retry_count, key_press_delay
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/samsungtv_smart/media_player.py", line 592, in send_command
self._ws.send_key(payload, key_press_delay)
File "/config/custom_components/samsungtv_smart/api/samsungws.py", line 484, in send_key
key_press_delay,
File "/config/custom_components/samsungtv_smart/api/samsungws.py", line 204, in _ws_send
connection.send(payload)
File "/usr/local/lib/python3.7/site-packages/websocket/_app.py", line 153, in send
if not self.sock or self.sock.send(data, opcode) == 0:
File "/usr/local/lib/python3.7/site-packages/websocket/_core.py", line 253, in send
return self.send_frame(frame)
File "/usr/local/lib/python3.7/site-packages/websocket/_core.py", line 278, in send_frame
l = self._send(data)
File "/usr/local/lib/python3.7/site-packages/websocket/_core.py", line 448, in _send
return send(self.sock, data)
File "/usr/local/lib/python3.7/site-packages/websocket/_socket.py", line 135, in send
raise WebSocketConnectionClosedException("socket is already closed.")
websocket._exceptions.WebSocketConnectionClosedException: socket is already closed.

@spider7611
Copy link

Sorry not working again. Want to try it again and switch it on and off some time across HA media player, then the problem is come back. Now it it's always switch back on in HA.

@ollo69
Copy link
Owner

ollo69 commented Apr 27, 2020

If I well understand the TV is off and in HA is displayed as on, then when you try to send a command from HA you receive an error? Correct?

@spider7611
Copy link

Yes. But the error message only once received after the HA reboot and try to switch on the TV.

@ollo69
Copy link
Owner

ollo69 commented Apr 27, 2020

Can you please make a test for me: just turn off the TV, wait 1 minute and from a PC command promt ping the TV ip:

ping <your_ip_tv>

and let me know what you receive back.

@rcxrbt
Copy link
Author

rcxrbt commented Apr 27, 2020

Can you please make a test for me: just turn off the TV, wait 1 minute and from a PC command promt ping the TV ip:

ping <your_ip_tv>

and let me know what you receive back.

After 1 minute tuned OFF, the TV not replay to ping.

@ollo69
Copy link
Owner

ollo69 commented Apr 27, 2020

And in HA the TV appear to be ON?

@rcxrbt
Copy link
Author

rcxrbt commented Apr 27, 2020

And in HA the TV appear to be ON?

Tuned OFF TV by IR Remote, in HA stay ON.

image

@ollo69
Copy link
Owner

ollo69 commented Apr 27, 2020

Do you have SmartThings configured?

@spider7611
Copy link

C:\Users\Spider2>ping 192.168.1.183

Pinging 192.168.1.183 with 32 bytes of data:
Reply from 192.168.1.114: Destination host unreachable.
Reply from 192.168.1.114: Destination host unreachable.
Reply from 192.168.1.114: Destination host unreachable.
Reply from 192.168.1.114: Destination host unreachable.

Ping statistics for 192.168.1.183:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

@spider7611
Copy link

If I turn it on then off after working good again a while. Then stopped working and stay "on" on HA and not working.

@rcxrbt
Copy link
Author

rcxrbt commented Apr 27, 2020

[cut]

  • TV model: RU7170 (UE50RU7170UXZT)
  • SmartThings integration NOT configured

SmartThings integration NOT configured for me @rcxrbt

@ollo69
Copy link
Owner

ollo69 commented Apr 27, 2020

OK, just one more questions: is it working with old version (0.1.x)?

@spider7611
Copy link

spider7611 commented Apr 27, 2020

Yesterday and before worked perfectly, only send error message the HA about translations file. Today updated the latest version and after do this problem. But If I want to go back the problem is remained.

SmartThings integration is configured for me @spider7611

Maybe try reconfigure again.

@spider7611
Copy link

Try reconfigure it and cant connect to my tv. Show this:

Enter your Samsung TV information. SmartThings token is optional but really suggested. If you never connected Home Assistant before you should see a popup on your TV asking for authorization.

Unable to connect to this Samsung TV device.

@ollo69
Copy link
Owner

ollo69 commented Apr 27, 2020

Try reconfigure it and cant connect to my tv. Show this:

Enter your Samsung TV information. SmartThings token is optional but really suggested. If you never connected Home Assistant before you should see a popup on your TV asking for authorization.

Unable to connect to this Samsung TV device.

Do you enter the SmartThings token during configuration? Is your TV turned on?
Nothing change in config procedure from previous version!

@spider7611
Copy link

Yes enter it during configuration. Tv is turned on.
After tryed without token and it is worked, but the problem is the same... :(

@ollo69
Copy link
Owner

ollo69 commented Apr 27, 2020

If you install v0.1.18, everythink is ok? This is important for me to know.

@spider7611
Copy link

Tryed just now. First time it is worked reverse. When the TV on in HA the card show off and If the TV off the card show on. :) After set the state on the HA service page and now it is working ok.
Don't know for how long... will test it and not update it.

@rcxrbt
Copy link
Author

rcxrbt commented Apr 27, 2020

This morning, I tryied to install SmartThings Intagration (never installed), but not worked.
So SmartThings integration NOT configured for me.

@ollo69
Copy link
Owner

ollo69 commented Apr 27, 2020

And in HA the TV appear to be ON?

Tuned OFF TV by IR Remote, in HA stay ON.

image

I do not understand how you can have channel name without smartthings...

@ollo69
Copy link
Owner

ollo69 commented Apr 27, 2020

Tryed just now. First time it is worked reverse. When the TV on in HA the card show off and If the TV off the card show on. :) After set the state on the HA service page and now it is working ok.
Don't know for how long... will test it and not update it.

Please stay with previous version and report here if it work or not. Meantime I will check possible issue with new version....

@rcxrbt
Copy link
Author

rcxrbt commented Apr 27, 2020

And in HA the TV appear to be ON?

Tuned OFF TV by IR Remote, in HA stay ON.
image

I do not understand how you can have channel name without smartthings...

Sorry for misunderstood.
My TV is registered on SmartThings and i use Token, but never Installed SmartThings integration.

image

@ollo69
Copy link
Owner

ollo69 commented Apr 27, 2020

Ok, now is more clear.
HA SmartThings integration have nothing to do with this component and is not used by it.
Can also you try if previous version (v0.1.18) works fine for you?

@rcxrbt
Copy link
Author

rcxrbt commented Apr 27, 2020

Ok, now is more clear.
HA SmartThings integration have nothing to do with this component and is not used by it.
Can also you try if previous version (v0.1.18) works fine for you?

Best steps to try previous version (v0.1.18) ?

@ollo69
Copy link
Owner

ollo69 commented Apr 27, 2020

just install from hacs and reboot ha. There are no changes in config

@rcxrbt
Copy link
Author

rcxrbt commented Apr 27, 2020

just install from hacs and reboot ha. There are no changes in config

Version v0.1.18 seems work fine.
Turning OFF the TV by toggle, IR Remote or sending KEY_POWER, HA show the TV is OFF.
I preferred version 2.0.1 for the improvements that I have now lost :(

@ollo69
Copy link
Owner

ollo69 commented Apr 27, 2020

I will work on 0.2.x, but need time. I fully rewrite library, so it is normal that there are issue. Look for new version and be patient with issue, I appreciate your effort in debug.

Thx

@spider7611
Copy link

Version v0.1.18 seems work fine too for me. ;)

@marcin77
Copy link

marcin77 commented May 2, 2020

I also have this problem, I had back to v0.1.18, and apparently now is ok, but in history it displays that tv is turned on every 25-35 minutes.
screenshot-192 168 0 125-8123-2020-05-02-11-33-15-848

@spider7611
Copy link

spider7611 commented May 3, 2020

Now I see have update, but can't update v0.1.18 to the latest V0.2.5 on hacs.. What is the problem? After update and HA restart stay on v0.1.18.

@ollo69
Copy link
Owner

ollo69 commented May 3, 2020

I don't thing this is a problem related to the component.
Maybe you are not really selecting last version in HACS because HACS stay on the last version selected when you roll-back

@spider7611
Copy link

Ok, sorry that was the problem.

@ollo69
Copy link
Owner

ollo69 commented May 22, 2020

This issue should be fixed. I close it for now

@ollo69 ollo69 closed this as completed May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants