changes to home-assistant and nb
This commit is contained in:
143
esphome/bathroom-switch-1.yaml
Normal file
143
esphome/bathroom-switch-1.yaml
Normal file
@@ -0,0 +1,143 @@
|
||||
substitutions:
|
||||
devicename: bathroom-switch-1
|
||||
# Name for the relays
|
||||
channel_1: Light
|
||||
channel_2: Air
|
||||
max_power: "2000.0" # watt
|
||||
max_temp: "80.0" # °C
|
||||
|
||||
esphome:
|
||||
name: ${devicename}
|
||||
platform: ESP8266
|
||||
board: esp01_1m
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_password
|
||||
|
||||
# Enable Home Assistant API
|
||||
api:
|
||||
|
||||
i2c:
|
||||
sda: GPIO12
|
||||
scl: GPIO14
|
||||
|
||||
sensor:
|
||||
- platform: ade7953_i2c
|
||||
voltage:
|
||||
name: ${devicename} voltage
|
||||
current_a:
|
||||
name: ${channel_2} current
|
||||
internal: true
|
||||
current_b:
|
||||
name: ${channel_1} current
|
||||
internal: true
|
||||
active_power_a:
|
||||
name: ${channel_2} power
|
||||
id: power_channel_2
|
||||
filters:
|
||||
- multiply: 1
|
||||
on_value_range:
|
||||
- above: ${max_power}
|
||||
then:
|
||||
- output.turn_off: shelly_25_relay_2
|
||||
- homeassistant.service:
|
||||
service: persistent_notification.create
|
||||
data:
|
||||
title: Message from ${devicename}
|
||||
data_template:
|
||||
message: Switch turned off because power exceeded ${max_power}W
|
||||
active_power_b:
|
||||
name: ${channel_1} power
|
||||
id: power_channel_1
|
||||
filters:
|
||||
- multiply: -1
|
||||
on_value_range:
|
||||
- above: ${max_power}
|
||||
then:
|
||||
- output.turn_off: shelly_25_relay_1
|
||||
- homeassistant.service:
|
||||
service: persistent_notification.create
|
||||
data:
|
||||
title: Message from ${devicename}
|
||||
data_template:
|
||||
message: Switch turned off because power exceeded ${max_power}W
|
||||
update_interval: 30s
|
||||
|
||||
# NTC Temperature
|
||||
- platform: ntc
|
||||
sensor: temp_resistance_reading
|
||||
name: ${devicename} 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: ${max_temp}
|
||||
then:
|
||||
- output.turn_off: shelly_25_relay_1
|
||||
- output.turn_off: shelly_25_relay_2
|
||||
- homeassistant.service:
|
||||
service: persistent_notification.create
|
||||
data:
|
||||
title: Message from ${devicename}
|
||||
data_template:
|
||||
message: Switch turned off because temperature exceeded ${max_temp}°C
|
||||
- platform: resistance
|
||||
id: temp_resistance_reading
|
||||
sensor: temp_analog_reading
|
||||
configuration: DOWNSTREAM
|
||||
resistor: 32kOhm
|
||||
- platform: adc
|
||||
id: temp_analog_reading
|
||||
pin: A0
|
||||
|
||||
status_led:
|
||||
pin:
|
||||
number: GPIO0
|
||||
inverted: yes
|
||||
|
||||
output:
|
||||
- platform: gpio
|
||||
pin: GPIO4
|
||||
id: shelly_25_relay_1
|
||||
- platform: gpio
|
||||
pin: GPIO15
|
||||
id: shelly_25_relay_2
|
||||
|
||||
light:
|
||||
- platform: binary
|
||||
name: "${channel_1}"
|
||||
output: shelly_25_relay_1
|
||||
id: lightid
|
||||
- platform: binary
|
||||
name: "${channel_2}"
|
||||
output: shelly_25_relay_2
|
||||
id: airid
|
||||
|
||||
binary_sensor:
|
||||
- platform: gpio
|
||||
pin:
|
||||
number: GPIO13
|
||||
name: "${channel_1} input"
|
||||
internal: true
|
||||
on_state:
|
||||
then:
|
||||
- light.toggle: lightid
|
||||
- platform: gpio
|
||||
pin:
|
||||
number: GPIO5
|
||||
name: "${channel_2} input"
|
||||
internal: true
|
||||
on_state:
|
||||
then:
|
||||
- light.toggle: airid
|
||||
|
||||
# Prevent short circuit with "floating" pin!
|
||||
- platform: gpio
|
||||
pin: GPIO16
|
||||
name: "ade7953 IRQ pin"
|
||||
internal: true
|
||||
Reference in New Issue
Block a user