Show TV state in HA possible?

Hi,

I could not find any how to show if the TV is on or off. I can see it in the log that the tv is on/off and also in the developer menu. Now If possible can i put the state of the tv device on the webUI? I have two samsung tv which i control through boradlink rm.

Thanks!

With device tracker like ping nmap or Bluetooth. Then u could create template sensor to change home to online and not_home to offline

1 Like

Hi @pronsta

Can you please tell me as to how you have managed to control your Samsung TVs viaa Broadlink RM?

Thanks.

u must put your broadlink into learn mode like this :

put button on the remote and braodlink will add it to its library… a command or automation could look like this:

The code will also been printed into persistant message in frontend or hass logs

..........
    action:
      - service: broadlink.send_packet_192_168_1_10 # Turn on (resume)
        data:
          packet:
            - 'JgBWAmw4DCkMEQwRDBAMEQwRDBAMEQwRDBELEQwRDCoLEQwRDBEMEAwRDBEMEAwRDBEMEAwRDBEMEQsRDBEMEQwQDCoMEQwpDCoMKgwpDCoMKgwQDCoMKgwqDCkMKgwqDCkMKgwqDBAMEQwRDBAMEQwRDBAMEQwRDBEMKQwqDBEMEAwqDCoMKQwqDBELEQwqDCoMEQsRDBEMKgwQDBEMKgwQDBEMKgwpDBEMKgwqCxEMKgwqDBAMKgwqDBAMEQwqDBAMEQwRDBEMEAwqDCoMEAwqDCoMKQwRDBEMEAwRDBEMEAwRDCoMKgwpDCoMKgwpDCoMKgwQDBEMEQwRCxEMEQwRCxEMEQwqCyoMKgwqDCkMKgwqDCoMEAwRDBEMEAsSDBEMEAwRDCoMKQwqDCoMKQwqDCoMKgwQDBEMEQsRDBELEgwQDBEMKgwpDCoMKgwpDCoMKgwqDBAMEQsSDBAMEQwRDBAMEQwqDCkNKQwqDCoMKQwqDCoMEAwRCxIMEAwRDBEMEAwRDCoMKgwpDCoMKgwpDCoMKgwQDCoMKgwRCxEMEQwpDBEMKgwRDBAMKgwqDCkMEQwqDCkMEQwRDBELKgwqDCoLKgwRDCoMKQwqDBEMEAwRDBEMEQwQDBEMEQwQDBEMEQwQDCoMKgwpDCoMKgwpDCoMKgwRDBAMEQwRDBAMEQwRDBAMKgwqDCkMKgwqDCoLKgwqDBEMEAwRDBEMEAwRDBEMEQsqDCoMKgwpDCoMKgwpDCoMKgwpDBEMEQwQDBEMEQwRDBAMEQwqDCkMKgwqDCkMKgwADQUMKg=='
- platform: broadlink
  name: "Broadlink RM"
  host: IP
  mac: 'XX:XX:XX:XX:XX:XX'
  type: rm2_pro_plus
  switches:
     tv_br:
      friendly_name: tv_br
      command_on: 'JgCMAJaTFDYUNhQ2FBEUERQRFBEUERQ2FDYUNhQRFBEUERQRFBEUERQ2FBEUERQRFBEUERQRFDYUERQ2FDYUNhQ2FDYUNhQABgeXkxQ2FDYUNhQRFBEUERQRFBEUNhQ2FDYUERQRFBEUERQRFBEUNRQSExITEhMSExITEhM2FBEUNhQ2FDYUNhQ2FDYUAA0FAAAAAAAAAAAAAAAA'
      command_off: 'JgCMAJeTFDYUNhQ2FBEUERQRFBEUERQ2FDYUNhQRFBEUERQRFBEUERQ2FBEUERQRFBEUERQRFDYUERQ2FDYUNhM2FDYUNhQABgeYkxQ1FDYUNhQRFBEUERQRFBEUNhQ2FDYUERQRFBEUERQRFBEUNhQRFBEUERQRFBEUERQ2FBEUNhQ2FDYUNhQ2FDYUAA0FAAAAAAAAAAAAAAAA'

This is the IR code for on and off which i used.

@pronsta @thundergreen how do I get more than one command? Say a channel 150?

this u wont… which tv do u have… is there a component for it ?

I have a Samsung TV but the component doesn’t work at all.

this is not really helpful. what u mean exactly?

from WHEN is your TV`Show me your config und your log output please . Then i am able and willed to help

You asked my TV brand which is Samsung and if there is a component for it? There is a component for the Samsung TV but it doesn’t work with my Home Assistant.

is your TV in those list:

No its not

Thzen u cant use those component and u wont be able to change channel to a specific number. U can just use hass like with your remote control. U might be able to make a scene with following codel for the number on your remote . but thats all. just record ALL needed button to hass and build an automation with a scene .

Its still possible his TV can work even if its not in the list, but without any error messages or anything we can’t really help you @bachoo786. Can’t just guess what the problem is.

@bachoo786 like @thundergreen said the only way to do it is to create a custom automation scene with HA so you have to capture the code for 1,5,0 of your remote if you want the channel so you Broadlink RM can imitate those command you when fire it up in HA.

Now If possible can i put the state of the tv device on the webUI?

@stunts1337 this is my log for my media player i.e. Samsung TV:

17-03-27 18:53:39 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
17-03-27 18:53:50 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
17-03-27 18:54:01 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10
17-03-27 18:54:12 WARNING (MainThread) [homeassistant.components.media_player] Updating samsungtv media_player took longer than the scheduled update interval 0:00:10

The above is repeats continuously for 10 seconds.

My config is:

media_player:
  - platform: samsungtv
    host: 192.168.0.12
    port: 55000

and if I run : samsungctl --host 192.168.0.12 --port 55000 KEY_MUTE --method websocket

I get this error:

Traceback (most recent call last):
  File "/usr/local/bin/samsungctl", line 11, in <module>
    load_entry_point('samsungctl===0.6.0-git', 'console_scripts', 'samsungctl')()
  File "build/bdist.linux-armv7l/egg/samsungctl/__main__.py", line 93, in main
  File "build/bdist.linux-armv7l/egg/samsungctl/__main__.py", line 37, in _read_config
NameError: global name 'FileNotFoundError' is not defined

Surprisingly I have another raspberry pi running openhab2 and it can control my Samsung TV well on port 55000. This means there are either some files not installed my pi running HA or HA cannot work with my TV.

@pronsta and @thundergreen have you got a sample code or guide me please to set the custom automation scene up?

1 Like

it seems that u need someting like samsungctl which is not installes btw… i think it is setup differently in hass