update
This commit is contained in:
29
esphome/sensors/s3box_battery.yaml
Normal file
29
esphome/sensors/s3box_battery.yaml
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
sensor:
|
||||
- platform: adc
|
||||
pin: ${pin_vbatt}
|
||||
name: "Battery voltage"
|
||||
id: battery_voltage
|
||||
unit_of_measurement: "V"
|
||||
accuracy_decimals: 1
|
||||
device_class: "voltage"
|
||||
entity_category: "diagnostic"
|
||||
disabled_by_default: true
|
||||
update_interval: 30s
|
||||
attenuation: auto
|
||||
filters:
|
||||
- multiply: 4.11
|
||||
|
||||
- platform: copy
|
||||
id: battery_percent
|
||||
source_id: battery_voltage
|
||||
name: "Battery level"
|
||||
unit_of_measurement: "%"
|
||||
accuracy_decimals: 0
|
||||
device_class: "battery"
|
||||
entity_category: "diagnostic"
|
||||
filters:
|
||||
- lambda: return (x - 2.7) / (4.2 - 2.7) * 100;
|
||||
- clamp:
|
||||
min_value: 0
|
||||
max_value: 100
|
||||
Reference in New Issue
Block a user