Broadlink IR Media Player (For old, dump TVs)

Just updated to 0.88

2019-02-21 10:18:55 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.media_player.broadlink. Make sure all dependencies are installed

Traceback (most recent call last):

File "/usr/local/lib/python3.7/site-packages/homeassistant/loader.py", line 147, in _load_file

module = importlib.import_module(path)

File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module

return _bootstrap._gcd_import(name[level:], package, level)

File "<frozen importlib._bootstrap>", line 1006, in _gcd_import

File "<frozen importlib._bootstrap>", line 983, in _find_and_load

File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked

File "<frozen importlib._bootstrap>", line 677, in _load_unlocked

File "<frozen importlib._bootstrap_external>", line 728, in exec_module

File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed

File "/config/custom_components/media_player/broadlink.py", line 13, in <module>

from homeassistant.components.media_player import (

ImportError: cannot import name 'SUPPORT_TURN_ON' from 'homeassistant.components.media_player' (/usr/local/lib/python3.7/site-packages/homeassistant/components/media_player/__init__.py)

2019-02-21 10:18:55 ERROR (MainThread) [homeassistant.loader] Unable to find platform broadlink

Scroll 8 posts up!

1 Like

YOu mean replace with the code you provided the below code?

from homeassistant.components.media_player import (
    SUPPORT_TURN_ON, SUPPORT_TURN_OFF, SUPPORT_VOLUME_MUTE, 
    SUPPORT_VOLUME_STEP, SUPPORT_SELECT_SOURCE, SUPPORT_PREVIOUS_TRACK,
    SUPPORT_NEXT_TRACK, MediaPlayerDevice, PLATFORM_SCHEMA)
from homeassistant.const import (
    CONF_HOST, CONF_MAC, CONF_TIMEOUT, STATE_OFF, STATE_ON,
    STATE_PLAYING, STATE_PAUSED, STATE_UNKNOWN, CONF_NAME, CONF_FILENAME)
from homeassistant.helpers.event import (async_track_state_change)
from homeassistant.helpers.restore_state import RestoreEntity
from homeassistant.core import callback
from configparser import ConfigParser
from base64 import b64encode, b64decode

No, i mean update from GitHub.

1 Like

I think that [custom_components.json] have to be updated from

“local_location”: “custom_components/media_player/broadlink.py”

to

“local_location”: “custom_components/broadlink/media_player.py”

@Vassilis, component will not be found by HA in 0.91.0b2.
Looks like it needs another name?

Ha! That was easy, just renamed
.homeassistant/custom_components/broadlink
to
.homeassistant/custom_components/broadlink1
and also the media_players

media_player:
  - platform: broadlink1

Lesson learned!

1 Like

Hi,
New version - 0.92 and component not loaded.

anyone who still got this working
please guide,
thanks

Create the folder and rename like in my post above.
Create an __init__.py file with DOMAIN = "broadlink1" in it.

Dear,
Will this work on 0.92

I’m on 0.92.0 and it works.

(ha) homeassi:~$ ls -l .homeassistant/custom_components/broadlink1/
insgesamt 20
-rw-rw-r-- 1 homeassi homeassi    22 Apr 18 09:18 __init__.py
-rw-rw-r-- 1 homeassi homeassi 10395 Feb 15 11:14 media_player.py

Can please provide me ur custom component files,
Thanks in adv

The media_player.py is the original from github just renamed from broadlink.py
The __init__.py

(ha) homeassi:~/.homeassistant/custom_components/broadlink1$ cat __init__.py 
DOMAIN = "broadlink1"

Like said 3 posts above.

Why not use SmartIR? This component is outdated. If you need help to convert your INI files, please PM me.

Ah thanks a lot, using SmartIR was too much on my plate as I jump from 0.87 to 0.91, and this just makes an easy workaround for a while !

EDIT : @Vassilis, I wrote that just before your comment. You’re right, I’m planning to move to SmartIR, but later as I still have a lot to debug !

Thanks for the hint!

Dear, i tried this
i was using broadlink switch as template in binary sensor to detect my switch as on/off and control it,
can you please guide me how to set this config with new available command

Blockquote

  • platform: template
    switches:
    samsungtvpower:
    friendly_name: Samsung Hall
    value_template: “{{ states.input_boolean.samsungtv_power_status.state == ‘on’ }}”
    turn_on:
    - service: switch.broadlink_send_packet_192_168_1_25
    data:
    packet:
    - “JgBGAJKVETkRORA6ERQRFBEUERQRFBE5ETkQOhAVEBUQFREUEBUQOhEUERQRORE5EBURFBA6EBUQOhE5EBUQFRA6EDoRFBEADQUAAA==”
    - “JgBGAJKVETkRORA6ERQRFBEUERQRFBE5ETkQOhAVEBUQFREUEBUQOhEUERQRORE5EBURFBA6EBUQOhE5EBUQFRA6EDoRFBEADQUAAA==”
    - service: input_boolean.turn_on
    data:
    entity_id: input_boolean.samsungtv_power_status
    turn_off:
    - service: switch.broadlink_send_packet_192_168_1_25
    data:
    packet:
    - “JgBGAJOVEDoQOhA6DxYPFhAVEBUQFRA6ETkROREUERQRFBEUEBUQFREUERQRORE5EBUQFRE5ETkRORE5ERUQFRA6DzsPFhAADQUAAA==”
    - “JgBGAJOVEDoQOhA6DxYPFhAVEBUQFRA6ETkROREUERQRFBEUEBUQFREUERQRORE5EBUQFRE5ETkRORE5ERUQFRA6DzsPFhAADQUAAA==”
    - service: input_boolean.turn_off
    data:
    entity_id: input_boolean.samsungtv_power_status
    icon_template: mdi:television-classic

i make it worked
i need to add switch.py form original home-assistant component broadlink
to my custom_components/broadlink1/
and i need to change my broadlink switch platform to broadlink1 in my binary sensor.
thanks for guiding

Dear,
if someone can guide me
i would like to link my media_player.onkyo (which works with broadlink component) to turn on/off with my switch.onkyo component and should reflect its status accordingly.

i have onkyo receriver which is non-network device.

Please guide me how can i do this.
thanks