Refactor battery sensor configuration to use MAX17048 with updated parameters
This commit is contained in:
@@ -133,41 +133,41 @@ font:
|
|||||||
|
|
||||||
# --- Battery fuel gauge (Adafruit MAX17048 via compatible driver) ---
|
# --- Battery fuel gauge (Adafruit MAX17048 via compatible driver) ---
|
||||||
sensor:
|
sensor:
|
||||||
# - platform: max17043
|
- platform: max17043
|
||||||
# id: max17048_battery
|
id: max17048_battery
|
||||||
# i2c_id: i2c_main
|
i2c_id: i2c_main
|
||||||
# update_interval: 120s
|
update_interval: 120s
|
||||||
# battery_voltage:
|
battery_voltage:
|
||||||
# name: "Remote Battery Voltage"
|
name: "Remote Battery Voltage"
|
||||||
# id: remote_battery_voltage
|
id: remote_battery_voltage
|
||||||
# entity_category: diagnostic
|
entity_category: diagnostic
|
||||||
# device_class: voltage
|
device_class: voltage
|
||||||
# state_class: measurement
|
state_class: measurement
|
||||||
# accuracy_decimals: 3
|
accuracy_decimals: 3
|
||||||
# on_value:
|
on_value:
|
||||||
# then:
|
then:
|
||||||
# - lambda: |-
|
- lambda: |-
|
||||||
# ESP_LOGI("battery", "Voltage: %.3f V", x);
|
ESP_LOGI("battery", "Voltage: %.3f V", x);
|
||||||
# battery_level:
|
battery_level:
|
||||||
# name: "Remote Battery Level"
|
name: "Remote Battery Level"
|
||||||
# id: remote_battery_level
|
id: remote_battery_level
|
||||||
# entity_category: diagnostic
|
entity_category: diagnostic
|
||||||
# device_class: battery
|
device_class: battery
|
||||||
# state_class: measurement
|
state_class: measurement
|
||||||
# accuracy_decimals: 0
|
accuracy_decimals: 0
|
||||||
# on_value:
|
on_value:
|
||||||
# then:
|
then:
|
||||||
# - lambda: |-
|
- lambda: |-
|
||||||
# const float pct = x;
|
const float pct = x;
|
||||||
# ESP_LOGI("battery", "Level: %.0f%%", pct);
|
ESP_LOGI("battery", "Level: %.0f%%", pct);
|
||||||
- platform: custom
|
# - platform: custom
|
||||||
lambda: |-
|
# lambda: |-
|
||||||
auto max17048_sensor = new MAX17048Sensor();
|
# auto max17048_sensor = new MAX17048Sensor();
|
||||||
App.register_component(max17048_sensor);
|
# App.register_component(max17048_sensor);
|
||||||
return {max17048_sensor->voltage_sensor, max17048_sensor->percentage_sensor};
|
# return {max17048_sensor->voltage_sensor, max17048_sensor->percentage_sensor};
|
||||||
sensors:
|
# sensors:
|
||||||
- name: "Voltage"
|
# - name: "Voltage"
|
||||||
unit_of_measurement: V
|
# unit_of_measurement: V
|
||||||
accuracy_decimals: 2
|
# accuracy_decimals: 2
|
||||||
- name: "Percentage"
|
# - name: "Percentage"
|
||||||
unit_of_measurement: '%'
|
# unit_of_measurement: '%'
|
||||||
|
|||||||
Reference in New Issue
Block a user