Hello together,
I currently have a use case where I’d like to use inheritance with automations, like it is used in OOP Programming.
This would allow you to have an elegant way for having an “main” Automation including all the magic, and extending the main automation for a specific use case as needed by overwriting parameters.
An example:
- id: 'cover_sunprotection'
attributes:
id: None
percentage: 50
trigger:
- event: sunset
platform: sun
action:
- condition: state
entity_id: input_boolean.some_button
state: 'on'
- device_id: {{attributes.id}}
domain: cover
position: {{attributes.percentage}}
type: set_position
- id: 'cover_sunprotection_room1'
extends: 'cover_sunprotection'
attributes:
id: some_id
- id: 'cover_sunprotection_room2'
extends: 'cover_sunprotection'
attributes:
id: some_other_id
percentage: 33
The extension of triggers/actions itself would be great too, but I’m not sure how to describe this in pure yaml (except overwriting the whole array).
All the templating could be rendered once on startup, so that the complete automation objects are available at runtime. An example could be the templating of Saltstack (https://docs.saltstack.com/en/master/topics/tutorials/states_pt3.html), which not only allows templating for the payload, but also in the “job definition” itself.
One of the main advantages would be the simplification of the configuration, no redundancy is needed.
As far as I understand, that kind of use case is not yet possible with templating.
Best regards
margau