I have a distance sensor and I would like it to return both the raw value and a calculated one. I know I could just return the raw value and then setup some other things to do the math but I would rather the ESPHome device did it all and return all the values I want.
Second question would be how to you get LAMBDA to round a value?
I tried - lambda: return (1 - ((x - 0.13720)/1.38)) * 100 | round(2);
But the system complains about it.
Below is what I have in the ESPHome config file for the device.
Thank you for the replies. I did not like the template option because it means I have the water tank info being calculated in multiple places and was not keen on that.
I did not think to use round as a function, that will show me. Thanks for that one.
I did fine I could do this with the distance sensor to get the value and the % level. Not sure its the best idea but it works.