Number: vs Globals:

I’ve been using Globals extensively in a project and came across the number: component (don’t know how I’d missed it).

Mostly, I use globals to store values from the HA front end that change with automations triggered from value changes in sensor components.

Other than shifting the automation part to the number:, what am I missing vs using globals?

I’m not quite seeing the differences/benefits the change could make.

Probably because it is very new. Only released in 1.20.0.

1 Like

I’m trying to use number:, as below, but get an error:

        number.set:  [source /config/esphome/feeder.yaml:456]
          id: current_time_in_minutes
          
          expected float.
          value: return ((id(on_board).now().minute) + (id(on_board).now().hour * 60))
time:
  - platform: ds1307
    update_interval: never
    id: on_board_time
      - number.set:
          id: current_time_in_minutes
          value: 'return ((id(on_board).now().minute) + (id(on_board).now().hour * 60)) '

I’ve tried it several ways with similar results. I suspect that this is due to minute and hour being of type int. Or maybe even str.

The docs seem to indicate that number: can only be of type float.

Is there a way around this?