Having issues with conditions - numeric.state sun.sun elevation

I’m trying to set up an automation that only triggers when certain conditions are fulfilled:

  • the sun is at a certain elevation (above 25 degrees), and
  • the weather is either sunny or partly cloudy.

I’m getting an error saying “Invalid config for [automation]: Unexpected value for condition: ‘numeric.state’.”

I’ve isolated it to the first condition (the sun’s elevation).

Any help appreciated. Thanks!

  condition: 
  - condition: numeric.state
    entity_id: sun.sun
    attribute: elevation
    above: '25.0'
  - condition: or
    conditions:
    - condition: state
      entity_id: weather.home
      state: partlycloudy
    - condition: state
      entity_id: weather.home
      state: sunny

You had numeric.state but it should be numeric_state

  condition: 
  - condition: numeric_state
    entity_id: sun.sun
    attribute: elevation
    above: '25.0'
  - condition: or
    conditions:
    - condition: state
      entity_id: weather.home
      state: partlycloudy
    - condition: state
      entity_id: weather.home
      state: sunny

If you wish, it can also be expressed like this:

  condition: 
  - "{{ state_attr('sun.sun, 'elevation') > 25 }}"
  - "{{ states('weather.home') in ['partlycloudy', 'sunny'] }}"
1 Like

Thank you!

1 Like