-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpowermeter.yaml
45 lines (41 loc) · 935 Bytes
/
powermeter.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
substitutions:
device: powermeter
name: Powermeter
update_interval: 10min
esphome:
name: ${device}
platform: ESP8266
board: nodemcuv2
<<: !include common/common.yaml
# <<: !include common/logger.yaml
<<: !include common/binary_sensor.yaml
<<: !include common/switch.yaml
logger:
sensor:
- !include common/sensor/wifi-signal.yaml
- !include common/sensor/uptime.yaml
- platform: ct_clamp
sensor: adc_sensor
name: "${name} Current"
unit_of_measurement: "A"
icon: "mdi:flash-circle"
id: current
update_interval: 20s
filters:
- calibrate_linear:
- 0.0 -> 0.0
- 0.07922 -> 0.2674
- platform: adc
pin: A0
id: adc_sensor
- platform: template
name: "${name} Power"
unit_of_measurement: "W"
lambda: |-
if (id(current).state > 0){
return id(current).state * 227;
}else{
return 0;
}
update_interval: 20s