Unit of Measurement for Number Component on HA dashboard

Long time lurker on the forums for help, first time posting looking for advice!

I have a pretty good background in programming with embedded C, so when my journey with HA started I felt pretty confident with tackling a new coding language. I think I’m doing okay! But still have lots of questions and lots to learn.

Anyway, I’m currently building my own retic controller using an ESP32 and ESPHome, utilising the sprinkler component.

After a day or so I’m slowly getting the hang of writing the code (chatGPT can help too! Though its often not entirely correct lol). Becuase my retic controller cannot be reliant on a consistent connection to my HA server, I am making it self-sufficient, using a HA dashboard just to configure the controller and monitor what its doing.

The issue I’m having is with my number component. I am using it to adjust the durations of the zones. I want it to be in minutes, so I use unit_of_measurement: 'min'. However, these entities are showing up as seconds on HA and I cannot for the life of me work out what I’m doing wrong. Can anyone help me with this? Surely there is something I can add to the ESP code rather than having to do it on the HA side?

Here is the number code for one of the zones.

# Numbers configuration
number:

  # Sprinkler zone numbers

  # Zone 1
  - platform: template
    id: zone_1_run_duration
    name: "Zone 1 Run Duration"
    icon: "mdi:timer-outline"
    initial_value: 1
    min_value: 1
    max_value: 120
    step: 1
    unit_of_measurement: 'min'
    restore_value: true
    set_action:
      - sprinkler.set_valve_run_duration:
          id: ${id_prefix}_sprinklers
          valve_number: 0
          run_duration: !lambda 'return x;'  

The sprinkler component (with this zone) is below:

# Sprinkler Setup  
sprinkler:
  - id: ${id_prefix}_sprinklers # Component ID
    main_switch: "${name_prefix} Main Switch" # The name for the sprinkler controller’s main switch as it will appear in the front end
    auto_advance_switch: "${name_prefix} Auto Advance Switch" # The name for the sprinkler controller’s “auto-advance” switch as it will appear in the front end.
    valve_overlap: 5s # Amount of time two zones are open between a transition to reduce banging
    pump_start_pump_delay: 5s # The delay in seconds from when a distribution valve is opened to when the associated pump is activated. 

    # Configure the valves
    valves:
      - valve_switch: "Zone 1 Switch"
        enable_switch: "Zone 1 Auto"
        run_duration_number: zone_1_run_duration
        valve_switch_id: ${id_prefix}_valve_sw1
        pump_switch_id: ${id_prefix}_pump_sw

This is how it shows up on HA

Have you tried changing the unit of measurement in the HA entity?

Look under Settings | Devices & services | Entities

Bear with me as I’m still on my learners with HA. I did have a look at this and it appears that isn’t an option for these entities

1 Like