Broadlink IR Media Player (For old, dump TVs)

You can connect a cheap NodeMCU or something with any firmware to the USB Port.
If the TV powers on, the NodeMCU get’s an IP adress and the component can detect the state with the ‘ping_host’ variable.

4 Likes

Great custom component, no issue at all setting it up. However, I was hoping the extra functionality would be picked up by my voice assistants (Alexa, Google, Siri) which all tie into HA. Seems like I can only control this component, and any media component from HA, by turning it on or off.

Does anyone know if it is possible to have a media player component provide all the functionality (volume, source, mute, channel, etc.) into these voice assistants without having to create a custom skill in Alexa, custom Google Actions app, and homebridge plugin for Siri? This was the whole point of using HA for me, as a central configuration for these voice assistants.

Can we customize the displayed items in HA from the general section. I’m trying to make a media component for my sounder and obviously do not need some items (Channel + or -) to show up…

I’d also like to know. So far it’s only on or off for me as well.

can someone please answer this? I would like to implement it but not sure on the correct syntax. In particular, for me an easy way to determine if my amplifier is on is to use the state of one of my chromecast audio’s since I have automations set to turn the amp on and off based on the chromcast.

also, can someone please help me get the volume up/down for this media player component to work with a Xiaomi Cube? I have been trying a bunch of different options such as this below but nothing seems to work for me.

alias: Cube - Rotate
initial_state: 'on'
trigger:
  - platform: event
    event_type: cube_action
    event_data:
      entity_id: binary_sensor.cube_158d00010fd152
      action_type: rotate
action:
  - service: media_player.volume_set
    data_template:
      entity_id: media_player.lounge_amp
      volume_level: >
        {%if trigger.event.data.action_value | float > 0 %} 
            service: switch.turn_on
              entity_id: switch.amp_volume
        {% else %} 
            service: switch.turn_off
              entity_id: switch.amp_volume
        {% endif %}

The media player doesn’t work in 0.64.0

ERROR:homeassistant.config:Invalid config for [media_player.broadlink]: string value is None for dictionary value @ data['power_consumption_entity']. Got None. (See ?, line ?). Please check the docs at https://home-assistant.io/components/media_player.broadlink/

Did version 0.64 release?

Yes, https://pypi.python.org/pypi/homeassistant

EDIT: But i’m back on 0.63.3 :thinking:

Works in 0.64.0 when i use a dummy power_consumption_entity and enter its own entity_id.

power_consumption_entity: media_player.lg_tv

EDIT: Ahh! Sorry, didn’t see your fix on github.
Thanks for the quick fix!

I upgraded to 0.64 then tried to apply the latest build on GitHub but still had problems with the broadlink not loading, either switch, climate or media player. I’ve had to revert to 0.63.3 again to regain functionality.

Is there something I’ve missed?

Received this with 0.64

2018-02-26 15:29:12 ERROR (MainThread) [homeassistant.config] Invalid config for [media_player.broadlink]: string value is None for dictionary value @ data[‘ping_host’]. Got None
string value is None for dictionary value @ data[‘power_consumption_entity’]. Got None. (See ?, line ?). Please check the docs at https://home-assistant.io/components/media_player.broadlink/
2018-02-2

Hey @VDRainer, did you simply overwrite the 3 broadlink.py files to get it to work with 0.64?

Cheers

Linton

Yes, using only the media_player, so replaced https://github.com/vpnmaster/homeassistant-custom-components/blob/master/custom_components/media_player/broadlink.py

1 Like

@Vassilis, I believe your components require updating on your git to include broadlink==0.5.1 as per the latest hassio (0.64.1).

Hi all,
Did you guys make this work on 64.+ yet? Updated the .py files as per @VDRainer’s advice, but get this error in the log:

Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 84, in async_setup
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 243, in result
    raise self._exception
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/light/limitlessled.py", line 125, in setup_platform
    'fade': group_conf[CONF_FADE]
  File "/usr/src/app/homeassistant/components/light/limitlessled.py", line 167, in __init__
    from limitlessled.group.dimmer import DimmerGroup
ModuleNotFoundError: No module named 'limitlessled.group.dimmer'
2018-03-04 20:49:47 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 182, in _step
    result = coro.throw(exc)
  File "/usr/src/app/homeassistant/setup.py", line 57, in async_setup_component
    return (yield from task)
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 327, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
    future.result()
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 243, in result
    raise self._exception
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 180, in _step
    result = coro.send(None)
  File "/usr/src/app/homeassistant/setup.py", line 119, in _async_setup_component
    conf_util.async_process_component_config(hass, config, domain)
  File "/usr/src/app/homeassistant/config.py", line 624, in async_process_component_config
    platform = get_platform(domain, p_name)
  File "/usr/src/app/homeassistant/loader.py", line 104, in get_platform
    return get_component(PLATFORM_FORMAT.format(domain, platform))
  File "/usr/src/app/homeassistant/loader.py", line 142, in get_component
    module = importlib.import_module(path)
  File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 674, in exec_module
  File "<frozen importlib._bootstrap_external>", line 781, in get_code
  File "<frozen importlib._bootstrap_external>", line 741, in source_to_code
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/media_player/broadlink.py", line 7
    <!DOCTYPE html>
    ^
SyntaxError: invalid syntax```

Hi, so I just got appdeamon installed
Anyone mind explaining how do I properly add this to my configuration.yaml?
Especially for ‘/custom_components/media_player/broadlink.py’ & ‘/broadlink_media_codes’ directories.

So I got the tv component working, but I can’t quite get fan working. I’m getting ‘Unable to find component fan.broadlink’ error and I’m not quite sure how to fix this.

@monkey-house did you overwrite the whole media player folder or just the broadlink.py?

If just the broadlink.py it wont work. I tried that first but it doesnt overwrite the pycache file thats created (at least I think thats the problem). Delete the whole media player folder and copy the new one across. Thats worked for me anyway. Dont forget to restart home assistant again afterwards

@EGO01: got it working in the end. Noob mistake of not copying the raw code. @Vassilis was great in helping as alway. Works a treat now again!

that Thinking out side the Square :slight_smile: