Add a Default Value option to Input Text helper

The input_text helper currently has an initial option which resets the field to the initial value every time HA restarts. I think it would be advantageous for users to also have a “default” option which does not reset the field and instead functions as sort of a placeholder when the field is empty.

Currently any input_text field that has never received any input shows a state of unknown. However, I think it would be valuable to have control over that and be able to choose an initial default state and have it display something other than unknown. It would be similar to the initial option but it would not reset the field when HA restarts. Instead it would only show the default value when the user hasn’t entered anything into the field. An option to display the default state when everything has been deleted from the field could also be added but I personally wouldn’t want this to happen automatically.

A working example of this would be one of the ways I use the state of several input_text helpers to control the label attribute of the custom:tabbed-card. I use the custom:decluttering-card for different instances to pass a variable to signal which group of input_text helpers should be used to label that instance of the custom:tabbed-card. Then instead of having to change the yaml, I click a button which brings up a pop-up and I just change the input_text field which in turn changes the tab label.

What I would like to do is create a default value for the input_text helpers that I do not enter a value for (or maybe that I delete the value for and leave blank). The initial option does that, however, if I enter a value into the input_text field and then restart HA it will change back to the initial value which I don’t want it to do. The solution would be to add an option to choose a default value or an option not to have the initial value override an entered value when HA restarts.

I know I could use a template to achieve this but that means I would have to create a separate template sensor for each instance which is a lot to do just to achieve this. I think adding the option as a new feature would make more sense.

Why not just make an automation to set it to the default on startup?

I guess the same reason as not using a template… to avoid doing all of that extra coding. It would kind of be the same as creating templates. I would have to make an automation for all of the input_text helpers I use. Well actually it would be one automation but with a bunch pf choose or if-then statements inside of it.

1 Like

The more I think about it, I can see an advantage of not ever seeing “Unavailable”. So, I’ll add a vote for this request.

1 Like