mirror of
https://github.com/brianhanifin/esphome-config.git
synced 2026-07-27 19:55:41 +00:00
refactor + play catchup
This commit is contained in:
+6
-4
@@ -4,12 +4,14 @@
|
||||
# Ignore project folders
|
||||
.esphome/
|
||||
3rd_party/
|
||||
bluetooth??/
|
||||
bluetooth-*/
|
||||
irrigation/
|
||||
plug??/
|
||||
plug-*/
|
||||
pool/
|
||||
shelly?_??/
|
||||
sonoff_*_??/
|
||||
power-*/
|
||||
shelly-*/
|
||||
sonoff-*/
|
||||
switch-*/
|
||||
|
||||
# Ignore subfolders.
|
||||
**/lib
|
||||
|
||||
Vendored
+12
-5
@@ -12,19 +12,26 @@
|
||||
"**/*.yaml": false,
|
||||
"**/plug0?/": true,
|
||||
"./*.yaml": false,
|
||||
"**/bluetooth_hub/": true,
|
||||
"**/plug??/": true,
|
||||
"**/shelly?_??/": true,
|
||||
"**/sonoff_*_??/": true,
|
||||
"**/*.ini": true,
|
||||
"**/.esphome/": true,
|
||||
"**/3rd_party/": true,
|
||||
"**/bluetooth_hub/": true,
|
||||
"**/bluetooth-*/": true,
|
||||
"**/irrigation/": true,
|
||||
"**/plug??/": true,
|
||||
"**/plug-*/": true,
|
||||
"**/pool/": true,
|
||||
"**/shelly?_??/": true,
|
||||
"**/sonoff_*_??/": true,
|
||||
"**/power-*/": true,
|
||||
"**/shelly-*/": true,
|
||||
"**/sonoff-*/": true,
|
||||
"**/switch-*/": true,
|
||||
"**/lib": true,
|
||||
"**/src": true,
|
||||
"**/._*": true,
|
||||
"**/.DS_Store": true,
|
||||
"secrets.yaml": true
|
||||
"secrets.yaml": true,
|
||||
"**/partitions.csv": true
|
||||
}
|
||||
}
|
||||
|
||||
+241
-67
@@ -1,9 +1,10 @@
|
||||
---
|
||||
# ESP32 Bluetooth Hub
|
||||
# ESP32 BLE Hub
|
||||
#
|
||||
substitutions:
|
||||
project: BLE Hub
|
||||
project: Bluetooth Hub
|
||||
id: bluetooth_hub
|
||||
hostname: bluetooth-hub
|
||||
<<: !include common/substitutions/bluetooth_hub.yaml
|
||||
|
||||
<<: !include common/esphome/esp32_wrover.yaml
|
||||
@@ -11,6 +12,7 @@ substitutions:
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_pass
|
||||
#use_address: bluetooth_hub.local
|
||||
|
||||
# Using these as a precaution to ensure solid WiFi connectivity.
|
||||
#power_save_mode: none # Disable for ESP32
|
||||
@@ -31,7 +33,7 @@ esp32_ble_tracker:
|
||||
|
||||
# text_sensor:
|
||||
# - platform: ble_scanner
|
||||
# name: Bluetooth Hub Scanner
|
||||
# name: Bluetooth hub scanner
|
||||
# id: bluetooth_hub_scanner
|
||||
# on_value:
|
||||
# then:
|
||||
@@ -42,163 +44,335 @@ esp32_ble_tracker:
|
||||
# }
|
||||
|
||||
sensor:
|
||||
# LYWSD03MMC $4 Temperature Sensors
|
||||
# LYWSD03MMC $4 temperature Sensors
|
||||
# Flashed with custom firmware in Chrome at https://pvvx.github.io/ATC_MiThermometer/TelinkMiFlasher.html
|
||||
# Settings:
|
||||
# * "F"
|
||||
# * Advertising Type: "Mi"
|
||||
# * Click [Show all mi keys] to get MAC Address
|
||||
|
||||
|
||||
# Bedroom
|
||||
- platform: xiaomi_lywsd03mmc
|
||||
mac_address: "A4:C1:38:23:ED:41"
|
||||
bindkey: "5119b4890c72bc66121278dca55df431"
|
||||
temperature:
|
||||
name: "Bedroom Temperature"
|
||||
name: "Bedroom temperature"
|
||||
device_class: temperature
|
||||
state_class: measurement
|
||||
unit_of_measurement: "°C"
|
||||
accuracy_decimals: 1
|
||||
|
||||
humidity:
|
||||
name: "Bedroom Humidity"
|
||||
name: "Bedroom humidity"
|
||||
device_class: humidity
|
||||
state_class: measurement
|
||||
unit_of_measurement: "%"
|
||||
accuracy_decimals: 0
|
||||
|
||||
battery_level:
|
||||
name: "Bedroom Temperature Battery"
|
||||
name: "Bedroom temperature battery"
|
||||
entity_category: diagnostic
|
||||
device_class: battery
|
||||
state_class: measurement
|
||||
unit_of_measurement: "%"
|
||||
accuracy_decimals: 0
|
||||
|
||||
- platform: ble_rssi
|
||||
mac_address: "A4:C1:38:23:ED:41"
|
||||
name: "Bedroom Temperature BLE Signal"
|
||||
|
||||
name: "Bedroom temperature signal"
|
||||
disabled_by_default: true
|
||||
entity_category: diagnostic
|
||||
device_class: signal_strength
|
||||
state_class: measurement
|
||||
unit_of_measurement: dBm
|
||||
accuracy_decimals: 0
|
||||
|
||||
# Family Room
|
||||
- platform: xiaomi_lywsd03mmc
|
||||
mac_address: "A4:C1:38:BF:98:48"
|
||||
bindkey: "9e58510b59d2f2d386a15c3ae60bf59a"
|
||||
temperature:
|
||||
name: "Family Room Temperature"
|
||||
name: "Family Room temperature"
|
||||
device_class: temperature
|
||||
state_class: measurement
|
||||
unit_of_measurement: "°C"
|
||||
accuracy_decimals: 1
|
||||
|
||||
humidity:
|
||||
name: "Family Room Humidity"
|
||||
name: "Family Room humidity"
|
||||
device_class: humidity
|
||||
state_class: measurement
|
||||
unit_of_measurement: "%"
|
||||
accuracy_decimals: 0
|
||||
|
||||
battery_level:
|
||||
name: "Family Room Temperature Battery"
|
||||
name: "Family Room temperature battery"
|
||||
entity_category: diagnostic
|
||||
device_class: battery
|
||||
state_class: measurement
|
||||
unit_of_measurement: "%"
|
||||
accuracy_decimals: 0
|
||||
|
||||
- platform: ble_rssi
|
||||
mac_address: "A4:C1:38:BF:98:48"
|
||||
name: "Family Room Temperature BLE Signal"
|
||||
name: "Family Room temperature signal"
|
||||
disabled_by_default: true
|
||||
entity_category: diagnostic
|
||||
device_class: signal_strength
|
||||
state_class: measurement
|
||||
unit_of_measurement: dBm
|
||||
accuracy_decimals: 0
|
||||
|
||||
# Garage
|
||||
- platform: xiaomi_lywsd03mmc
|
||||
mac_address: "A4:C1:38:FA:00:36"
|
||||
bindkey: "98d8225995fdfb2a4d5110b08e2e0fc6"
|
||||
temperature:
|
||||
name: "Garage Temperature"
|
||||
name: "Garage temperature"
|
||||
device_class: temperature
|
||||
state_class: measurement
|
||||
unit_of_measurement: "°C"
|
||||
accuracy_decimals: 1
|
||||
|
||||
humidity:
|
||||
name: "Garage Humidity"
|
||||
name: "Garage humidity"
|
||||
device_class: humidity
|
||||
state_class: measurement
|
||||
unit_of_measurement: "%"
|
||||
accuracy_decimals: 0
|
||||
|
||||
battery_level:
|
||||
name: "Garage Temperature Battery"
|
||||
name: "Garage temperature battery"
|
||||
entity_category: diagnostic
|
||||
device_class: battery
|
||||
state_class: measurement
|
||||
unit_of_measurement: "%"
|
||||
accuracy_decimals: 0
|
||||
|
||||
- platform: ble_rssi
|
||||
mac_address: "A4:C1:38:FA:00:36"
|
||||
name: "Garage Temperature BLE Signal"
|
||||
name: "Garage temperature signal"
|
||||
disabled_by_default: true
|
||||
entity_category: diagnostic
|
||||
device_class: signal_strength
|
||||
state_class: measurement
|
||||
unit_of_measurement: dBm
|
||||
accuracy_decimals: 0
|
||||
|
||||
# Guest Room
|
||||
# Guest room
|
||||
- platform: xiaomi_lywsd03mmc
|
||||
mac_address: "A4:C1:38:03:EE:C7"
|
||||
bindkey: "9e58510b59d2f2d386a15c3ae60bf59a"
|
||||
temperature:
|
||||
name: "Guest Room Temperature"
|
||||
name: "Guest room temperature"
|
||||
device_class: temperature
|
||||
state_class: measurement
|
||||
unit_of_measurement: "°C"
|
||||
accuracy_decimals: 1
|
||||
|
||||
humidity:
|
||||
name: "Guest Room Humidity"
|
||||
name: "Guest room humidity"
|
||||
device_class: humidity
|
||||
state_class: measurement
|
||||
unit_of_measurement: "%"
|
||||
accuracy_decimals: 0
|
||||
|
||||
battery_level:
|
||||
name: "Guest Room Temperature Battery"
|
||||
name: "Guest room temperature battery"
|
||||
entity_category: diagnostic
|
||||
device_class: battery
|
||||
state_class: measurement
|
||||
unit_of_measurement: "%"
|
||||
accuracy_decimals: 0
|
||||
|
||||
- platform: ble_rssi
|
||||
mac_address: "A4:C1:38:03:EE:C7"
|
||||
name: "Guest Room Temperature BLE Signal"
|
||||
name: "Guest room temperature signal"
|
||||
disabled_by_default: true
|
||||
entity_category: diagnostic
|
||||
device_class: signal_strength
|
||||
state_class: measurement
|
||||
unit_of_measurement: dBm
|
||||
accuracy_decimals: 0
|
||||
|
||||
# Lucas' Room
|
||||
- platform: xiaomi_lywsd03mmc
|
||||
mac_address: "A4:C1:38:4C:90:2D"
|
||||
bindkey: "04d5ad30b0853cadaee54053f0032cee"
|
||||
temperature:
|
||||
name: "Lucas Room Temperature"
|
||||
name: "Lucas room temperature"
|
||||
device_class: temperature
|
||||
state_class: measurement
|
||||
unit_of_measurement: "°C"
|
||||
accuracy_decimals: 1
|
||||
|
||||
humidity:
|
||||
name: "Lucas Room Humidity"
|
||||
name: "Lucas room humidity"
|
||||
device_class: humidity
|
||||
state_class: measurement
|
||||
unit_of_measurement: "%"
|
||||
accuracy_decimals: 0
|
||||
|
||||
battery_level:
|
||||
name: "Lucas Room Temperature Battery"
|
||||
name: "Lucas room temperature battery"
|
||||
entity_category: diagnostic
|
||||
device_class: battery
|
||||
state_class: measurement
|
||||
unit_of_measurement: "%"
|
||||
accuracy_decimals: 0
|
||||
|
||||
- platform: ble_rssi
|
||||
mac_address: "A4:C1:38:4C:90:2D"
|
||||
name: "Lucas Room Temperature BLE Signal"
|
||||
name: "Lucas room temperature signal"
|
||||
disabled_by_default: true
|
||||
entity_category: diagnostic
|
||||
device_class: signal_strength
|
||||
state_class: measurement
|
||||
unit_of_measurement: dBm
|
||||
accuracy_decimals: 0
|
||||
|
||||
# Upstairs Bathroom
|
||||
# Upstairs bathroom
|
||||
- platform: xiaomi_lywsd03mmc
|
||||
mac_address: "A4:C1:38:0E:D8:EA"
|
||||
bindkey: "a25c346de94877c61f3a948eb76ceab9"
|
||||
temperature:
|
||||
name: "Upstairs Bathroom Temperature"
|
||||
name: "Upstairs bathroom temperature"
|
||||
device_class: temperature
|
||||
state_class: measurement
|
||||
unit_of_measurement: "°C"
|
||||
accuracy_decimals: 1
|
||||
|
||||
humidity:
|
||||
name: "Upstairs Bathroom Humidity"
|
||||
name: "Upstairs bathroom humidity"
|
||||
device_class: humidity
|
||||
state_class: measurement
|
||||
unit_of_measurement: "%"
|
||||
accuracy_decimals: 0
|
||||
|
||||
battery_level:
|
||||
name: "Upstairs Bathroom Temperature Battery"
|
||||
name: "Upstairs bathroom temperature battery"
|
||||
entity_category: diagnostic
|
||||
device_class: battery
|
||||
state_class: measurement
|
||||
unit_of_measurement: "%"
|
||||
accuracy_decimals: 0
|
||||
|
||||
- platform: ble_rssi
|
||||
mac_address: "A4:C1:38:0E:D8:EA"
|
||||
name: "Upstairs Bathroom Temperature BLE Signal"
|
||||
|
||||
name: "Upstairs bathroom temperature signal"
|
||||
disabled_by_default: true
|
||||
entity_category: diagnostic
|
||||
device_class: signal_strength
|
||||
state_class: measurement
|
||||
unit_of_measurement: dBm
|
||||
accuracy_decimals: 0
|
||||
|
||||
|
||||
# Old round Celsius-only Sensor
|
||||
# - platform: ble_rssi
|
||||
# mac_address: $temp1_mac
|
||||
# id: ${temp1}_rssi
|
||||
# name: $temp1 BLE Signal
|
||||
# name: $temp1 signal
|
||||
# - platform: xiaomi_lywsdcgq
|
||||
# mac_address: $temp1_mac
|
||||
# temperature:
|
||||
# name: $temp1_upper Temperature
|
||||
# name: $temp1_upper temperature
|
||||
# id: ${temp1}_temperature
|
||||
# humidity:
|
||||
# name: $temp1_upper Humidity
|
||||
# name: $temp1_upper humidity
|
||||
# id: ${temp1}_humidity
|
||||
# battery_level:
|
||||
# name: ${temp1} Battery
|
||||
# name: ${temp1} battery
|
||||
# id: ${temp1}_battery
|
||||
|
||||
# - platform: ble_rssi
|
||||
# mac_address: $plant1_mac
|
||||
# id: $plant1
|
||||
# name: $plant1_upper
|
||||
# disabled_by_default: true
|
||||
# entity_category: diagnostic
|
||||
# device_class: signal_strength
|
||||
# state_class: measurement
|
||||
# unit_of_measurement: dBm
|
||||
# accuracy_decimals: 0
|
||||
|
||||
# - platform: ble_rssi
|
||||
# mac_address: $plant2_mac
|
||||
# id: $plant2
|
||||
# name: $plant2_upper
|
||||
# disabled_by_default: true
|
||||
# entity_category: diagnostic
|
||||
# device_class: signal_strength
|
||||
# state_class: measurement
|
||||
# unit_of_measurement: dBm
|
||||
# accuracy_decimals: 0
|
||||
|
||||
# - platform: ble_rssi
|
||||
# mac_address: $plant3_mac
|
||||
# id: $plant3
|
||||
# name: $plant3_upper
|
||||
# disabled_by_default: true
|
||||
# entity_category: diagnostic
|
||||
# device_class: signal_strength
|
||||
# state_class: measurement
|
||||
# unit_of_measurement: dBm
|
||||
# accuracy_decimals: 0
|
||||
|
||||
# - platform: ble_rssi
|
||||
# mac_address: $plant4_mac
|
||||
# id: $plant4
|
||||
# name: $plant4_upper
|
||||
# disabled_by_default: true
|
||||
# entity_category: diagnostic
|
||||
# device_class: signal_strength
|
||||
# state_class: measurement
|
||||
# unit_of_measurement: dBm
|
||||
# accuracy_decimals: 0
|
||||
|
||||
# - platform: ble_rssi
|
||||
# mac_address: $plant5_mac
|
||||
# id: $plant5
|
||||
# name: $plant5_upper
|
||||
# disabled_by_default: true
|
||||
# entity_category: diagnostic
|
||||
# device_class: signal_strength
|
||||
# state_class: measurement
|
||||
# unit_of_measurement: dBm
|
||||
# accuracy_decimals: 0
|
||||
|
||||
# - platform: ble_rssi
|
||||
# mac_address: $plant6_mac
|
||||
# id: $plant6
|
||||
# name: $plant6_upper
|
||||
# disabled_by_default: true
|
||||
# entity_category: diagnostic
|
||||
# device_class: signal_strength
|
||||
# state_class: measurement
|
||||
# unit_of_measurement: dBm
|
||||
# accuracy_decimals: 0
|
||||
|
||||
# - platform: xiaomi_hhccjcy01
|
||||
# mac_address: $plant1_mac
|
||||
# temperature:
|
||||
# name: $plant1_upper Temperature
|
||||
# name: $plant1_upper temperature
|
||||
# id: ${plant1}_temperature
|
||||
# filters:
|
||||
# - filter_out: nan
|
||||
# - lambda: return x * (9.0/5.0) + 32.0;
|
||||
# unit_of_measurement: "°F"
|
||||
# unit_of_measurement: "°C"
|
||||
# moisture:
|
||||
# name: $plant1_upper Moisture
|
||||
# name: $plant1_upper moisture
|
||||
# icon: mdi:water-percent
|
||||
# id: ${plant1}_moisture
|
||||
# filters:
|
||||
# - filter_out: nan
|
||||
# illuminance:
|
||||
# name: $plant1_upper Illuminance
|
||||
# name: $plant1_upper illuminance
|
||||
# id: ${plant1}_illuminance
|
||||
# filters:
|
||||
# - filter_out: nan
|
||||
# conductivity:
|
||||
# name: $plant1_upper Soil Conductivity
|
||||
# name: $plant1_upper soil conductivity
|
||||
# id: ${plant1}_conductivity
|
||||
# filters:
|
||||
# - filter_out: nan
|
||||
@@ -206,25 +380,25 @@ sensor:
|
||||
# - platform: xiaomi_hhccjcy01
|
||||
# mac_address: $plant2_mac
|
||||
# temperature:
|
||||
# name: $plant2_upper Temperature
|
||||
# name: $plant2_upper temperature
|
||||
# id: ${plant2}_temperature
|
||||
# filters:
|
||||
# - filter_out: nan
|
||||
# - lambda: return x * (9.0/5.0) + 32.0;
|
||||
# unit_of_measurement: "°F"
|
||||
# unit_of_measurement: "°C"
|
||||
# moisture:
|
||||
# name: $plant2_upper Moisture
|
||||
# name: $plant2_upper moisture
|
||||
# icon: mdi:water-percent
|
||||
# id: ${plant2}_moisture
|
||||
# filters:
|
||||
# - filter_out: nan
|
||||
# illuminance:
|
||||
# name: $plant2_upper Illuminance
|
||||
# name: $plant2_upper illuminance
|
||||
# id: ${plant2}_illuminance
|
||||
# filters:
|
||||
# - filter_out: nan
|
||||
# conductivity:
|
||||
# name: $plant2_upper Soil Conductivity
|
||||
# name: $plant2_upper soil conductivity
|
||||
# id: ${plant2}_conductivity
|
||||
# filters:
|
||||
# - filter_out: nan
|
||||
@@ -232,25 +406,25 @@ sensor:
|
||||
# - platform: xiaomi_hhccjcy01
|
||||
# mac_address: $plant3_mac
|
||||
# temperature:
|
||||
# name: $plant3_upper Temperature
|
||||
# name: $plant3_upper temperature
|
||||
# id: ${plant3}_temperature
|
||||
# filters:
|
||||
# - filter_out: nan
|
||||
# - lambda: return x * (9.0/5.0) + 32.0;
|
||||
# unit_of_measurement: "°F"
|
||||
# unit_of_measurement: "°C"
|
||||
# moisture:
|
||||
# name: $plant3_upper Moisture
|
||||
# name: $plant3_upper moisture
|
||||
# icon: mdi:water-percent
|
||||
# id: ${plant3}_moisture
|
||||
# filters:
|
||||
# - filter_out: nan
|
||||
# illuminance:
|
||||
# name: $plant3_upper Illuminance
|
||||
# name: $plant3_upper illuminance
|
||||
# id: ${plant3}_illuminance
|
||||
# filters:
|
||||
# - filter_out: nan
|
||||
# conductivity:
|
||||
# name: $plant3_upper Soil Conductivity
|
||||
# name: $plant3_upper soil conductivity
|
||||
# id: ${plant3}_conductivity
|
||||
# filters:
|
||||
# - filter_out: nan
|
||||
@@ -258,25 +432,25 @@ sensor:
|
||||
# - platform: xiaomi_hhccjcy01
|
||||
# mac_address: $plant4_mac
|
||||
# temperature:
|
||||
# name: $plant4_upper Temperature
|
||||
# name: $plant4_upper temperature
|
||||
# id: ${plant4}_temperature
|
||||
# filters:
|
||||
# - filter_out: nan
|
||||
# - lambda: return x * (9.0/5.0) + 32.0;
|
||||
# unit_of_measurement: "°F"
|
||||
# unit_of_measurement: "°C"
|
||||
# moisture:
|
||||
# name: $plant4_upper Moisture
|
||||
# name: $plant4_upper moisture
|
||||
# icon: mdi:water-percent
|
||||
# id: ${plant4}_moisture
|
||||
# filters:
|
||||
# - filter_out: nan
|
||||
# illuminance:
|
||||
# name: $plant4_upper Illuminance
|
||||
# name: $plant4_upper illuminance
|
||||
# id: ${plant4}_illuminance
|
||||
# filters:
|
||||
# - filter_out: nan
|
||||
# conductivity:
|
||||
# name: $plant4_upper Soil Conductivity
|
||||
# name: $plant4_upper soil conductivity
|
||||
# id: ${plant4}_conductivity
|
||||
# filters:
|
||||
# - filter_out: nan
|
||||
@@ -284,25 +458,25 @@ sensor:
|
||||
# - platform: xiaomi_hhccjcy01
|
||||
# mac_address: $plant5_mac
|
||||
# temperature:
|
||||
# name: $plant5_upper Temperature
|
||||
# name: $plant5_upper temperature
|
||||
# id: ${plant5}_temperature
|
||||
# filters:
|
||||
# - filter_out: nan
|
||||
# - lambda: return x * (9.0/5.0) + 32.0;
|
||||
# unit_of_measurement: "°F"
|
||||
# unit_of_measurement: "°C"
|
||||
# moisture:
|
||||
# name: $plant5_upper Moisture
|
||||
# name: $plant5_upper moisture
|
||||
# icon: mdi:water-percent
|
||||
# id: ${plant5}_moisture
|
||||
# filters:
|
||||
# - filter_out: nan
|
||||
# illuminance:
|
||||
# name: $plant5_upper Illuminance
|
||||
# name: $plant5_upper illuminance
|
||||
# id: ${plant5}_illuminance
|
||||
# filters:
|
||||
# - filter_out: nan
|
||||
# conductivity:
|
||||
# name: $plant5_upper Soil Conductivity
|
||||
# name: $plant5_upper soil conductivity
|
||||
# id: ${plant5}_conductivity
|
||||
# filters:
|
||||
# - filter_out: nan
|
||||
@@ -310,25 +484,25 @@ sensor:
|
||||
# - platform: xiaomi_hhccjcy01
|
||||
# mac_address: $plant6_mac
|
||||
# temperature:
|
||||
# name: $plant6_upper Temperature
|
||||
# name: $plant6_upper temperature
|
||||
# id: ${plant6}_temperature
|
||||
# filters:
|
||||
# - filter_out: nan
|
||||
# - lambda: return x * (9.0/5.0) + 32.0;
|
||||
# unit_of_measurement: "°F"
|
||||
# unit_of_measurement: "°C"
|
||||
# moisture:
|
||||
# name: $plant6_upper Moisture
|
||||
# name: $plant6_upper moisture
|
||||
# icon: mdi:water-percent
|
||||
# id: ${plant6}_moisture
|
||||
# filters:
|
||||
# - filter_out: nan
|
||||
# illuminance:
|
||||
# name: $plant6_upper Illuminance
|
||||
# name: $plant6_upper illuminance
|
||||
# id: ${plant6}_illuminance
|
||||
# filters:
|
||||
# - filter_out: nan
|
||||
# conductivity:
|
||||
# name: $plant6_upper Soil Conductivity
|
||||
# name: $plant6_upper soil conductivity
|
||||
# id: ${plant6}_conductivity
|
||||
# filters:
|
||||
# - filter_out: nan
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
---
|
||||
platform: gpio
|
||||
pin:
|
||||
number: $button_gpio
|
||||
mode: INPUT_PULLUP
|
||||
id: ${id}_button
|
||||
internal: true
|
||||
on_press:
|
||||
- switch.toggle: relay
|
||||
filters:
|
||||
- delayed_on: 10ms
|
||||
---
|
||||
platform: gpio
|
||||
pin:
|
||||
number: $button_gpio
|
||||
mode: INPUT_PULLUP
|
||||
id: ${id}_button
|
||||
internal: true
|
||||
on_press:
|
||||
- switch.toggle: relay
|
||||
filters:
|
||||
- delayed_on: 10ms
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
---
|
||||
platform: gpio
|
||||
pin:
|
||||
number: $button_gpio
|
||||
mode: INPUT_PULLUP
|
||||
inverted: True
|
||||
id: ${id}_button
|
||||
internal: true
|
||||
on_press:
|
||||
- switch.toggle: relay
|
||||
filters:
|
||||
- delayed_on: 10ms
|
||||
---
|
||||
platform: gpio
|
||||
pin:
|
||||
number: $button_gpio
|
||||
mode: INPUT_PULLUP
|
||||
inverted: True
|
||||
id: ${id}_button
|
||||
internal: true
|
||||
on_press:
|
||||
- switch.toggle: relay
|
||||
filters:
|
||||
- delayed_on: 10ms
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
platform: status
|
||||
name: $project Status
|
||||
---
|
||||
platform: status
|
||||
name: $project Status
|
||||
entity_category: diagnostic
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
# https://esphome.io/devices/nodemcu_esp32.html
|
||||
esphome:
|
||||
name: $id
|
||||
name: $hostname
|
||||
platform: ESP32
|
||||
board: nodemcu-32s
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
esphome:
|
||||
name: $id
|
||||
platform: ESP32
|
||||
board: esp-wrover-kit
|
||||
---
|
||||
esphome:
|
||||
name: $hostname
|
||||
platform: ESP32
|
||||
board: esp-wrover-kit
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
esphome:
|
||||
name: $id
|
||||
platform: ESP8266
|
||||
board: esp01_1m
|
||||
---
|
||||
esphome:
|
||||
name: $hostname
|
||||
platform: ESP8266
|
||||
board: esp01_1m
|
||||
|
||||
@@ -1,8 +1,33 @@
|
||||
---
|
||||
platform: cse7766
|
||||
current:
|
||||
name: $project Current
|
||||
name: $project current
|
||||
entity_category: diagnostic
|
||||
disabled_by_default: true
|
||||
device_class: current
|
||||
state_class: measurement
|
||||
unit_of_measurement: A
|
||||
accuracy_decimals: 1
|
||||
voltage:
|
||||
name: $project Voltage
|
||||
name: $project voltage
|
||||
entity_category: diagnostic
|
||||
disabled_by_default: true
|
||||
device_class: voltage
|
||||
state_class: measurement
|
||||
unit_of_measurement: V
|
||||
accuracy_decimals: 0
|
||||
power:
|
||||
name: $project Power
|
||||
name: $project power
|
||||
entity_category: diagnostic
|
||||
device_class: energy
|
||||
state_class: measurement
|
||||
unit_of_measurement: W
|
||||
accuracy_decimals: 0
|
||||
energy:
|
||||
name: $project energy
|
||||
device_class: energy
|
||||
state_class: total_increasing
|
||||
unit_of_measurement: kWh
|
||||
accuracy_decimals: 1
|
||||
# filters:
|
||||
# - multiply: 0.001
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
platform: uptime
|
||||
name: $project Uptime
|
||||
unit_of_measurement: h
|
||||
filters:
|
||||
- lambda: return int((x + 1800.0) / 3600.0);
|
||||
---
|
||||
platform: uptime
|
||||
name: $project Uptime
|
||||
unit_of_measurement: h
|
||||
entity_category: diagnostic
|
||||
filters:
|
||||
- lambda: return int((x + 1800.0) / 3600.0);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
---
|
||||
platform: wifi_signal
|
||||
name: $project WiFi Signal
|
||||
update_interval: 30s
|
||||
---
|
||||
platform: wifi_signal
|
||||
name: $project WiFi Signal
|
||||
update_interval: 30s
|
||||
entity_category: diagnostic
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
platform: gpio
|
||||
name: $project
|
||||
name: $project
|
||||
id: relay
|
||||
pin: $relay_gpio
|
||||
# disable following line to enable restore_mode: RESTORE_DEFAULT_OFF (default)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
platform: gpio
|
||||
name: $project
|
||||
name: $project
|
||||
id: relay
|
||||
pin: $relay_gpio
|
||||
restore_mode: ALWAYS_ON
|
||||
|
||||
@@ -2,4 +2,5 @@
|
||||
platform: gpio
|
||||
id: relay
|
||||
pin: $relay_gpio
|
||||
internal: true
|
||||
restore_mode: ALWAYS_ON
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
---
|
||||
platform: gpio
|
||||
name: $project
|
||||
#name: $project
|
||||
id: relay
|
||||
pin: $relay_gpio
|
||||
internal: true
|
||||
# disable following line to enable restore_mode: RESTORE_DEFAULT_OFF (default)
|
||||
#restore_mode: ALWAYS_OFF
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
platform: gpio
|
||||
id: relay
|
||||
name: $project
|
||||
pin: GPIO15
|
||||
id: relay
|
||||
pin: $relay_gpio
|
||||
on_turn_on:
|
||||
- light.turn_off: status_led
|
||||
##### Make sure this relay does not stay on all day. #####
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
---
|
||||
esphome:
|
||||
name: ${id}
|
||||
name: $hostname
|
||||
platform: ESP8266
|
||||
board: esp01_1m
|
||||
|
||||
|
||||
<<: !include ../esphome/leds/status.yaml
|
||||
|
||||
<<: !include ../wifi.yaml
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
---
|
||||
esphome:
|
||||
name: $hostname
|
||||
platform: ESP8266
|
||||
board: esp01_1m
|
||||
|
||||
<<: !include ../esphome/leds/status.yaml
|
||||
|
||||
<<: !include ../wifi.yaml
|
||||
<<: !include ../ota.yaml
|
||||
<<: !include ../api.yaml
|
||||
<<: !include ../logger.yaml
|
||||
|
||||
binary_sensor:
|
||||
- !include ../binary_sensors/power_button_inverted.yaml
|
||||
|
||||
light:
|
||||
- !include ../lights/status_led.yaml
|
||||
|
||||
output:
|
||||
- !include ../outputs/status_led.yaml
|
||||
|
||||
switch:
|
||||
- !include ../switches/relay_internal.yaml
|
||||
- !include ../switches/relay_status_led.yaml
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
esphome:
|
||||
name: ${id}
|
||||
name: $hostname
|
||||
platform: ESP8266
|
||||
board: esp01_1m
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
---
|
||||
esphome:
|
||||
name: $id
|
||||
name: $hostname
|
||||
platform: ESP8266
|
||||
board: esp01_1m
|
||||
|
||||
|
||||
<<: !include ../esphome/leds/status.yaml
|
||||
|
||||
<<: !include ../wifi.yaml
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
esphome:
|
||||
name: $id
|
||||
name: $hostname
|
||||
platform: ESP8266
|
||||
board: esp01_1m
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
platform: version
|
||||
name: $project Esphome Version
|
||||
---
|
||||
platform: version
|
||||
name: $project Esphome Version
|
||||
entity_category: diagnostic
|
||||
|
||||
+5
-4
@@ -1,4 +1,5 @@
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_pass
|
||||
#reboot_timeout: 0s # Disable reboots for when Home Assistant is offline for an extended time.
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_pass
|
||||
use_address: $ip
|
||||
#reboot_timeout: 0s # Disable reboots for when Home Assistant is offline for an extended time.
|
||||
|
||||
+11
-11
@@ -1,11 +1,11 @@
|
||||
---
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_pass
|
||||
|
||||
# Fallback Hotspot (requires "captive_portal:").
|
||||
ap:
|
||||
ssid: $id
|
||||
password: !secret failover_password
|
||||
|
||||
captive_portal:
|
||||
---
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_pass
|
||||
|
||||
# Fallback Hotspot (requires "captive_portal:").
|
||||
ap:
|
||||
ssid: $id
|
||||
password: !secret failover_password
|
||||
|
||||
captive_portal:
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_pass
|
||||
use_address: $ip
|
||||
+7
-8
@@ -1,11 +1,10 @@
|
||||
#include "esphome.h"
|
||||
using namespace std;
|
||||
|
||||
// Declare functions before calling them.
|
||||
bool scheduled_runtime(string);
|
||||
string update_next_runtime(string);
|
||||
bool scheduled_runtime(std::string);
|
||||
std::string update_next_runtime(std::string);
|
||||
|
||||
bool scheduled_runtime(string time) {
|
||||
bool scheduled_runtime(std::string time) {
|
||||
// Retrieve the current time.
|
||||
auto time_now = id(homeassistant_time).now();
|
||||
int time_hour = time_now.hour;
|
||||
@@ -19,10 +18,10 @@ bool scheduled_runtime(string time) {
|
||||
return (time_hour == next_hour && time_minute == next_minute);
|
||||
}
|
||||
|
||||
string update_next_runtime(string time_list) {
|
||||
std::string update_next_runtime(std::string time_list) {
|
||||
// Initialize variables.
|
||||
vector<string> times;
|
||||
vector<string> next_time;
|
||||
std::vector<std::string> times;
|
||||
std::vector<std::string> next_time;
|
||||
char * token;
|
||||
|
||||
// Split the list of run times into an array.
|
||||
@@ -51,7 +50,7 @@ string update_next_runtime(string time_list) {
|
||||
|
||||
// Compare the list of times with the current time, and return the next in the list.
|
||||
//ESP_LOGD("update_next_runtime", "now: %i:%i", hour, minute);
|
||||
for (string time : times) {
|
||||
for (std::string time : times) {
|
||||
// Retrieve the next scheduled time from the list.
|
||||
next_hour = atoi(time.substr(0,2).c_str());
|
||||
next_minute = atoi(time.substr(3,2).c_str());
|
||||
|
||||
+22
-15
@@ -6,13 +6,16 @@
|
||||
# Personal project goals: https://github.com/brianhanifin/Home-Assistant-Config/issues/37
|
||||
#
|
||||
substitutions:
|
||||
project: Irrigation Controller
|
||||
project: Irrigation controller
|
||||
id: irrigation
|
||||
hostname: irrigation
|
||||
zone1_name: Front yard drip
|
||||
zone2_name: Pool filler
|
||||
|
||||
<<: !include common/substitutions/gpio/sonoff4chpror2.yaml
|
||||
|
||||
esphome:
|
||||
name: $id
|
||||
name: $hostname
|
||||
platform: ESP8266
|
||||
board: esp01_1m
|
||||
includes:
|
||||
@@ -111,10 +114,12 @@ binary_sensor:
|
||||
|
||||
number:
|
||||
- platform: template
|
||||
name: Irrigation Zone1 Duration
|
||||
name: $zone1_name duration
|
||||
id: irrigation_zone1_duration
|
||||
#id: ui_zone1_duration
|
||||
icon: mdi:timer-sand
|
||||
#mode: slider #auto, box, slider
|
||||
#unit_of_measurement: minutes
|
||||
optimistic: true
|
||||
initial_value: 0
|
||||
restore_value: true
|
||||
@@ -128,10 +133,12 @@ number:
|
||||
# value: !lambda return id(ui_zone1_duration).state;
|
||||
|
||||
- platform: template
|
||||
name: Irrigation Zone2 Duration
|
||||
name: $zone2_name duration
|
||||
id: irrigation_zone2_duration
|
||||
#id: ui_zone2_duration
|
||||
icon: mdi:timer-sand
|
||||
#mode: slider #auto, box, slider
|
||||
#unit_of_measurement: minutes
|
||||
optimistic: true
|
||||
initial_value: 0
|
||||
restore_value: true
|
||||
@@ -152,7 +159,7 @@ sensor:
|
||||
# ============================================================================= #
|
||||
# Countdown sensors.
|
||||
- platform: template
|
||||
name: Irrigation Zone1 Remaining
|
||||
name: $zone1_name remaining
|
||||
id: irrigation_zone1_remaining
|
||||
lambda: "return 0;"
|
||||
accuracy_decimals: 0
|
||||
@@ -167,7 +174,7 @@ sensor:
|
||||
- switch.turn_off: relay1
|
||||
|
||||
- platform: template
|
||||
name: Irrigation Zone2 Remaining
|
||||
name: $zone2_name remaining
|
||||
id: irrigation_zone2_remaining
|
||||
lambda: "return 0;"
|
||||
accuracy_decimals: 0
|
||||
@@ -204,10 +211,10 @@ sensor:
|
||||
# ============================================================================= #
|
||||
# Store durations.
|
||||
# - platform: template
|
||||
# name: Irrigation Zone1 Duration
|
||||
# name: $zone1_name duration
|
||||
# id: irrigation_zone1_duration
|
||||
# - platform: template
|
||||
# name: Irrigation Zone2 Duration
|
||||
# name: $zone2_name duration
|
||||
# id: irrigation_zone2_duration
|
||||
|
||||
|
||||
@@ -215,9 +222,9 @@ switch:
|
||||
- !include common/switches/restart.yaml
|
||||
|
||||
# ============================================================================= #
|
||||
# Virtual Zone Switches which toggle the relay, and store the current state.
|
||||
# Virtual zone Switches which toggle the relay, and store the current state.
|
||||
- platform: template
|
||||
name: Irrigation Zone1
|
||||
name: $zone1_name
|
||||
id: irrigation_zone1
|
||||
lambda: return id(relay1).state;
|
||||
optimistic: true
|
||||
@@ -232,7 +239,7 @@ switch:
|
||||
- switch.turn_off: relay1
|
||||
|
||||
- platform: template
|
||||
name: Irrigation Zone2
|
||||
name: $zone2_name
|
||||
id: irrigation_zone2
|
||||
lambda: return id(relay2).state;
|
||||
optimistic: true
|
||||
@@ -331,7 +338,7 @@ text_sensor:
|
||||
# ============================================================================= #
|
||||
# Store time lists.
|
||||
- platform: template
|
||||
name: Irrigation Zone1 Times
|
||||
name: $zone1_name times
|
||||
id: irrigation_zone1_times
|
||||
on_value:
|
||||
then:
|
||||
@@ -342,7 +349,7 @@ text_sensor:
|
||||
return update_next_runtime(id(irrigation_zone1_times).state);
|
||||
|
||||
- platform: template
|
||||
name: Irrigation Zone2 Times
|
||||
name: $zone2_name times
|
||||
id: irrigation_zone2_times
|
||||
on_value:
|
||||
then:
|
||||
@@ -355,10 +362,10 @@ text_sensor:
|
||||
# ============================================================================= #
|
||||
# Set the next scheduled time.
|
||||
- platform: template
|
||||
name: Irrigation Zone1 Next
|
||||
name: $zone1_name next
|
||||
id: irrigation_zone1_next
|
||||
- platform: template
|
||||
name: Irrigation Zone2 Next
|
||||
name: $zone2_name next
|
||||
id: irrigation_zone2_next
|
||||
|
||||
|
||||
|
||||
+24
-10
@@ -1,10 +1,24 @@
|
||||
---
|
||||
# Luntak brand Tuya Plug
|
||||
#
|
||||
substitutions:
|
||||
project: Plug01
|
||||
id: plug01
|
||||
|
||||
<<: !include common/substitutions/gpio/tuya_plug.yaml
|
||||
|
||||
<<: !include common/templates/plug.yaml
|
||||
---
|
||||
# Luntak brand Tuya Plug
|
||||
#
|
||||
substitutions:
|
||||
project: Plug01
|
||||
id: plug01
|
||||
hostname: plug01
|
||||
|
||||
<<: !include common/substitutions/gpio/tuya_plug.yaml
|
||||
|
||||
<<: !include common/templates/plug.yaml
|
||||
|
||||
# esphome:
|
||||
# name: $hostname
|
||||
# platform: ESP8266
|
||||
# board: esp01_1m
|
||||
|
||||
# wifi:
|
||||
# ssid: !secret wifi_ssid
|
||||
# password: !secret wifi_pass
|
||||
# use_address: plug01.local
|
||||
|
||||
# <<: !include common/ota.yaml
|
||||
# <<: !include common/api.yaml
|
||||
|
||||
+4
-3
@@ -1,10 +1,11 @@
|
||||
---
|
||||
# Luntak brand Tuya Plug
|
||||
# Luntak brand Tuya Plug (plug02)
|
||||
#
|
||||
substitutions:
|
||||
project: Plug02
|
||||
project: plug02
|
||||
id: plug02
|
||||
hostname: plug02
|
||||
|
||||
<<: !include common/substitutions/gpio/tuya_plug.yaml
|
||||
|
||||
<<: !include common/templates/plug_no_status_lights.yaml
|
||||
<<: !include common/templates/plug.yaml
|
||||
|
||||
+4
-3
@@ -2,9 +2,10 @@
|
||||
# Luntak brand Tuya Plug
|
||||
#
|
||||
substitutions:
|
||||
project: Plug03
|
||||
id: plug03
|
||||
project: Sound machine
|
||||
id: sound_machine
|
||||
hostname: plug-sound
|
||||
|
||||
<<: !include common/substitutions/gpio/tuya_plug.yaml
|
||||
|
||||
<<: !include common/templates/plug.yaml
|
||||
<<: !include common/templates/plug_no_status_lights.yaml
|
||||
|
||||
+3
-2
@@ -2,8 +2,9 @@
|
||||
# Luntak brand Tuya Plug
|
||||
#
|
||||
substitutions:
|
||||
project: Plug04
|
||||
id: plug04
|
||||
project: Printer
|
||||
id: printer
|
||||
hostname: plug-printer
|
||||
|
||||
<<: !include common/substitutions/gpio/tuya_plug.yaml
|
||||
|
||||
|
||||
+4
-25
@@ -2,32 +2,11 @@
|
||||
# Luntak brand Tuya Plug
|
||||
#
|
||||
substitutions:
|
||||
project: Hot Water Pump
|
||||
id: plug05
|
||||
project: Hot water pump
|
||||
id: hot_water_pump
|
||||
hostname: plug-pump
|
||||
off_delay: 10min
|
||||
|
||||
<<: !include common/substitutions/gpio/tuya_plug.yaml
|
||||
|
||||
esphome:
|
||||
name: ${id}
|
||||
platform: ESP8266
|
||||
board: esp01_1m
|
||||
|
||||
<<: !include common/esphome/leds/status.yaml
|
||||
|
||||
<<: !include common/wifi.yaml
|
||||
<<: !include common/ota.yaml
|
||||
<<: !include common/api.yaml
|
||||
<<: !include common/logger.yaml
|
||||
|
||||
binary_sensor:
|
||||
- !include common/binary_sensors/power_button_inverted.yaml
|
||||
|
||||
light:
|
||||
- !include common/lights/status_led.yaml
|
||||
|
||||
output:
|
||||
- !include common/outputs/status_led.yaml
|
||||
|
||||
switch:
|
||||
- !include common/switches/relay_status_led_off_delay.yaml
|
||||
<<: !include common/templates/plug_led_off_delay.yaml
|
||||
|
||||
+56
-4
@@ -1,10 +1,62 @@
|
||||
---
|
||||
# Luntak brand Tuya Plug
|
||||
# Luntak brand Tuya Plug (plug02)
|
||||
#
|
||||
substitutions:
|
||||
project: Plug06
|
||||
id: plug06
|
||||
project: WirelessAP2 power cycler
|
||||
id: wirelessap2_power_cycler
|
||||
hostname: plug-wirelessap2
|
||||
ip: 10.0.20.66
|
||||
|
||||
<<: !include common/substitutions/gpio/tuya_plug.yaml
|
||||
|
||||
<<: !include common/templates/plug.yaml
|
||||
esphome:
|
||||
name: $hostname
|
||||
platform: ESP8266
|
||||
board: esp01_1m
|
||||
|
||||
<<: !include common/esphome/leds/status.yaml
|
||||
|
||||
|
||||
<<: !include common/wifi_ip.yaml
|
||||
<<: !include common/ota.yaml
|
||||
<<: !include common/api.yaml
|
||||
<<: !include common/logger.yaml
|
||||
|
||||
binary_sensor:
|
||||
- !include common/binary_sensors/power_button_inverted.yaml
|
||||
|
||||
light:
|
||||
- !include common/lights/status_led.yaml
|
||||
|
||||
output:
|
||||
- !include common/outputs/status_led.yaml
|
||||
|
||||
switch:
|
||||
- platform: gpio
|
||||
name: $project
|
||||
id: relay
|
||||
pin: $relay_gpio
|
||||
internal: true
|
||||
restore_mode: ALWAYS_ON # On at boot
|
||||
# Restart after slight delay.
|
||||
on_turn_off:
|
||||
- delay: 15s
|
||||
- switch.turn_on: relay
|
||||
|
||||
- !include common/switches/relay_status_led.yaml
|
||||
|
||||
text_sensor:
|
||||
- platform: homeassistant
|
||||
id: online_state
|
||||
internal: true
|
||||
entity_id: device_tracker.wirelessap2
|
||||
on_value:
|
||||
#- lambda: ESP_LOGD("online_state", "%s", id(online_state));
|
||||
- if:
|
||||
condition:
|
||||
for:
|
||||
time: 1min
|
||||
condition:
|
||||
- lambda: return id(online_state).state == "not_home";
|
||||
then:
|
||||
- switch.turn_off: relay
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
substitutions:
|
||||
project: Plug07
|
||||
id: plug07
|
||||
hostname: plug07
|
||||
|
||||
<<: !include common/substitutions/gpio/tuya_plug.yaml
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
substitutions:
|
||||
project: Pool Sensors
|
||||
id: pool
|
||||
hostname: pool
|
||||
|
||||
air_temp_gpio: GPIO19
|
||||
|
||||
|
||||
+14
-10
@@ -1,12 +1,13 @@
|
||||
---
|
||||
# Shelly 1 Power Module
|
||||
# Location: Dining Room Light Switch
|
||||
# Location: Dining room light wall switch
|
||||
#
|
||||
substitutions:
|
||||
project: Dining Room Light Switch
|
||||
project: Dining room light wall switch
|
||||
id: switchdining
|
||||
hostname: switch-dining
|
||||
|
||||
hass_light: light.dining_room
|
||||
light_entity: light.dining_room
|
||||
|
||||
<<: !include common/substitutions/gpio/shelly1.yaml
|
||||
|
||||
@@ -14,7 +15,7 @@ substitutions:
|
||||
<<: !include common/common.yaml
|
||||
|
||||
script:
|
||||
- id: hass_light_toggle
|
||||
- id: light_entity_toggle
|
||||
then:
|
||||
if:
|
||||
condition:
|
||||
@@ -26,17 +27,17 @@ script:
|
||||
then:
|
||||
# Turn the relay back on and turn on the light.
|
||||
- switch.turn_on: relay
|
||||
|
||||
|
||||
- homeassistant.service:
|
||||
service: light.turn_on
|
||||
data:
|
||||
entity_id: $hass_light
|
||||
entity_id: $light_entity
|
||||
else:
|
||||
# Have Home Assistant toggle the light.
|
||||
- homeassistant.service:
|
||||
service: light.toggle
|
||||
data:
|
||||
entity_id: $hass_light
|
||||
entity_id: $light_entity
|
||||
else:
|
||||
# When HA is unavailable, toggle the relay.
|
||||
- switch.toggle: relay
|
||||
@@ -45,13 +46,16 @@ binary_sensor:
|
||||
- platform: gpio
|
||||
pin:
|
||||
number: $button_gpio
|
||||
name: $project Wall Switch
|
||||
name: $project
|
||||
id: button
|
||||
internal: true
|
||||
#disabled_by_default: true
|
||||
#entity_category: diagnostic
|
||||
filters:
|
||||
- delayed_on: 10ms
|
||||
- delayed_off: 10ms
|
||||
on_state:
|
||||
- script.execute: hass_light_toggle
|
||||
- script.execute: light_entity_toggle
|
||||
|
||||
switch:
|
||||
<<: !include common/switches/relay_always_on_internal.yaml
|
||||
<<: !include common/switches/relay_always_on_internal.yaml
|
||||
|
||||
+112
-75
@@ -1,12 +1,13 @@
|
||||
---
|
||||
# Shelly 2 Power Module
|
||||
# Location: Upstairs Bathroom
|
||||
# Location: Upstairs bathroom
|
||||
#
|
||||
substitutions:
|
||||
project: Upstairs Bathroom Exhaust
|
||||
id: shelly1_02
|
||||
default_humidity_diff_threshold: "10" # Difference between house humidity and bathroom humidity.
|
||||
countdown_duration: "600" # 600 seconds = 10 minutes
|
||||
project: Upstairs bathroom exhaust
|
||||
id: switchexhaust
|
||||
hostname: switch-exhaust
|
||||
default_humidity_delta_threshold: "1.0" # Difference between house humidity and bathroom humidity.
|
||||
timeout_duration: "600" # 600 seconds = 10 minutes
|
||||
|
||||
<<: !include common/substitutions/gpio/shelly1.yaml
|
||||
|
||||
@@ -14,11 +15,19 @@ substitutions:
|
||||
<<: !include common/common.yaml
|
||||
|
||||
script:
|
||||
- id: countdown_restart
|
||||
- id: timeout_restart
|
||||
then:
|
||||
#- if:
|
||||
# condition:
|
||||
# - lambda: return id(remaining_time) < $timeout_duration;
|
||||
# then:
|
||||
- globals.set:
|
||||
id: remaining_time
|
||||
value: !lambda return $countdown_duration;
|
||||
value: !lambda return $timeout_duration;
|
||||
|
||||
- sensor.template.publish:
|
||||
id: timeout
|
||||
state: !lambda return id(remaining_time);
|
||||
|
||||
binary_sensor:
|
||||
# Physical Toggle Switch. Monitor for switch position changes internally. Do not expose to Home Assistant.
|
||||
@@ -32,9 +41,13 @@ binary_sensor:
|
||||
on_state:
|
||||
- switch.toggle: relay
|
||||
|
||||
- text_sensor.template.publish:
|
||||
id: trigger
|
||||
state: PHYSICAL
|
||||
- if:
|
||||
condition:
|
||||
- lambda: return id(diagnostic_last_trigger).state != "PHYSICAL";
|
||||
then:
|
||||
- text_sensor.template.publish:
|
||||
id: diagnostic_last_trigger
|
||||
state: PHYSICAL
|
||||
|
||||
# Use motion detection to keep fan running.
|
||||
- platform: homeassistant
|
||||
@@ -47,121 +60,138 @@ globals:
|
||||
restore_value: no
|
||||
initial_value: "0"
|
||||
|
||||
- id: humidity_diff
|
||||
type: float
|
||||
restore_value: no
|
||||
initial_value: "0.1"
|
||||
# - id: delta_trigger
|
||||
# type: float
|
||||
# restore_value: no
|
||||
# initial_value: $default_humidity_delta_threshold
|
||||
|
||||
- id: diff_trigger
|
||||
type: float
|
||||
restore_value: no
|
||||
initial_value: $default_humidity_diff_threshold
|
||||
|
||||
# Update the countdown timers every 5 seconds.
|
||||
# Update the timeout timers every 5 seconds.
|
||||
interval:
|
||||
- interval: 5s
|
||||
then:
|
||||
#- lambda: ESP_LOGD("interval", "diff %.1f > trigger %.1f", id(humidity_diff), id(diff_trigger));
|
||||
#- lambda: ESP_LOGD("interval", "diff %.1f > trigger %.1f ", id(humidity_delta).state, id(delta_trigger).state);
|
||||
|
||||
- if: # Humidity threshold trigger.
|
||||
condition:
|
||||
and:
|
||||
# If the difference is greater than the trigger.
|
||||
- lambda: return id(humidity_diff) > id(diff_trigger);
|
||||
# - sensor.in_range:
|
||||
# id: humidity_diff
|
||||
# above: $default_humidity_diff_threshold
|
||||
|
||||
- lambda: return id(humidity_delta).state > id(delta_trigger).state;
|
||||
|
||||
# and the fan is off.
|
||||
- switch.is_off: relay
|
||||
then:
|
||||
then:
|
||||
- switch.turn_on: relay
|
||||
|
||||
- if: # When motion is active, restart the countdown.
|
||||
- if:
|
||||
condition:
|
||||
- lambda: return id(diagnostic_last_trigger).state != "THRESHOLD";
|
||||
then:
|
||||
- text_sensor.template.publish:
|
||||
id: diagnostic_last_trigger
|
||||
state: THRESHOLD
|
||||
|
||||
- if: # Restart the timeout if motion is active.
|
||||
condition:
|
||||
- binary_sensor.is_on: motion
|
||||
then:
|
||||
- script.execute: countdown_restart
|
||||
- script.execute: timeout_restart
|
||||
|
||||
- if: # Decrement the countdown.
|
||||
- if: # Decrement the timeout.
|
||||
condition:
|
||||
and:
|
||||
- lambda: return id(remaining_time) > 0;
|
||||
- lambda: return id(humidity_delta).state <= id(delta_trigger).state;
|
||||
- switch.is_on: relay
|
||||
then:
|
||||
- globals.set:
|
||||
id: remaining_time
|
||||
value: !lambda return id(remaining_time) -= 5;
|
||||
- sensor.template.publish:
|
||||
id: countdown
|
||||
id: timeout
|
||||
state: !lambda return id(remaining_time);
|
||||
|
||||
# Time to turn off the relay.
|
||||
else:
|
||||
- if: # Decrement the countdown.
|
||||
- if:
|
||||
condition:
|
||||
- switch.is_on: relay
|
||||
then:
|
||||
- switch.turn_off: relay
|
||||
- if:
|
||||
condition:
|
||||
# If the difference is greater than the trigger.
|
||||
- lambda: return id(humidity_delta).state > id(delta_trigger).state;
|
||||
then:
|
||||
- script.execute: timeout_restart
|
||||
else:
|
||||
# Only turn the fan off if the humidity difference is below the trigger.
|
||||
- switch.turn_off: relay
|
||||
|
||||
number:
|
||||
- platform: template
|
||||
name: Upstairs Bathroom Humidity Trigger
|
||||
id: diff_trigger_ui
|
||||
icon: "mdi:water-percent"
|
||||
name: "$project humidity delta trigger"
|
||||
#id: delta_trigger_ui
|
||||
id: delta_trigger
|
||||
icon: "mdi:rocket-launch"
|
||||
entity_category: config
|
||||
unit_of_measurement: "%"
|
||||
optimistic: true
|
||||
initial_value: $default_humidity_diff_threshold
|
||||
initial_value: $default_humidity_delta_threshold
|
||||
restore_value: true
|
||||
min_value: 5
|
||||
max_value: 15
|
||||
min_value: 0.5
|
||||
max_value: 15.0
|
||||
step: 0.5
|
||||
set_action:
|
||||
then:
|
||||
- globals.set:
|
||||
id: diff_trigger
|
||||
value: !lambda return id(diff_trigger_ui).state;
|
||||
# set_action:
|
||||
# then:
|
||||
# - globals.set:
|
||||
# id: delta_trigger
|
||||
# value: !lambda return id(delta_trigger_ui).state;
|
||||
|
||||
sensor:
|
||||
# Measure the difference between the house humidity and bathroom humidity from Home Assistant.
|
||||
- platform: template
|
||||
id: timeout
|
||||
name: "$project timeout"
|
||||
accuracy_decimals: 0
|
||||
icon: "mdi:sort-clock-ascending"
|
||||
entity_category: diagnostic
|
||||
unit_of_measurement: "seconds"
|
||||
|
||||
- platform: homeassistant
|
||||
id: humidity_diff_ha
|
||||
id: humidity_24h
|
||||
internal: true
|
||||
accuracy_decimals: 1
|
||||
entity_id: sensor.upstairs_bathroom_humidity_difference
|
||||
entity_id: sensor.upstairs_bathroom_humidity_average_last_24_hours
|
||||
unit_of_measurement: "%"
|
||||
|
||||
- platform: homeassistant
|
||||
id: humidity_now
|
||||
internal: true
|
||||
accuracy_decimals: 1
|
||||
entity_id: sensor.upstairs_bathroom_humidity
|
||||
unit_of_measurement: "%"
|
||||
on_value:
|
||||
then:
|
||||
- globals.set:
|
||||
id: humidity_diff
|
||||
value: !lambda return id(humidity_diff_ha).state;
|
||||
|
||||
# Retrieve the difference trigger value from the Home Assistant UI.
|
||||
# - platform: homeassistant
|
||||
# id: diff_trigger_ha
|
||||
# internal: true
|
||||
# accuracy_decimals: 1
|
||||
# entity_id: input_number.upstairs_bath_humidity_trigger
|
||||
# on_value:
|
||||
# then:
|
||||
# - globals.set:
|
||||
# id: diff_trigger
|
||||
# value: !lambda return id(diff_trigger_ha).state;
|
||||
- sensor.template.publish:
|
||||
id: humidity_delta
|
||||
state: !lambda return id(humidity_now).state - id(humidity_24h).state;
|
||||
|
||||
- platform: template
|
||||
id: countdown
|
||||
name: "$project: Countdown"
|
||||
accuracy_decimals: 0
|
||||
icon: "mdi:camera-timer"
|
||||
id: humidity_delta
|
||||
name: "$project humidity delta"
|
||||
accuracy_decimals: 1
|
||||
icon: "mdi:delta"
|
||||
entity_category: diagnostic
|
||||
unit_of_measurement: "%"
|
||||
|
||||
switch:
|
||||
- platform: gpio
|
||||
id: relay
|
||||
pin: $relay_gpio
|
||||
on_turn_on:
|
||||
# Start the countdown timer.
|
||||
- script.execute: countdown_restart
|
||||
# Start the timeout timer.
|
||||
- script.execute: timeout_restart
|
||||
on_turn_off:
|
||||
- sensor.template.publish:
|
||||
id: countdown
|
||||
id: timeout
|
||||
state: 0
|
||||
|
||||
- platform: template
|
||||
@@ -172,15 +202,22 @@ switch:
|
||||
return (id(relay).state);
|
||||
turn_on_action:
|
||||
- switch.turn_on: relay
|
||||
|
||||
- text_sensor.template.publish:
|
||||
id: trigger
|
||||
state: VIRTUAL
|
||||
|
||||
|
||||
- if:
|
||||
condition:
|
||||
- lambda: return id(diagnostic_last_trigger).state != "VIRTUAL";
|
||||
then:
|
||||
- text_sensor.template.publish:
|
||||
id: diagnostic_last_trigger
|
||||
state: VIRTUAL
|
||||
turn_off_action:
|
||||
- switch.turn_off: relay
|
||||
|
||||
text_sensor:
|
||||
# Trigger states: PHYSICAL, VIRTUAL (UI or Alexa/Google), THRESHOLD
|
||||
- platform: template
|
||||
id: trigger
|
||||
name: "$project: Last Trigger"
|
||||
id: diagnostic_last_trigger
|
||||
name: "$project last trigger"
|
||||
disabled_by_default: true
|
||||
entity_category: diagnostic
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
substitutions:
|
||||
project: Sonoff Basic 01
|
||||
id: sonoff_basic_01
|
||||
hostname: sonoff_basic_01
|
||||
|
||||
<<: !include common/substitutions/gpio/sonoff.yaml
|
||||
|
||||
|
||||
+11
-10
@@ -1,10 +1,11 @@
|
||||
---
|
||||
# Sonoff Basic Power Module
|
||||
#
|
||||
substitutions:
|
||||
project: Sonoff Basic 02
|
||||
id: sonoff_basic_02
|
||||
|
||||
<<: !include common/substitutions/gpio/sonoff.yaml
|
||||
|
||||
<<: !include common/templates/plug.yaml
|
||||
---
|
||||
# Sonoff Basic Power Module
|
||||
#
|
||||
substitutions:
|
||||
project: Sonoff Basic 02
|
||||
id: sonoff_basic_02
|
||||
hostname: sonoff_basic_02
|
||||
|
||||
<<: !include common/substitutions/gpio/sonoff.yaml
|
||||
|
||||
<<: !include common/templates/plug.yaml
|
||||
|
||||
+2
-1
@@ -4,7 +4,8 @@
|
||||
substitutions:
|
||||
project: Sonoff POW 01
|
||||
id: sonoffpow01
|
||||
hostname: sonoffpow01
|
||||
|
||||
<<: !include common/substitutions/gpio/sonoff.yaml
|
||||
|
||||
<<: !include common/templates/sonoff_power_monitor.yaml
|
||||
<<: !include common/templates/sonoff_power_monitor.yaml
|
||||
|
||||
+11
-10
@@ -1,10 +1,11 @@
|
||||
---
|
||||
# Sonoff Power Module
|
||||
#
|
||||
substitutions:
|
||||
project: Sonoff POW 02
|
||||
id: sonoff_pow_02
|
||||
|
||||
<<: !include common/substitutions/gpio/sonoff.yaml
|
||||
|
||||
<<: !include common/templates/sonoff_power_monitor.yaml
|
||||
---
|
||||
# Sonoff Power Module
|
||||
#
|
||||
substitutions:
|
||||
project: Sonoff POW 02
|
||||
id: sonoff_pow_02
|
||||
hostname: sonoff_pow_02
|
||||
|
||||
<<: !include common/substitutions/gpio/sonoff.yaml
|
||||
|
||||
<<: !include common/templates/sonoff_power_monitor.yaml
|
||||
|
||||
+3
-2
@@ -2,8 +2,9 @@
|
||||
# Sonoff S31 Power Monitoring Plug, Always On
|
||||
#
|
||||
substitutions:
|
||||
project: Glowforge Power Monitor
|
||||
id: sonoff_s31_01
|
||||
project: Glowforge power monitor
|
||||
id: powerglowforge
|
||||
hostname: power-glowforge
|
||||
|
||||
<<: !include common/substitutions/gpio/sonoff.yaml
|
||||
|
||||
|
||||
+3
-2
@@ -2,9 +2,10 @@
|
||||
# Sonoff S31 Power Monitoring Plug, Always On
|
||||
#
|
||||
substitutions:
|
||||
project: Washing Machine Power Monitor
|
||||
project: Washing machine power monitor
|
||||
id: powerwasher
|
||||
hostname: power-washer
|
||||
|
||||
<<: !include common/substitutions/gpio/sonoff.yaml
|
||||
|
||||
<<: !include common/templates/sonoff_power_monitor_always_on.yaml
|
||||
<<: !include common/templates/sonoff_power_monitor_always_on.yaml
|
||||
|
||||
+4
-3
@@ -2,9 +2,10 @@
|
||||
# Sonoff S31 Power Monitoring Plug
|
||||
#
|
||||
substitutions:
|
||||
project: Prusa
|
||||
id: powerprusa
|
||||
project: Prusa power monitor
|
||||
id: prusa_power_monitor
|
||||
hostname: power-prusa
|
||||
|
||||
<<: !include common/substitutions/gpio/sonoff.yaml
|
||||
|
||||
<<: !include common/templates/sonoff_power_monitor.yaml
|
||||
<<: !include common/templates/sonoff_power_monitor.yaml
|
||||
|
||||
+3
-2
@@ -2,9 +2,10 @@
|
||||
# Sonoff S31 Power Monitoring Plug
|
||||
#
|
||||
substitutions:
|
||||
project: Dryer Power Monitor
|
||||
project: Dryer power monitor
|
||||
id: powerdryer
|
||||
hostname: power-dryer
|
||||
|
||||
<<: !include common/substitutions/gpio/sonoff.yaml
|
||||
|
||||
<<: !include common/templates/sonoff_power_monitor_always_on.yaml
|
||||
<<: !include common/templates/sonoff_power_monitor_always_on.yaml
|
||||
|
||||
+4
-3
@@ -2,9 +2,10 @@
|
||||
# Sonoff S31 Power Monitoring Plug
|
||||
#
|
||||
substitutions:
|
||||
project: Family Room Soundbar
|
||||
id: plugsoundbar
|
||||
project: Family room soundbar power monitor
|
||||
id: soundbar_power_monitor
|
||||
hostname: power-soundbar
|
||||
|
||||
<<: !include common/substitutions/gpio/sonoff.yaml
|
||||
|
||||
<<: !include common/templates/sonoff_power_monitor_always_on.yaml
|
||||
<<: !include common/templates/sonoff_power_monitor_always_on.yaml
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
substitutions:
|
||||
project: Sonoff S31 06
|
||||
id: sonoff_s31_06
|
||||
hostname: sonoff_s31_06
|
||||
|
||||
<<: !include common/substitutions/gpio/sonoff.yaml
|
||||
|
||||
|
||||
Reference in New Issue
Block a user