Int to float format

Trying to compare the mileage in a sensor to a counter, check if it’s plus 300 miles then save it to the counter and send a notification.

Getting float expected error for above and not sure if I’m just getting formatting wrong or I”m heading completely the wrong way. Any suggestions? Are there any dev tools to help get formatting correct?


alias: Bike Service
description: ""
trigger:
  - platform: numeric_state
    *entity_id:*
*      - sensor.champion_the_wonder_horse*
*    above: "{{ ((states('counter.bike_service')|float)+300)}}"*
    value_template:
condition: []
action:
  - service: counter.set_value
    metadata: {}
    data:
      *value: =(sensor.champion_the_wonder_horse)*
    target:
      entity_id: counter.bike_service
  - service: notify.mobile_app_pixel_7_pro
    metadata: {}
    data:
      message: Bike Service Due
      title: Bike Service
mode: single

I think this is templates are not allowed for above. You can use an input_number helper. I’d use a template trigger instead.

1 Like