-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdevice_sp111_v11.yaml
67 lines (66 loc) · 2.06 KB
/
device_sp111_v11.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
packages:
base: !include device_sp111_base.yaml
sensor:
# power sensor
- platform: hlw8012
sel_pin:
number: GPIO12
inverted: true
cf_pin: GPIO05
cf1_pin: ${cf1_pin}
change_mode_every: 3
update_interval: 1s
# current sensor
current:
name: "${id} current"
unit_of_measurement: A
accuracy_decimals: 2
filters:
# map from sensor -> measured value
- calibrate_linear:
- 0.12 -> 0.04 # LED test lamp
- 0.19 -> 0.17 # bedlight
- 0.96 -> 0.78 # hairdryer 1/1
- 3.1 -> 2.58 # hairdryer 2/1
- 9.53 -> 7.96 # hairdryer 3/2
# make everything below 0.01A appear as just 0A
# furthermore it corrects 0.013A for the power usage of the plug
- lambda: if (x < (0.01 - 0.013)) return 0; else return (x - 0.013);
- or:
- throttle: ${update_throttle}
- delta: 0.03
# voltage sensor
voltage:
name: "${id} voltage"
unit_of_measurement: V
accuracy_decimals: 1
filters:
# map from sensor -> measured value
- calibrate_linear:
- 720.8 -> 234
- 725.7 -> 235
- 727.8 -> 235
- delta: 3
- throttle: ${update_throttle}
# power sensor
power:
id: "${id}_power_usage"
name: "${id} power usage"
unit_of_measurement: W
icon: mdi:flash-circle
accuracy_decimals: 0
filters:
# map from sensor -> measured value
- calibrate_linear:
- 0 -> 1.14
- 46 -> 6.5 # LED test lamp
- 283 -> 40 # bedlight
- 1205 -> 167.5 # hairdryer 1/1
- 3920 -> 543 # hairdryer 2/1
- 13020 -> 1800 # hairdryer 3/2
# make everything below 2W appear as just 0W
# furthermore it corrects 1.14W for the power usage of the plug
- lambda: if (x < (2 + 1.14)) return 0; else return (x - 1.14);
- or:
- throttle: ${update_throttle}
- delta: 3