sermayoral / ha-samsungtv-encrypted

Samsung TV Encrypted Models (H & J Series) custom component for Home Assistant
Apache License 2.0
38 stars 24 forks source link

Broken after updating Home Assistant to 0.115 #53

Closed andrepia closed 4 years ago

andrepia commented 4 years ago

I lost my media_player entities after updating Home Assistant to 0.115. Here's the log:

Logger: homeassistant.components.media_player
Source: custom_components/samsungtv_encrypted/media_player.py:129 
Integration: Media player (documentation, issues) 
First occurred: 8:29:34 PM (2 occurrences) 
Last logged: 8:29:34 PM

Error while setting up samsungtv_encrypted platform for media_player
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 193, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/samsungtv_encrypted/media_player.py", line 129, in setup_platform
    turn_on_action = Script(hass, turn_on_action)
TypeError: __init__() missing 2 required positional arguments: 'name' and 'domain'

Here's the config:

media_player:
  - platform: samsungtv_encrypted
    host: !secret samsungtv_encrypted_sala_host
    token: !secret samsungtv_encrypted_sala_token
    sessionid: !secret samsungtv_encrypted_sala_sessionid
    port: !secret samsungtv_encrypted_sala_port
    name: sala_tv
    turn_on_action:
      - service: switch.turn_on
        data:
          entity_id: switch.samsung_tv_power

  - platform: samsungtv_encrypted
    host: !secret samsungtv_encrypted_suite_host
    token: !secret samsungtv_encrypted_suite_token
    sessionid: !secret samsungtv_encrypted_suite_sessionid
    port: !secret samsungtv_encrypted_suite_port
    name: suite_tv
    turn_on_action:
      - service: switch.turn_on
        data:
          entity_id: switch.samsung_tv_power
sermayoral commented 4 years ago

Hi.

Thanks for reporting it. I will try to fix it next weekend.

sermayoral commented 4 years ago

It seems the problem is about the turn_on_action option. @nashant do you know how to solve it?

andrepia commented 4 years ago

@sermayoral Thanks for your quick reply!! Indeed... I just commented the turn_on_action lines of the configuration.yaml and the entities are back! In the Home Assistant Community, someone posted a possible solution: https://community.home-assistant.io/t/samsung-tv-2014-h-series-not-working/96992/90?u=andrepia

sermayoral commented 4 years ago

@andrepia please, could you overwrite your media_player.py inside the following path: /config//custom_components/samsungtv_encrypted/ with the attached file? Please, give me a feedback. Thanks!

media_player.zip

andrepia commented 4 years ago

@sermayoral Great work!! I can confirm everything is back to normal (including the turn_on_action)!! Thanks a lot!!! 👏 👏 👏

d-lebed commented 4 years ago

@sermayoral are you going to release the fix?

sermayoral commented 4 years ago

@d-lebed sure!