Simple automation problem

Can anyone help me as to why this code isn’t working:

  - alias: "Bed 2 heater on"
    hide_entity: False
    trigger:
    - platform: numeric_state
      entity_id: sensor.desk_temperature
      value_template: '{{ states.sensor.desk_temperature.state }}'
      below: 19
    condition:
      condition: and
      conditions:
        - condition: state
          entity_id: 'input_boolean.notify_home'
          state: 'on'
    action:
      service: switch.turn_on
      entity_id: switch.heater_bed_2

  - alias: "Bed 2 heater off"
    hide_entity: False
    trigger:
    - platform: numeric_state
      entity_id: sensor.desk_temperature
      value_template: '{{ states.sensor.desk_temperature.state }}'
      above: 19
    condition:
      condition: and
      conditions:
        - condition: state
          entity_id: 'input_boolean.notify_home'
          state: 'on'
    action:
      service: switch.turn_off
      entity_id: switch.heater_bed_2

No errors, just no result, nothing happens?

regards

When not using a list platform needs to be indented two spaces from trigger.

trigger:
  platform:

As you are not using a list of triggers I would drop the hyphen but keep your current alignment. You also don’t have multiple conditions so you don’t need to use the and function.

  - alias: "Bed 2 heater on"
    hide_entity: False
    trigger:
      platform: numeric_state
      entity_id: sensor.desk_temperature
      value_template: '{{ states.sensor.desk_temperature.state }}'
      below: 19
    condition:
      condition: state
      entity_id: 'input_boolean.notify_home'
      state: 'on'
    action:
      service: switch.turn_on
      entity_id: switch.heater_bed_2

Thanks for the input silvrr.

I still couldn’t get the code to work. Nothing happened, no errors, no action.

I played around with templates as they worked before when I couldn’t get a sun trigger to work either… this works:

  - alias: "Bed 2 heater on"
    hide_entity: True
    trigger:
      platform: template
      value_template: "{{ states('sensor.desk_temperature')| int < 18 }}"
    condition:
      condition: and
      conditions:
        - condition: state
          entity_id: 'input_boolean.notify_home'
          state: 'on'
        - condition: numeric_state
          entity_id: sun.sun
          value_template: '{{ state.attributes.elevation }}'
          below: 7.0
    action:
      service: switch.turn_on
      entity_id: switch.heater_bed_2

I had the and condition included before as i intended to add additional conditions as above.

The more I get to understanding, the more I like templates…

Thanks again.