-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdressingroom-desk.yaml
163 lines (154 loc) · 3.99 KB
/
dressingroom-desk.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
substitutions:
device_name: dressingroom-desk
friendly_name: "Dressing Room - Desk"
comment: "${friendly_name} (Gosund P1 Mod)"
default_update_interval: 60s
powermeter_update_interval: 10s
<<: !include boards/esp8285.yaml
<<: !include components/api.yaml
<<: !include components/captive_portal.yaml
<<: !include components/ota/esphome.yaml
<<: !include components/safe_mode.yaml
<<: !include components/time/homeassistant.yaml
<<: !include components/web_server.yaml
<<: !include components/wifi.yaml
text_sensor:
- platform: version
name: "${device_name}_version"
hide_timestamp: true
logger:
baud_rate: 0
logs:
adc: INFO
status_led:
pin:
number: GPIO02
inverted: True
binary_sensor:
- <<: !include components/binary_sensor/status.yaml
- platform: gpio
id: button_main_id
internal: True
pin:
number: GPIO16
on_press:
- switch.toggle: switch_usb_id
- platform: template
id: button_1_id
internal: true
on_press:
- switch.toggle: switch_1_id
filters:
- delayed_off: 100ms
- platform: template
id: button_2_id
internal: true
on_press:
- switch.toggle: switch_2_id
filters:
- delayed_off: 100ms
- platform: template
id: button_3_id
internal: true
on_press:
- switch.toggle: switch_3_id
filters:
- delayed_off: 100ms
switch:
- platform: gpio
pin: GPIO14
id: switch_1_id
name: "${device_name}_switch01"
restore_mode: RESTORE_DEFAULT_ON
icon: mdi:power-socket-eu
- platform: gpio
pin: GPIO12
id: switch_2_id
name: "${device_name}_switch02"
restore_mode: RESTORE_DEFAULT_ON
icon: mdi:power-socket-eu
- platform: gpio
pin: GPIO13
id: switch_3_id
name: "${device_name}_switch03"
restore_mode: RESTORE_DEFAULT_ON
icon: mdi:power-socket-eu
- platform: gpio
pin: GPIO05
id: switch_usb_id
name: "${device_name}_switchusb"
restore_mode: RESTORE_DEFAULT_ON
icon: mdi:power-socket-eu
inverted: yes
uart:
rx_pin: GPIO03
#tx_pin: GPIO01
baud_rate: 4800
one_wire:
- platform: gpio
pin: GPIO04
sensor:
- <<: !include components/sensor/wifi_signal.yaml
- <<: !include components/sensor/total_daily_energy.yaml
power_id: power_id
- platform: dallas_temp
address: 0x9D3C01D607A18028
name: ${device_name}_temperature
device_class: temperature
filters:
- offset: 2.0
- platform: cse7766
current:
name: ${device_name}_current
icon: mdi:current-ac
device_class: current
filters:
- throttle_average: ${powermeter_update_interval}
- multiply: 0.993793
voltage:
name: ${device_name}_voltage
icon: mdi:flash-circle
device_class: voltage
filters:
- throttle_average: ${powermeter_update_interval}
- multiply: 2.410403
power:
id: power_id
name: ${device_name}_power
icon: mdi:flash-outline
device_class: power
filters:
- throttle_average: ${powermeter_update_interval}
- multiply: 2.438610
energy:
name: ${device_name}_energy
filters:
- throttle: ${powermeter_update_interval}
apparent_power:
name: ${device_name}_apparentpower
filters:
- throttle_average: ${powermeter_update_interval}
power_factor:
name: ${device_name}_powerfactor
filters:
- throttle_average: ${powermeter_update_interval}
- platform: adc
pin: GPIO17
id: gpio17
internal: true
update_interval: 0.1s
filters:
- lambda: |-
if (x >= 0.60 && x < 0.90) {
id(button_1_id).publish_state(true);
} else if (x >= 0.30 && x < 0.60) {
id(button_2_id).publish_state(true);
}
else if (x > 0.10 && x < 0.30) {
id(button_3_id).publish_state(true);
} else {
id(button_1_id).publish_state(false);
id(button_2_id).publish_state(false);
id(button_3_id).publish_state(false);
}
return{};