#Right way for small repeating logic

1 messages · Page 1 of 1 (latest)

proud geode
#

I would like to have logic called "anyone in home?" etc. and call / read it from automations. What is the right approach?

If I want to make change in logic I want to make the change in 1 place wit effect on all automations.

What is the right approach in HA?

By intuition I would use saved templates, but something like this doesn't exist. Scripts don't return values. BluePrint is pain in the .....

Should I make automation which as a result will change my custom entity? This is the only solution which come into my mind.

stiff leaf
#

Scripts can return values

#

Usually, a template sensor or input_boolean

#

I don't know what a 'saved template' is in your description

proud geode
#

oh so google mislead me about scripts

#

so... Script is the answer?

#

script "Anyone in home?" and call it from N automations?

#

Can it return more, than true / false? Custom value?

orchid dagger
#

You can also check if the zone called home has a value of more than 0...

proud geode
#

my logic is more complex

#

with delays, multiple conditions

orchid dagger
#

Sounds like it's working well for you.