Added to the new configuration, the values are displayed correctly in the logs. How to display this value in the main panel?
sensor:
- platform: adc
pin: 34
attenuation: 11db
name: "battery_voltage"
id: "battery_voltage"
update_interval: 60s
filters:
multiply: 2.0
- platform: template
name: "Battery Percentage"
device_class: "battery"
id: "battery_percentage"
accuracy_decimals: 1
update_interval: 60s
unit_of_measurement: '%'
lambda: |-
return ((id(battery_voltage).state - 3.5) / 0.7 * 100.00);
filters:
- lambda: |-
if (x < 0) return 0;
else if (x > 100) return 100;
else return (x);
[02:03:24][D][sensor:127]: ‘Battery Percentage’: Sending state 66.28571 % with 1 decimals of accuracy