Dynamically created helpers

Is there a way to create/destroy a helper with script? I need to create a number of timer helpers via script.
Is there a service to call or there is another way ?

This seems like an XY Problem

No. Chances are, you don’t need helpers, you just need variables. Can you just explain what you’re trying to do?

1 Like

Some years ago, I did something similar with AppDaemon. At least at that time, AppDeamon was able to create entities during runtime. But: 1. I think this is more a hack than a clean solution and 2. I don’t know if this is still possible and will be possible in the future.
I also suggest that you describe the problem you want to solve, maybe we find another way.

I want to create plant wattering system. However it wont be watterong flowers rather vegetables. So I will have different plots which would require different timing for watterring. I need to have timers for each plot depending on the number of vegetable types. I.e. the number of plots is related to number of vegetable types.
That’s why i need a way to create helper through scripts.

1 Like

@peter_penchev did you find a solution?

FWIW, Pyscript: Python Scripting for Home Assistant — hacs-pyscript 1.4.0 documentation allows you to dynamically create and save persistent states.
See here: Persistent State

The example they give is


@state_trigger('binary_sensor.motion == "on"')
def turn_on_lights():
  pyscript.last_light_on = "light.overhead"

I use this to compute statistics on the fly, and then when you set the state of your new entity you can even set the attributes correctly, so for instance it triggers LTS: