I have a script “script.1582368367278”. I can call it from Developer/Services (just run “script.1582368367278” as the service) or as a button in Lovelace and it executes properly.
However, this doesn’t work when called from an automation. It just doesn’t execute. I call it the same way in the automation - action type: call service & service: script.1582368367278
This is the automation:
- id: '1583341040653'
alias: Leaving home Xiaomi
description: ''
trigger:
- entity_id: sensor.xiaomi_button_2_click
platform: state
to: double
condition: []
action:
- data: {}
service: script.1582368367278
This is in the log: Unable to find referenced entities automation.leaving_home_xiaomi
I don’t understand this as I’m only picking the entity (script.1582368367278) from the drop down. The id number is correct.
No, that’s not it. I have an another automation for the same button with “single” without any quotes and it works properly.
When I manually trigger the automation in question, nothing happens. Also, when I call the script via script.turn_on with entity_id of the script, nothing happens as well. The method is fine as I can use it with other scripts.
I just nuked the original automation and re-created it. I did it the exact same way as the original and it works. It’s probably a glitch in matrix somewhere.
See if you spot any difference to the original code, I don’t:
- id: '1584482640624'
alias: Leave home Xiaomi
description: ''
trigger:
- entity_id: sensor.xiaomi_button_2_click
platform: state
to: double
condition: []
action:
- data: {}
service: script.1582368367278
The error message was Unable to find referenced entities followed by each of the entity in the script, which is clearly a bug because all of them are live, working and correct. I didn’t modify the script st all and it works fine with the new automation.
Have been here already
Was banging my head… and at last found 2 ways for fixing not working automations created from UI.
First was to delete and recreate from scratch- OK, another was via automations.yaml- after tinkering via UI some lines were misplaced- go figure…
Best, JR