-
Notifications
You must be signed in to change notification settings - Fork 0
/
nousa1-3.yaml
140 lines (119 loc) · 2.76 KB
/
nousa1-3.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
substitutions:
devicename: "nousa1_3_esphome"
upper_devicename: "nousa1_3_esphome"
# Higher value gives lower watt readout
current_res: "0.00280"
# Lower value gives lower voltage readout
voltage_div: "734"
esphome:
name: $devicename
platform: ESP8266
board: esp8285
esp8266_restore_from_flash: True
# Enable logging
logger:
baud_rate: 0
# Enable Home Assistant API
api:
# Enable over the air updates
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: on
# see: https://esphome.io/components/time.html
time:
- platform: homeassistant
id: homeassistant_time
# Enable Web server
web_server:
port: 80
text_sensor:
- platform: version
name: "${devicename} - Version"
icon: mdi:cube-outline
binary_sensor:
- platform: status
name: "${devicename} - Status"
device_class: connectivity
# toggle relay on/off
- platform: gpio
pin:
number: GPIO13
mode: INPUT_PULLUP
inverted: True
id: "${devicename}_button_state"
on_press:
- switch.toggle: button_switch
sensor:
- platform: wifi_signal
name: "${devicename} - Wifi Signal"
update_interval: 60s
icon: mdi:wifi
- platform: uptime
name: "${devicename} - Uptime"
update_interval: 60s
icon: mdi:clock-outline
- platform: total_daily_energy
name: "${devicename} - Todays Usage"
power_id: "power_wattage"
filters:
# Multiplication factor from W to kW is 0.001
- multiply: 0.001
unit_of_measurement: kWh
icon: mdi:calendar-clock
- platform: adc
pin: VCC
name: "${devicename} - VCC Volt"
icon: mdi:flash-outline
- platform: hlw8012
sel_pin:
number: GPIO12
inverted: True
cf_pin: GPIO05
cf1_pin: GPIO04
change_mode_every: 4
current_resistor: ${current_res}
voltage_divider: ${voltage_div}
update_interval: 3s
current:
name: "${devicename} - Ampere"
unit_of_measurement: A
accuracy_decimals: 3
icon: mdi:current-ac
voltage:
name: "${devicename} - Volt"
unit_of_measurement: V
accuracy_decimals: 1
icon: mdi:flash-outline
power:
name: "${devicename} - Watt"
unit_of_measurement: W
id: "power_wattage"
icon: mdi:gauge
status_led:
pin:
number: GPIO02
inverted: True
id: led_blue
output:
- platform: gpio
pin: GPIO00
inverted: true
id: led_red
switch:
- platform: template
name: "${devicename} - Switch"
icon: mdi:power
optimistic: true
id: button_switch
turn_on_action:
- switch.turn_on: relay
- output.turn_on: led_red
turn_off_action:
- switch.turn_off: relay
- output.turn_off: led_red
- platform: gpio
pin: GPIO15
id: relay
restore_mode: RESTORE_DEFAULT_ON