Scripts Not Working

G’day folks,

I did a fresh install of Hassio using the installer. I copied across all of my old .yaml files, everything seems to be working fine except nothing in my scripts.yaml works. They are all scripts that I was using to send IR codes from my broadlink device to my TV. The switches I have to turn my TV on/off in my switches.yaml work fine, but the scripts for changing channels and sources in the scripts.yaml don’t.

Here is an example of a script in my scripts.yaml which doesn’t work.

dtv:
  alias: Digital TV
  sequence:
    - service: switch.broadlink_send_packet_192_168_1_111
      data:
        packet: "JgBGAJSTEjgSOBI4EhMSExITEhMSExI4EjgSNxMTEhQRFBEUERQRORE4EhQSExITEhMSOBITEhMSExI4EjgSOBI4EhMSOBIADQUAAA=="

When I execute it, it spits the following error in my log.

Error executing service <ServiceCall script.dtv (c:347ba2115a364177a4c05d8d7ec34230)>
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/homeassistant/core.py”, line 1147, in _safe_execute
await self._execute_service(handler, service_call)
File “/usr/local/lib/python3.7/site-packages/homeassistant/core.py”, line 1160, in _execute_service
await handler.func(service_call)
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/script/init.py”, line 114, in service_handler
context=service.context)
File “/usr/local/lib/python3.7/site-packages/homeassistant/components/script/init.py”, line 172, in async_turn_on
kwargs.get(ATTR_VARIABLES), context)
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/script.py”, line 131, in async_run
await self._handle_action(action, variables, context)
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/script.py”, line 210, in _handle_action
action, variables, context)
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/script.py”, line 299, in _async_call_service
context=context
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py”, line 89, in async_call_from_config
domain, service_name, service_data, blocking=blocking, context=context)
File “/usr/local/lib/python3.7/site-packages/homeassistant/core.py”, line 1115, in async_call
raise ServiceNotFound(domain, service) from None
homeassistant.exceptions.ServiceNotFound: (ServiceNotFound(…), ‘Service switch.broadlink_send_packet_192_168_1_111 not found’)

In my configuration.yaml i have scripts set to

script: !include scripts.yaml

I have no idea what else to do, on my old setup before I reformatted it was working perfectly with these settings.

The configuration of the Broadlink component has changed (in version 0.92).

In addition, the service name has changed to broadlink.send.

1 Like

Oh wow…that easy! Thank you so much mate, it was driving me insane!

It’s been my experience that when the python interpreter barfs out a long trail of messages, the key is to focus on the last line in the ejecta list:
(ServiceNotFound(…), ‘Service switch.broadlink_send_packet_192_168_1_111 not found’)

The entire service was ‘not found’ which is a fairly significant problem. The hint is that you just changed to a new version of Home Assistant so it implies the component (Broadlink) must’ve been subjected to a major structural modification.

Of course, hindsight always makes things seem clearer. :slight_smile:

2 Likes