Input Boolean - Initial Value

Searched the forum but no clear answer.

When I create an input boolean via helpers, how can I set the initial value to “on”? Like documented here:

I tried to “customize” the boolean and add:
image
But after restart of home assitant it is off. Also customising with “on” doesn’t do it.

What is the correct way and where to do this in a boolean helper?

You want initial: off or initial: on. Like this sample. Whenever HA restarts, it will be in the off position when back online.

input_boolean.yaml

  child_mode:
    name: Child Mode
    icon: mdi:account-key
    initial: off

Thanks. I have a lot of helpers but no input_boolean.yaml file? Where is it?

If you haven’t split your config then it’s the configuration.yaml

1 Like

In your configuration.yaml file create your input boolean like so

input_boolean:
  child_mode:
    name: Child Mode
    icon: mdi:account-key
    initial: off

Reload the input_boolean by going to configuration->server controls-> click on INPUT BOOLEANS or restart HA.

In the developer Tools-> states, Look for

input_boolean.child_mode

Thanks both. Yes I am aware of making input booleans manual via yaml. I did so before migrating to “helpers”. Because manually created entities I could not edit in helpers.

My question was about how te set initial for a helper created boolean… but reading @Hellis81 's lin I see I am not alone asking that. I opvoted the request… so simpe to have a tickbox in the UI I think :slight_smile:

1 Like

Agree. And perhaps a good idea.
A box you tick saying “initial value. I have read and understood the docs what this means”
That kind of makes it obvious it’s not something you just tick.

That is absolutly essential.
I migrated all my input_boolean from yaml to helpers and the initial value is missing.
My proposal:

Initial value : 〇 on ⦿ off

P.S.: Same for input_number, initial value is missing. And probably some others.

2 Likes

Indeed, it would be lovely to have the initial value available from the UI, even despite the state persisting across restarts.

1 Like

Couldn’t find an option to configure helper default value through the GUI, so I guess this is still an issue.

Couldn’t be that difficult to sort out.

That is why I never do it for helpers and automations…

I agree, having tons of helpers make it very difficult to maintain the code whereas organizing it in packages in various code units makes it much easier to maintain. Same with automations where when things get repetitive yet is more efficient to factorize the code

Are we still unable to set an input_boolean’s initial value? I couldn’t find it in the GUI. Anyone know any workarounds? Should I delete the helper and recreate it in my config.yaml?

Do not use UI for helpers.

So delete from UI then add in YAML, correct?

If UI way does not provide smth which is provided by YAML way - then using YAML seems to be right.

1 Like