From 8362a44281de1a3cee763d03aaccedb5e13c0ad2 Mon Sep 17 00:00:00 2001 From: Przemek Grondek Date: Thu, 19 Jan 2023 16:25:18 +0100 Subject: [PATCH] Add esphome devices --- configuration/esphome/bt-proxy.yaml | 50 +++++++++++++++ configuration/esphome/rothult_lock.yaml | 82 +++++++++++++++++++++++++ configuration/esphome/usb-switch.yaml | 75 ++++++++++++++++++++++ 3 files changed, 207 insertions(+) create mode 100644 configuration/esphome/bt-proxy.yaml create mode 100644 configuration/esphome/rothult_lock.yaml create mode 100644 configuration/esphome/usb-switch.yaml diff --git a/configuration/esphome/bt-proxy.yaml b/configuration/esphome/bt-proxy.yaml new file mode 100644 index 0000000..37d2b42 --- /dev/null +++ b/configuration/esphome/bt-proxy.yaml @@ -0,0 +1,50 @@ +# ESP32 BT proxy +esphome: + name: bt-proxy + project: + name: esphome.bluetooth-proxy + version: "1.0" + +esp32: + board: esp32dev + framework: + type: arduino + +# Enable logging +logger: + +# Enable Home Assistant API +api: + encryption: + key: + +ota: + +wifi: + ssid: !secret wifi_ssid + password: !secret wifi_password + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "Bt-Proxy Fallback Hotspot" + password: !secret wifi_fallback_password + +improv_serial: +captive_portal: + +dashboard_import: + package_import_url: github://esphome/bluetooth-proxies/esp32-generic.yaml@main + +esp32_ble_tracker: + scan_parameters: + interval: 1100ms + window: 1100ms + active: true + +bluetooth_proxy: + active: true + +button: + - platform: safe_mode + name: Safe Mode Boot + entity_category: diagnostic diff --git a/configuration/esphome/rothult_lock.yaml b/configuration/esphome/rothult_lock.yaml new file mode 100644 index 0000000..ab7065b --- /dev/null +++ b/configuration/esphome/rothult_lock.yaml @@ -0,0 +1,82 @@ +# Ikea Rothulth lock +esphome: + name: rothult_lock + platform: ESP8266 + board: esp01_1m + +wifi: + ssid: !secret wifi_ssid + password: !secret wifi_password + power_save_mode: HIGH + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "Rothult Lock Fallback Hotspot" + password: !secret wifi_fallback_password + +captive_portal: + +# Enable logging +logger: + +# Enable Home Assistant API +api: + password: password + +ota: + password: + +binary_sensor: + - platform: gpio + id: locked_endstop + name: "Locked endstop" + pin: + number: 5 + mode: INPUT + on_press: + then: + switch.template.publish: + id: lock + state: ON + - platform: gpio + id: unlocked_endstop + name: "Unlocked endstop" + pin: + number: 4 + mode: INPUT + on_press: + then: + switch.template.publish: + id: lock + state: OFF + +sensor: + - platform: adc + id: vcc_voltage + name: "VCC Voltage" + pin: VCC + +switch: + - platform: template + name: "Lock" + icon: mdi:file-cabinet + id: lock + turn_on_action: + # - switch.turn_on: forward + - switch.turn_on: backward + - wait_until: + binary_sensor.is_on: locked_endstop + # - switch.turn_off: forward + - switch.turn_off: backward + turn_off_action: + - switch.turn_on: backward + - wait_until: + binary_sensor.is_on: unlocked_endstop + - switch.turn_off: backward + - platform: gpio + pin: 12 + id: forward + name: "GPIO Forward" + - platform: gpio + pin: 14 + id: backward + name: "GPIO Backward" diff --git a/configuration/esphome/usb-switch.yaml b/configuration/esphome/usb-switch.yaml new file mode 100644 index 0000000..fcecec1 --- /dev/null +++ b/configuration/esphome/usb-switch.yaml @@ -0,0 +1,75 @@ +# Sinilink USB Switch Module (XY-WFUSB) +esphome: + name: usb-switch + platform: ESP8266 + board: esp01_1m + + +# Enable logging +logger: + +# Enable Home Assistant API +api: + +ota: + password: + +wifi: + ssid: !secret wifi_ssid + password: !secret wifi_password + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "Usb-Switch-X Fallback Hotspot" + password: !secret wifi_fallback_password + +captive_portal: + +status_led: + pin: + number: GPIO16 # Blue LED + +switch: + # Relay + - platform: gpio + id: usb_switch_1_relay + pin: GPIO5 + name: USB Switch + + # Green LED + - platform: gpio + pin: GPIO14 + id: green_led + + # Switch template to link relay and green LED states + # LED is on when relay is off + # - platform: template + # id: "usb_switch_1_relay" + # name: USB Switch 1 + # lambda: |- + # if (id(relay).state) { + # return true; + # } else { + # return false; + # } + # turn_on_action: + # - switch.turn_on: + # id: green_led + # - switch.turn_on: + # id: relay + # turn_off_action: + # - switch.turn_off: + # id: green_led + # - switch.turn_off: + # id: relay + +# Button +binary_sensor: + - platform: gpio + id: button + pin: + number: GPIO04 + mode: INPUT_PULLUP + inverted: True + on_press: + - switch.toggle: "usb_switch_relay" \ No newline at end of file