#Automation template trigger not working

1 messages · Page 1 of 1 (latest)

dapper cosmos
#
entity_id:
  - sensor.charger_energy_session
to: "{{ states('input_number.input_number.car_charger_kwh_selector') | int }}"

The above isnt triggering when charger_energy_session becomes the same value as the input_number.

The input number has no decimals but the other one has a lot of decimals, around 10 behind the comma.
Maybe thats ehat causing the trigger not to fire?
Or is something else wrong?

frigid trellis
#

template for the condition should be written as true/false output

dapper cosmos
#

How would i go about that?

frigid trellis
#

trigger on state change
then condition would be something like
{{ states('input_number.input_number.car_charger_kwh_selector') == states('sensor.charger_energy_session') }}

#

that would pass the condition if the values are the same

#

its currently an exact match required though so may not trigger depending on sensor polling, so depending on accuracy requirement you could make it a bit more relaxed

#

or change to >= instead of ==

#

{{ states('input_number.input_number.car_charger_kwh_selector')|float|round(0) == states('sensor.charger_energy_session')|float|round(0) }}
would be how to relax it for example

graceful vault