State trigger not triggering

Hello, could anyone please help me with why the following automation is not triggering:

id: '1662663516924'
alias: Stoppa varmvatten
description: ''
trigger:
  - platform: state
    entity_id:
      - sensor.nordpool_kwh_se2_sek_3_095_025
condition:
  - condition: template
    value_template: >-
      value_template: "{{
      state_attr('sensor.nordpool_kwh_se2_sek_3_095_025','current_price')|float(0)
      > state_attr('sensor.nordpool_kwh_se2_sek_3_095_025','min')|float(0)*1.005
      }}"
action:
  - service: modbus.write_register
    data:
      address: 23
      slave: 255
      value: 3500
      hub: hub1
  - service: modbus.write_register
    data:
      address: 22
      slave: 255
      value: 2000
      hub: hub1
mode: single

I have a similar automation with the same trigger (but no condition) which triggers every hour. But this one doesn’t seem to do so.

Check the automation trace to see if it is being triggered but blocked by the condition.

Are you sure this is what is says - because it should say:

condition:
  - condition: template
    value_template: >-
      {{ state_attr('sensor.nordpool_kwh_se2_sek_3_095_025','current_price')|float(0)
      > state_attr('sensor.nordpool_kwh_se2_sek_3_095_025','min')|float(0)*1.005
      }}
1 Like

Hm, yes it seems to have been mistyping it in the yaml-code… I configured it in the GUI though, assumed it would be correct then.

Side note: After the template, it only ever called the first service. For now I split it into 2 Automations instead. I assume there is a neater way to do it, but that will have to do for now.