forked from syssi/esphome-apc-ups
-
Notifications
You must be signed in to change notification settings - Fork 0
/
esp8266-example.yaml
196 lines (174 loc) · 4.63 KB
/
esp8266-example.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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
substitutions:
name: apc-ups
device_description: "Monitor and control a APC UPS via RS232"
external_components_source: github://samoswall/esphome-apc-ups@main
tx_pin: GPIO4
rx_pin: GPIO5
esphome:
name: ${name}
comment: ${device_description}
project:
name: "samoswall.esphome-apc-ups"
version: 1.0.0
esp8266:
board: d1_mini
external_components:
- source: ${external_components_source}
refresh: 0s
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ota:
logger:
# If you don't use Home Assistant please remove this `api` section and uncomment the `mqtt` component!
api:
# mqtt:
# broker: !secret mqtt_host
# username: !secret mqtt_username
# password: !secret mqtt_password
# id: mqtt_client
uart:
- id: uart_0
baud_rate: 2400
tx_pin: ${tx_pin}
rx_pin: ${rx_pin}
debug:
direction: BOTH
dummy_receiver: false
after:
delimiter: "\n"
sequence:
- lambda: UARTDebug::log_string(direction, bytes);
apc_ups:
- id: ups0
uart_id: uart_0
binary_sensor:
- platform: apc_ups
apc_ups_id: ups1
runtime_calibration:
name: "${name} runtime calibration"
smart_trim:
name: "${name} smart trim"
smart_boost:
name: "${name} smart boost"
on_line:
name: "${name} on line"
on_battery:
name: "${name} on battery"
output_overloaded:
name: "${name} output overloaded"
battery_low:
name: "${name} battery low"
replace_battery:
name: "${name} replace battery"
smart_mode:
name: "${name} smart mode"
switch:
- platform: apc_ups
apc_ups_id: ups1
front_panel_test:
name: "${name} front panel test"
simulate_power_failure:
name: "${name} simulate power failure"
self_test:
name: "${name} self test"
start_runtime_calibration:
name: "${name} start runtime calibration"
save_last_battery_change_date:
name: "${name} save last battery change date"
shutdown_with_grace_period:
name: "${name} shutdown with grace period"
soft_shutdown:
name: "${name} soft shutdown"
shutdown_immediately:
name: "${name} shutdown immediately"
turn_on:
name: "${name} turn on"
- platform: restart
name: "${devicename} restart"
sensor:
- platform: apc_ups
apc_ups_id: ups1
battery_voltage:
name: "${name} battery voltage"
grid_frequency:
name: "${name} grid frequency"
grid_voltage:
name: "${name} grid voltage"
ac_output_voltage:
name: "${name} ac output voltage"
ac_output_load:
name: "${name} ac output load"
status_bitmask:
name: "${name} status bitmask"
state_of_charge:
name: "${name} state of charge"
estimated_runtime:
name: "${name} estimated runtime"
internal_temperature:
name: "${name} internal temperature"
# ambient_temperature:
# name: "${name} ambient temperature"
max_grid_voltage:
name: "${name} max grid voltage"
min_grid_voltage:
name: "${name} min grid voltage"
nominal_battery_voltage:
name: "${name} nominal battery voltage"
nominal_output_voltage:
name: "${name} nominal output voltage"
- platform: wifi_signal
name: "${devicename} wifi signal"
update_interval: 600s
- platform: uptime
name: "${devicename} Uptime in Days"
id: uptime_sensor_days
update_interval: 60s
text_sensor:
- platform: apc_ups
apc_ups_id: ups1
cause_of_last_transfer:
name: "${name} cause of last transfer"
# protocol_info:
# name: "${name} protocol info"
firmware_revision:
id: "myfirmware"
name: "${name} firmware revision"
old_firmware_version:
id: myoldfirmware
name: "${name} old firmware version"
manufacture_date:
name: "${name} manufacture date"
last_battery_change_date:
name: "${name} last battery change date"
local_identifier:
name: "${name} local identifier"
serial_number:
name: "${name} serial number"
self_test_results:
name: "${name} self test results"
model_name:
name: "${name} model name"
last_battery_change_new_date:
name: "${name} last battery change new date"
- platform: version
name: "$devicename Version"
- platform: wifi_info
ip_address:
name: "$devicename IP"
bssid:
name: "$devicename BSSID"
time:
- platform: sntp
id: sntp_time
timezone: Europe/Moscow
datetime:
- platform: template
id: my_datetime_date
type: date
name: Change battery date
optimistic: yes
on_value:
then:
- lambda: |-
id(ups1).set_last_battery_change_new_date(x.strftime("%m/%d/%y"));