First automation: Whats wrong?

Hi,

I checked many examples and the docs and built this:

automations.yaml

- alias: Fenster auf Wohnzimmer
  trigger:
    platform: state
    entity_id: binary_sensor.oeq1986163_state
    to: 'on' 
  action:
    - service: input_number.set_value
      data_template:
        entity_id: input_number.old_temp_wohnzimmer
        value: '{{ states.climate.wohnzimmer.attributes.temperature | float }}'
    - service: climate.set_temperature
      data:
        entity_id: climate.wohnzimmer
        temperature: '4.5'
- alias: Fenster zu Wohnzimmer
  trigger:
    platform: state
    entity_id: binary_sensor.oeq1986163_state
    to: 'off'
  action:
    service: climate.set_temperature
    data_template:
      entity_id: climate.wohnzimmer
      temperature: '{{ states.input_number.old_temp_wohnzimmer.state }}'

and the check says:

> Invalid config for [automation]: invalid template (TemplateSyntaxError: Encountered unknown tag ‘input_number’.) for dictionary value @ data[‘action’][0][‘data_template’][‘temperature’]. Got None. (See /config/configuration.yaml, line 14). Please check the docs at https://home-assistant.io/components/automation/

edit: It’s working now!

configuration.yaml:

input_number:
  old_temp_wohnzimmer:
    name: Wohnzimmer Temperatur vor Aktion
    min: 4.5
    max: 35
    step: 0.5
    mode: box

What am I doing wrong again?

     temperature: "{{ states('input_number.old_temp_wohnzimmer') }}"

or

     temperature: '{{ states.input_number.old_temp_wohnzimmer.state }}'
1 Like

That was a hit. Still not behaving right, mixed ‘on’ and ‘off’ up I think, will check that later :slight_smile:

Thank you!

See https://www.home-assistant.io/integrations/binary_sensor/#device-class

Typically for a window, ‘on’ means open and ‘off’ means closed.

1 Like

Cool, thank you.

Got it working, editing the correct code to the initial posting.

1 Like