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: ""
  - platform: numeric_state
*      - sensor.champion_the_wonder_horse*
*    above: "{{ ((states('counter.bike_service')|float)+300)}}"*
condition: []
  - service: counter.set_value
    metadata: {}
      *value: =(sensor.champion_the_wonder_horse)*
      entity_id: counter.bike_service
  - service: notify.mobile_app_pixel_7_pro
    metadata: {}
      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