sensor:
- platform: adc
pin: A0
name: esp12f Battery
id: battery_voltage_12f
filters:
- multiply: 4.79
accuracy_decimals: 3
update_interval: 60s
It looks like I’m stalking you. Try adding this to esphome yaml. It will send the voltage as an MQTT. You may have to measure the voltage with an external meter and change that multiply factor to suit your needs. ( with esp12f I need to use a voltage divider as 3v would burn out the A0 pin. change anything else to suit your needs. I started with wemos D1 but it uses too much battery so I moved over to esp12f. My device )is outside so I charge it by small solar panel.
- platform: template
sensors:
esp12f_battery_fullness:
friendly_name: ESP12f Battery Capacity
device_class: battery
unit_of_measurement: "%"
value_template: >
{{ ((states('sensor.esp12f_battery')|float-2.64)/0.0156)|round(2) }}
I created the battery % in yaml in HA as I had to adjust it a lot at start to get it accurate and didn’t want to keep flashing the ESP as I have to take it out of deep sleep and go to OTA mode. The 2.64 was the lowest voltage the esp could work at. It’s a start. You’ll work it out.