How can i create a object with logic inside

Hello
I was looking for a way to create some logic inside HA. But I can’t find what I was looking for. Is there a way to program an object, with in the object some logic like if statement, state diagram and timers? This object communicates with some input and output with HA. Now I can do things with automations and helpers, but I don’t want to create every time al the timers and automations. I need this logic more than 1 time, this is not only a lot of work but also an mess after some time.

Kind Regards

Maybe templates?

You can also use scripts as repeatable chunks of code to be called by automations.

If you set up the same combination of logic between sets of devices over and over, you can consolidate them into blueprints which work for both automations and scripts.

The only “object” in Home Assistant that fits that description is an automation. A Trigger-based Template Sensor shares some of the characteristics of an automation but is meant for rendering a value.

A blueprint allows you to create multiple instances of the same automation but each instance can reference different entities. However, the referenced entities must already exist and cannot be created by the blueprint. So if the automation blueprint references a timer entity, it must already exist because it can’t be created by the blueprint.

It would be helpful to see an example of what you have created that you now wish to create easily create multiple instances of it.

The blueprint helps me already for the multiplication of my logic. What not yet clear is for me is the use of timers. How do I setup the timer that I can multiplicate the blueprint without interfering with other “the same” blueprints?

If your blueprint is used to create five automations, each automation needs to reference a different timer entity (so you need five timer entities).

Yes I know, but I need to create the timers manually in the helpers tab? It is not possible to create the timers “on the fly” in my blueprints?

I already explained that is not possible (twice) in my previous post: