Retreive value from a string

So I have this uPNP sensor (from template debug):
{{ states.sensor.sagemcom_adsl_router_kib_s_received }}

That has this value:

Result type: string

<template TemplateState(<state sensor.sagemcom_adsl_router_kib_s_received=182.2; unit_of_measurement=KiB/s, friendly_name=Download KiB/s, icon=mdi:server-network @ 2020-12-20T23:38:26.233870-05:00>)>

What can I do to retrieved that 182.2 ?

I want to change it from KBs to Kbs but this doesn’t work:

 value_template: "{{ states.sensor.sagemcom_adsl_router_kib_s_received * 8 }}"

Thanks

{{ states.sensor.sagemcom_adsl_router_kib_s_received.state }}

or

{{ states('sensor.sagemcom_adsl_router_kib_s_received') }}

If you want to perform calculations, you will need to convert the state value from string to float.

{{ states('sensor.sagemcom_adsl_router_kib_s_received') | float * 8 }}
1 Like

Thanks for the very quick reply, that did the trick :slight_smile:

1 Like