-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshelly-plus-one.yaml
142 lines (122 loc) · 3 KB
/
shelly-plus-one.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
# These substitutions allow the end user to override certain values
substitutions:
device_name: "shelly-plus-1"
friendly_name: "Shelly Plus 1"
# Higher value gives lower watt readout
current_res: "0.001"
# Lower value gives lower voltage readout
voltage_div: "1925"
hidden_ssid: "false"
log_level: DEBUG
dashboard_import:
package_import_url: github://zeebob/esphome/shelly-plus-one.yaml@main
import_full_config: false # or true
esphome:
name: "${device_name}"
comment: Shelly Plus One
# Friendly names are used where appropriate in Home Assistant
friendly_name: "${friendly_name}"
# Automatically add the mac address to the name
# so you can use a single firmware for all devices
name_add_mac_suffix: true
# This will allow for (future) project identification,
# configuration and updates.
project:
name: zeebob.shelly-plus-one
version: "1.0"
platformio_options:
board_build.f_cpu: 160000000L
esp32:
board: esp32doit-devkit-v1
framework:
type: esp-idf
sdkconfig_options:
CONFIG_FREERTOS_UNICORE: y
CONFIG_ESP32_DEFAULT_CPU_FREQ_160: y
CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ: "160"
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
- platform: esphome
id: ota_esphome
http_request:
wifi:
improv_serial:
# Sets up Bluetooth LE (Only on ESP32) to allow the user
# to provision wifi credentials to the device.
esp32_improv:
authorizer: none
web_server:
output:
- platform: gpio
id: "relay_output"
pin: GPIO26
switch:
- platform: output
id: "relay"
name: "${device_name} Relay"
output: "relay_output"
button:
- platform: factory_reset
name: Restart with Factory Default Settings
id: factory_reset_device
entity_category: config
- platform: restart
icon: mdi:power-cycle
name: "Reboot"
binary_sensor:
- platform: gpio
name: "${device_name} Switch"
pin: GPIO4
on_press:
then:
- switch.toggle: "relay"
filters:
- delayed_on_off: 50ms
- platform: gpio
name: "${device_name} Button"
pin:
number: GPIO25
inverted: yes
mode:
input: true
pullup: true
on_click:
then:
- button.press: factory_reset_device
sensor:
- platform: ntc
sensor: temp_resistance_reading
name: "${device_name} Temperature"
unit_of_measurement: "°C"
accuracy_decimals: 1
icon: "mdi:thermometer"
calibration:
b_constant: 3350
reference_resistance: 10kOhm
reference_temperature: 298.15K
on_value_range:
- above: "80.0"
then:
- switch.turn_off: "relay"
- platform: resistance
id: temp_resistance_reading
sensor: temp_analog_reading
configuration: DOWNSTREAM
resistor: 10kOhm
- platform: adc
id: temp_analog_reading
pin: GPIO32
attenuation: 11db
- platform: adc
name: "${device_name} Relay Supply Voltage"
pin: GPIO33
attenuation: 11db
filters:
- multiply: 8
status_led:
pin:
number: GPIO0
inverted: true