Cant use input_number on sun.sun elevation trigger (but conditions work)

Hi,

i’m currently in the process to optimize my automations to a point where i can adjust several values using the input_number integration. Therefore i created a bunch of entries in the input_number.yaml, included it in configuration.yaml.

When i try to use the “input_number.my_custom_entity” within a condition statement, every thing seems to be fine, i can also use them in the actions section. Now, if i want to make use of it in the triggers section, HA complains about

Message malformed: expected float for dictionary value @ data['below']

I`ve also tried to use

"{{ states('input_number.my_custom_entity') | float }}"

Checking the state of “input_number.my_custom_entity” via developer tools tells me, that the value set is float (4.0) when testing.

I dont really understand the different behavior when using the input_number.whatever entities in either of the sections in an automation.

Example Automation that works:

- id: '1600763867713'
  alias: test input
  description: ''
  trigger:
  - platform: state
    entity_id: binary_sensor.pir_room_1_pir
    to: 'on'
  condition:
  - condition: numeric_state
    entity_id: sun.sun
    attribute: elevation
    above: input_number.sun_elevation_end_daylight
  - condition: numeric_state
    entity_id: sun.sun
    attribute: elevation
    below: input_number.sun_elevation_start_daylight
  action:
  - service: light.turn_on
    data:
      brightness: '{{ states(''input_number.brightness_daylight'') | int }}'
      entity_id: light.wled
      kelvin: 3200
    entity_id: light.wled
  mode: single

Example Automation that DOES NOT work:

- id: '1600763867713'
  alias: test input
  description: ''
  trigger:
  - platform: state
    entity_id: binary_sensor.pir_room_1_pir
    to: 'on'
- plattform: numeric_state
    entity_id: sun.sun
    attribute: elevation
    above: input_number.sun_elevation_end_daylight # using: '{{ states(''input_number.sun_elevation_end_daylight') | int }}' or '{{ states(''input_number.sun_elevation_end_daylight') | float }}' doesnt work either 
  condition:
  - condition: numeric_state
    entity_id: sun.sun
    attribute: elevation
    above: input_number.sun_elevation_end_daylight
  - condition: numeric_state
    entity_id: sun.sun
    attribute: elevation
    below: input_number.sun_elevation_start_daylight
  action:
  - service: light.turn_on
    data:
      brightness: '{{ states(''input_number.brightness_daylight'') | int }}'
      entity_id: light.wled
      kelvin: 3200
    entity_id: light.wled
  mode: single

Is there something i missed here or where i was mislead by something? It seems to be impossible to make use of input_numbers within the trigger section?
It`s also strange that using this notation will disable/remove automations from HA with not really good information on what to look at. Error Messages just refer to the line in configuration.yaml where im including the automations.yaml…

Thanks in advance for any hints on how to solve that :slight_smile:

~Blade~

Input helpers can only be used in conditions and time triggers at this stage.

Not numeric state triggers. So you will have to use a template trigger.

Also your indentation for the numeric state trigger is way off.

Having said that I cant even get a numeric state condition to work directly with a sensor state:

Not working:

    conditions:
    - condition: numeric_state
      entity_id: sensor.cpu_temperature
      above: input_number.rack_fan_on_temp

Seems to only work with attributes.

Ah, Thanks Tom, maybe i over-read this in the docs… That at least explains why it doesn’t work :slight_smile:
The indentation was created by HA via GUI but maybe there were some copy&paste issues while writing this.

Do you know if there are plans to make automations work with input_numbers in numeric_state triggers in the future? I can surely live with a fixed setting for now since those values shall not be changed on a daily basis… I just don’t like to use “variables” (input_numbers so to speak) and static values at the same time, especially when those values belong together… so i will probably wont use them there. I will still go and checkout template triggers. Thanks for that^

Thanks again!
~Blade~

Me too.

Yes I believe the plan is to expand this for other triggers.