Need help with template.yaml

Hello,

ich have a aqara smart plug connected through zha. I have a template to show me the ampere of the device based on power (W) and voltage (V) but i cannot figure it out why it does not round up to two digits…

Here my yaml Code:

      - name: "leseecke_Ampere"
        unique_id: "leseecke_Ampere"
        unit_of_measurement: "A"
        state: >
            {{ (float(states('sensor.leseecke_power'))) / (float(states('sensor.leseecke_voltage'))) |float |round(2) }}

On my Dashobard and on the info site of the sensor leseecke_Ampere it shows
0,1882096069869 A

I tried a lot of variations but i could not figure it out yet. It is surely pretty simple, but i do not see it…
Can someone please point me in the right direction?

Regards Christian

You have round the result of the subtraction.

      - name: "leseecke_Ampere"
        unique_id: "leseecke_Ampere"
        unit_of_measurement: "A"
        state: >
          {{ (states('sensor.leseecke_power') | float(0) / states('sensor.leseecke_voltage') | float(1)) | round(2) }}
1 Like

You are awesome! :smiley:
Could not figure it out…
Sometimes you don’t see the forest because of the trees…

1 Like