Need help with template converting bps to mbps

I am trying to convert bps to Mbps in a temple. However, the result state value is just “unknown”.

Could someone please tell me what I’m doing wrong in the below template?

      my_download_speed:
        friendly_name: 'My Download Speed'
        value_template: "{{ state_attr('sensor.my_network_0_bps_received') | multiply(0.0000001) | float }}"
        unit_of_measurement: "Mbps"

What’s the value of {{ state_attr('sensor.my_network_0_bps_received') }} when checked under Template in Developer Tools? I think that should be a state and note state_attr.

This is what it looks like exactly below. That numeric value changes every second.

It should be:
{{ states('sensor.my_network_0_bps_received') | multiply(0.0000001) | float }}

Check the code in the template editor.

1 Like

I’m not sure if you’re still reading this… but do you know how I can round the value to a hundredth of a decimal place?

I tried the below line, but the value stays at zero:

value_template: "{{ states('sensor.horizon_network_0_bps_sent') | multiply(0.0000001) | float | round(3) }}"

Remove the float. round() returns float by default. But that function should actual return with a precision of 3.