Icon_template : "if / elif" not using the decimals of a value

Hi all!

Sorry if it’s a dumb post but I’m new to HA…and sorry for my English, I speak French :wink:

HA 0.63.3 running on Rpi 3

I’m trying to put conditional icons depending on the sensor’s value for my aquarium parameters. I thought it was working until this morning I saw that the conditional rule wasn’t using the decimals of the value

Ex:
Sensor value 2.5
Conditional rule:
If <= to 1.0 =icon1
ElIf<= to 2.4 =icon2
ElIf<= to 2.6 =icon3
Else > to 2.6 =icon4
Result = Icon2 (because it’s the 1st rule it reads) ?!

When I saw that I tried those :
Sensor value set to 1.5=icon1, 2.7=icon2 and 3.2=icon4

My code in confi.yaml

- platform: rest
  resource: https://api.seneye.com/v1/devices/DeviceID/exps?user=MyUserName&pwd=MyPassword
  value_template: '{{ value_json.ph["curr"] }}'
  name: "Aquarium eau PH"
  method: GET
  unit_of_measurement: ""

- platform: template
  sensors:
    aquarium_ph:
      friendly_name: "pH"
      unit_of_measurement: ''
      value_template: '{{ (states.sensor.aquarium_eau_ph.state | float) }}'
      icon_template: '{%- if states.sensor.aquarium_eau_ph.state|int <= 6.2 -%}mdi:arrow-down-bold-circle{%- elif states.sensor.aquarium_eau_ph.state|int <= 6.5 -%}mdi:arrow-down-bold-circle-outline{%- elif states.sensor.aquarium_eau_ph.state|int < 7.5 -%}mdi:thumb-up-outline{%- elif states.sensor.aquarium_eau_ph.state|int >= 7.8 -%}mdi:arrow-up-bold-circle{%- elif states.sensor.aquarium_eau_ph.state|int >= 7.5 -%}mdi:arrow-up-bold-circle-outline{% else %}mdi:sync-alert{% endif %}'

You should use float instead of int in your icon template.
int has no decimals.

Haaaaa thanks was using float for the temperature (no decimal)! I read it like 1000 times but didn’t see it