Configuration.yaml: invalid key:

Hi
Why I’m having this error?

Configuration errors
Error loading /config/configuration.yaml: invalid key: “{“state(‘sensor.openweathermap_temperature’)”: None}”
in “/config/automations.yaml”, line 156, column 0

- id: "1703084612030"
  alias: "Rega: Check Maximum Temperature when Temperature Changes"
  description: "Rega: Check Maximum Temperature when Temperature Changes"
  trigger:
    - platform: state
      entity_id:
        - sensor.openweathermap_temperature
  condition:
    - condition: state
      entity_id: sensor.rega_current_temperature_is_higher
      state: "true"
  action:
    service: input_number.set_value
    data_template:
      value: { { state('sensor.openweathermap_temperature') } }
      entity_id: input_number.rega_maximum_temperature_measured
  mode: single

Try “states” rather than “state”:

action:
    service: input_number.set_value
    data_template:
      value: { { states('sensor.openweathermap_temperature') } }
      entity_id: input_number.rega_maximum_temperature_measured

yeah…already tried, and getting the same error

The template is invalid.

Here’s how to correct it:

  action:
    service: input_number.set_value
    data_template:
      value: "{{ states('sensor.openweathermap_temperature') }}"
      entity_id: input_number.rega_maximum_temperature_measured

I suggest you consider switching to the modern way of specifying the data and targeted entity.

  action:
    - service: input_number.set_value
      data:
        value: "{{ states('sensor.openweathermap_temperature') }}"
      target: 
        entity_id: input_number.rega_maximum_temperature_measured
1 Like