Add Unit of Measurement to a Helper?

I created some helpers to essentially test and make some fake devices. For example a input_number for humidity:

So it seems trivial but I want to display the number a percent and it seems you have to set the ‘unit_of_measurement’ which form what I can see is only in YAML. So do I delete these helpers and manually add to my config file? Can you not add the ‘unit_of_measurement’ to the existing GUI helper via YAML?

Sure you can.


He doesn’t want to use the GUI. He wants to edit the helper in yaml

If you create the helper via gui you can set the unit via gui
If you create the helper via yaml you can set the unit via yaml or if you added a unique id as well via gui

You can add a unique ID for a helper via the GUI?

No. Helper created in yaml
Helper created via gui have automatically a unique id

Maybe it’s a translation issue but that was how your post read. I thought I missed a way.

sorry, I was walking and writing. not focused.

what I mean. If you create a helper via yaml, you can add a unique id. then you can adjust some details of this helper via the GUI.

Have you tried it?

Because it’s considered to be an invalid option and produces the following error message.

Configuration warnings

Invalid config for ‘input_number’ at configuration.yaml, line 317: ‘unique_id’ is an invalid option for ‘input_number’, check: input_number->test_number->unique_id

input_number:
  test_number:
    name: Test Number
    min: 0
    max: 50
    step: 1
    unique_id: test_number_abc12345

ah, it might not possible for all helpers. based on the documentation it’s not possible for input_number

Based on the documentation, none of the Input helpers support unique_id.

No.

  • If you create an Input Number via the UI, use the UI to add unit_of_measurement. The resulting entity’s configuration is stored in JSON format in a file within the hidden .storage directory.

  • If you create an Input Number via YAML, use YAML to add unit_of_measurement. The entity’s configuration is stored in YAML format in the configuration.yaml file within the visible config directory.

If you created the helper in YAML you can set the unit via the customize section.


Wow - missed lots of replies while away.

Still new to HA so perhaps I have this wrong. Here is my helper in the helper view and developer view. No way to add the unit.

So I tried adding this to the YAML in the developer view:


It worked yesterday. Came back today and this stetting was cleared (no %). I just applied it again and it’s back but after a restart it’s gone.

As you’ve seen in the other screenshot, it does exist. Why it doesn’t exist in your screenshot requires investigation. For starters, what is your version of Home Assistant ?

You can’t add it there. Whatever you add there isn’t permanent (as you have already discovered).

Ok - I think I figured it out:

homeassistant:
    customize:
        input_number.echo_sensor_master_humidity:
            unit_of_measurement: '%'
  • Core 2025.2.5
  • Supervisor 2025.02.4
  • Operating System 14.2
  • Frontend 20250221.0

Installed bare metal direct on a NUC.

No, if the Input Number’s configuration has been defined in YAML, in the configuration.yaml file, you simply add the unit_of_measurement to its configuration.

It is documented here.

On the other hand, if the Input Number was defined via the UI then, yes, it can be done like that but it should not be necessary. That option can be specified via the UI (on a properly functioning system).

I’m running 2025.2.1 and the option is visible in the UI. So, yeah, there may be a problem with your system.

You can start by refreshing the browser’s page (Ctrl-F5 or whatever key combo used by your browser) to ensure it’s not due to page-caching.

If that doesn’t fix it, then we’re at the ‘grasping at straws’ stage. For example, ensure your Home Assistant account has administrative privileges.

This is strange. I fired up Chrome to see if it’s a browser issue and no help. I am the only user and it’s admin.

That manual YAML seems to work for now until I figure this out.

In this particular case, consider it to be a band-aid because unit_of_measurement is an available option in the UI (just not for you for some reason).

It makes one wonder what else might be missing in your UI.