So I can confirm that HA is connected to the Broadlink - I am able to learn new IR commands via the HA web console. and I can switch my Samsung TV and Onkyo Receiver components on and off using the HA web console. It’s just the script that won’t execute.
???
The script code is now correct so it should be working. Can you check by tailing the home-assistant.log while you click the toggle for the watch_humax script? Any error messages kicked out will tell us where to go next.
AFAIK, the toggle for the script will always jump back to off after the script completes so that it’s ready to fire again. I think a toggle is used because you could interrupt the script execution if you needed to.
Nothing got added to the log when I clicked the toggle for the watch_humax script. The last entries from the log (from 5 minutes before I tried it) are below:
2018-01-09 13:49:45 WARNING (Thread-7) [pychromecast.socket_client] Heartbeat timeout, resetting connection
2018-01-09 13:49:52 WARNING (Thread-8) [pychromecast.socket_client] Heartbeat timeout, resetting connection
2018-01-09 13:49:52 WARNING (Thread-9) [pychromecast.socket_client] Heartbeat timeout, resetting connection
2018-01-09 13:50:00 WARNING (Thread-12) [pychromecast.socket_client] Heartbeat timeout, resetting connection
2018-01-09 13:50:00 WARNING (Thread-11) [pychromecast.socket_client] Heartbeat timeout, resetting connection
2018-01-09 13:50:00 WARNING (Thread-10) [pychromecast.socket_client] Heartbeat timeout, resetting connection
2018-01-09 13:50:15 ERROR (Thread-7) [pychromecast.socket_client] Failed to connect, retrying in 5.0s
2018-01-09 13:50:22 ERROR (Thread-8) [pychromecast.socket_client] Failed to connect, retrying in 5.0s
2018-01-09 13:50:22 ERROR (Thread-9) [pychromecast.socket_client] Failed to connect, retrying in 5.0s
2018-01-09 13:50:54 WARNING (Thread-7) [pychromecast.socket_client] Heartbeat timeout, resetting connection
Just to tie up the loose end on this thread - following your suggestion on my other thread. The entity_id’s are inconsistent between the States page of the HA web console and my yaml files. The script can now be executed if I change the entity_id’s in scripts.yaml to match those of the HA web GUI. But I’m confused as hell as to where the web GUI derives these names? How did receiver_onkyo in my configuration.yaml become onkyo_receiver in the HA web console?
scripts.yaml:
watch_humax:
alias: Watch Humax
sequence:
- service: switch.turn_on
data:
entity_id: switch.tv_samsung
- delay:
seconds: 4
- service: switch.turn_on
data:
entity_id: switch.receiver_onkyo
'''
configuration.yaml:
switch:
- platform: broadlink
host: 192.168.1.87
mac: ‘34:EA:34:C7:87:FA’
switches:
tv_samsung:
friendly_name: “Samsung TV”
command_on: ‘JgDSAJaSFjUWNRc1FhETExYRFREWERU2FTYUNxQTFhETExYRExMWNRcQExMWNRc1FhAWERY1FhAXNBc1FhEVERY1FjUXEBUABjeTlRY1FTcTNxQTFhETExYRExMWNRc1FjUWEBYRFhAUExYREzgWEBcQFDcWNRYRFhAWNRcQFjYVNhMTFhETOBQ3FBMWAAY0lpMWNRY1FzQXEBQSFxETExYQFDgTNxc1FhAXEBYRFhAWERY1FhAWERY1FjUVEhYRFTYVERY1FzQXERMTFjUWNRcPFwANBQAAAAAAAA==’
command_off: ‘JgBGAJaSFjUXNRY1FhETExYRExMWERU2FDcUNxQTFhETExYRExMWERMTFhEUNxQ3FBMVEhM3FTcXNRY1FhETExY1FzUWERMADQUAAA==’
receiver_onkyo:
friendly_name: “Onkyo Receiver”
command_on: ‘JgBgAAABHJETExM2FRMTExM3ExMTNxM2FDUTFRM2EzYTFRM2EzYVExMTExQSNxMUExQTExMUFBMTNhM3ExQTNxM2EzYTNxM2EwAEywABHkgVAAvXAAEeSRQAC9gAAR5IEwANBQAAAAAAAAAA==’
command_off: ‘JgBgAAABHJEUEhQ1FRITExU1FBIVNRM2ExMUExM2FTUTExU0EzcVERU1EzYUNhQSFBIUExU0FRITExMUExMTNhM3FDUVEhM2EwAE7gABHUkTAAvZAAEdSRUAC9gAARxKEgANBQAAAAAAAAAA==’
customize.yaml:
script.watch_humax:
google_assistant: true
switch.tv_samsung:
google_assistant: true
switch.receiver_onkyo:
google_assistant: true
HA web consoles States page:
switch.samsung_tv
switch.onkyo_receiver
Well the easy explanation (I’ve not looked at the code) is that the entity_ids are being created by slugifying the friendly names you have given the switches (ie onkyo_receiver, samsung_tv), not the “title” of each switch section in config.yaml (ie receiver_onkyo, tv_samsung). It at least applies in the cases of the two examples you’ve given.
Yes that does seem to explain it. It seems counter intuitive to me, as the phrase “friendly name” to me implies something that would be used for display-only purposes, rather than as a key in commands.
Thank you so much for all of your help, by the way. I’ve really struggled to find the guidance that I need from the documentation on the website, and I think I would have given up by now had it not been for the assistance that I’ve been given here!
No problem! Glad I could help. HA is very powerful but does have a steep learning curve. I stuck with it in the beginning and have been very very happy I did. Keep at it!