Make Helpers more "Object Oriented" (wrap multiple helpers in a container)

My helpers are getting out of control and the only way to (sort of) manage this is with a strict naming convention. Many times I have to create multiple helpers to around one feature I am working on so was thinking about a wrapper helper to compartmentalize this. For example, was just working on an alarm clock feature for my google nest so the wrapper would be bedroom_alarm and the helper fields would be bedroom_alarm.ontime, bedroom_alarm.offtime, bedroom_alarm.radiostationurl, bedroom_alarm.onofftoggle etc.

This could probably be implemented in a nonbreaking manner - existing helpers would have a null wrapper (container) and new helpers could be optionally assigned to a container wrapper.

Similar issues have been raised with automations and the same concept could be applied to both although automations would be mostly just an organizational feature.

Most of the times you can manage with just one helper if you save the values comma separated in a text helper.

But regarding the WTH, I’m not sure I understand how exactly the entities would be named and accessed using your proposed system.

naming would follow via the wrappername.helper (bedroom_alarm above). The main helper screen would show a list of wrappers that can be expanded to show all of the helpers for that wrapper

bedroom_alarm:
>ontime input_datetime.ontime Date and/or time
>offtime input_datetime.offtime Date and/or time
>onofftoggle input_boolean.onofftoggle Toggle
next_wrapper:

get the ontime via bedroom_alarm.ontime

To make it truly object oriented you could also attach scripts to a helper object (wrapper)
i.e. bedroom_alarm.dosomething

Almost all of my helpers are groupings of helpers describing the various states and its a bit untenable to manage this as one big linear list.

You’re basically describing template sensors with attributes. (already exists)

Or adding helpers to devices. (Already existing WTH)

This is an example of something where I had to create a lot of helpers:

Like @KevinE said, it gets messy really fast. Any way to group them together by intended purpose, mostly to keep track of them, would be great. Incidentally, I just created another WTH where I was suggesting for some way to keep track of orphaned helpers (created but not, or no longer, used). If there were a way to bundle them together, when you get rid of some automation, you can easily go delete all related helpers too.

I wonder whether Watchman can do it…

2 Likes

I think the labelling of entities (tagging) which also applies to organising automations would be the solution.

I totally with @aruffell on this subject. In my house I have a rather advanced temperature automation setup to minimize power usage and maximize comfort. To make this work I needed to create many hundreds of helper entities to hold all the settings. I was able to manage this using a thight naming scheme, but with this amount of helpers it’s quite hard to find all the other helpers in between.