Open raedkit opened 1 month ago
I took a look into this. My finding was that this issue only occurs in case you have a script that is later renamed. As a result the entity_id of the script could be different to the service that is related, Alarmo is unable to find it back. I made some changes to improve this (https://github.com/nielsfaber/alarmo/commit/b454170b560e34bf4f126891dc41d0dadc743f89), I will let you know when this is released.
As I have the same issue, I researched this and it seems to bee a core issue: https://github.com/home-assistant/core/issues/115334
The change you've made in https://github.com/nielsfaber/alarmo/commit/b454170b560e34bf4f126891dc41d0dadc743f89 is a breaking change, as it changes the behaviour of how the scripts are started, if more than one is defined: https://www.home-assistant.io/integrations/script/#waiting-for-script-to-complete
But there is a workaround to fix you scripts service name: https://github.com/home-assistant/core/issues/115334#issuecomment-2058981668
@DJaeger Thanks for your comment, I'm glad that you pointed out this is a core issue (which hopefully will get some attention soon).
The change you've made in https://github.com/nielsfaber/alarmo/commit/b454170b560e34bf4f126891dc41d0dadc743f89 is a breaking change, as it changes the behaviour of how the scripts are started, if more than one is defined:
I don't quite follow your point here.
For a script having entity script.my_new_entity_name
and related service script.my_original_entity_name
, before the change Alarmo would create yaml config for the service call as such:
service: script.my_new_entity_name
entity_id: script.my_new_entity_name
data: {}
and after the change:
service: script.my_original_entity_name
entity_id: script.my_original_entity_name
data: {}
Effectively, Alarmo no longer looks at the entity list to find scripts (and their IDs) but takes them from the service list. Technically both are wrong, in the old code the wrong service would be called, in the new code the wrong entity_id will be passed. But I couldn't find a way to find the matching entity_id for a given service. It seems that passing the entity_id when calling a script is optional and doesn't have any effect.
@raedkit The fix is now included in release v1.10.2, please update to the latest version and test if it works OK for you now. You can close the issue if so, otherwise please let me know.
@nielsfaber Your're right, I overlooked an exclamation mark and misunderstood it, sorry.
The entity_id seems to be required only when using e.g. script.turn_on
@raedkit The fix is now included in release v1.10.2, please update to the latest version and test if it works OK for you now. You can close the issue if so, otherwise please let me know.
Thank you for the fix. I will test it this weekend and will let you know.
Alarmo Version
v1.10.1
HA Version
2024.5.3
Bug description
On this version of Alarmo I'm unable to add any script on actions for when alarmo is triggered. I have always an error : required key 'service' is missing even if it really exists the YAML
Steps to reproduce
Relevant log output
No response