2023-08-22 14:15:17 +02:00
|
|
|
|
|
|
|
esphome:
|
|
|
|
name: gartenhaus-taster-input
|
2024-03-08 14:04:37 +01:00
|
|
|
includes:
|
|
|
|
- my_btmonitor.h
|
|
|
|
libraries:
|
|
|
|
- mbedtls
|
2023-08-22 14:15:17 +02:00
|
|
|
|
|
|
|
esp32:
|
|
|
|
board: esp32-poe
|
|
|
|
framework:
|
|
|
|
type: arduino
|
|
|
|
|
|
|
|
# Enable logging
|
|
|
|
logger:
|
|
|
|
|
|
|
|
# Enable Home Assistant API
|
|
|
|
api:
|
|
|
|
encryption:
|
|
|
|
key: !secret api_encryption_key
|
|
|
|
|
|
|
|
ota:
|
|
|
|
password: !secret ota_password
|
|
|
|
|
|
|
|
|
|
|
|
ethernet:
|
|
|
|
type: LAN8720
|
|
|
|
mdc_pin: GPIO23
|
|
|
|
mdio_pin: GPIO18
|
|
|
|
clk_mode: GPIO17_OUT
|
|
|
|
phy_addr: 0
|
|
|
|
power_pin: GPIO12
|
|
|
|
|
|
|
|
globals:
|
|
|
|
- id: taster_oben_state
|
|
|
|
type: int
|
|
|
|
restore_value: yes
|
|
|
|
initial_value: '0'
|
|
|
|
|
|
|
|
binary_sensor:
|
|
|
|
- platform: gpio
|
|
|
|
name: "gartenhaus_lichtschalter_gross"
|
|
|
|
filters:
|
|
|
|
- invert:
|
|
|
|
- delayed_on: 10ms
|
|
|
|
pin:
|
|
|
|
number: 4
|
|
|
|
mode:
|
|
|
|
input: true
|
|
|
|
pullup: true
|
|
|
|
device_class: LIGHT
|
|
|
|
on_press:
|
|
|
|
then:
|
|
|
|
- if:
|
|
|
|
condition:
|
|
|
|
lambda: 'return (id(taster_oben_state) == 0);'
|
|
|
|
then:
|
|
|
|
- globals.set:
|
|
|
|
id: taster_oben_state
|
|
|
|
value: '1'
|
|
|
|
- homeassistant.service:
|
|
|
|
service: scene.turn_on
|
|
|
|
data:
|
|
|
|
entity_id: scene.garten_farbig
|
|
|
|
else:
|
|
|
|
- globals.set:
|
|
|
|
id: taster_oben_state
|
|
|
|
value: '0'
|
|
|
|
- homeassistant.service:
|
|
|
|
service: scene.turn_on
|
|
|
|
data:
|
|
|
|
entity_id: scene.garten_aus
|
|
|
|
- platform: gpio
|
|
|
|
name: "gartenhaus_lichtschalter_klein_links"
|
|
|
|
filters:
|
|
|
|
- invert:
|
|
|
|
- delayed_on: 10ms
|
|
|
|
pin:
|
|
|
|
number: 15
|
|
|
|
mode:
|
|
|
|
input: true
|
|
|
|
pullup: true
|
|
|
|
device_class: LIGHT
|
|
|
|
on_press:
|
|
|
|
homeassistant.service:
|
|
|
|
service: script.esphome_light_toggle
|
|
|
|
data:
|
|
|
|
light_name: "light.gartenhaus_deckenlicht_mitte, light.gartenhaus_deckenlicht_hinten"
|
|
|
|
transition: "0"
|
|
|
|
red: "0"
|
|
|
|
blue: "0"
|
|
|
|
green: "0"
|
|
|
|
white: "255"
|
|
|
|
- platform: gpio
|
|
|
|
name: "gartenhaus_lichtschalter_klein_rechts"
|
|
|
|
filters:
|
|
|
|
- invert:
|
|
|
|
- delayed_on: 10ms
|
|
|
|
pin:
|
|
|
|
number: 16
|
|
|
|
mode:
|
|
|
|
input: true
|
|
|
|
pullup: true
|
|
|
|
device_class: LIGHT
|
|
|
|
on_press:
|
|
|
|
homeassistant.service:
|
|
|
|
service: script.esphome_light_toggle
|
|
|
|
data:
|
|
|
|
light_name: "light.gartenhaus_deckenlicht_vorne"
|
|
|
|
transition: "0"
|
|
|
|
red: "0"
|
|
|
|
blue: "0"
|
|
|
|
green: "0"
|
|
|
|
white: "255"
|
|
|
|
- platform: gpio
|
|
|
|
name: "gartenhaus_taster1"
|
|
|
|
filters:
|
|
|
|
- invert:
|
|
|
|
- delayed_on: 10ms
|
|
|
|
pin:
|
|
|
|
number: 14
|
|
|
|
mode:
|
|
|
|
input: true
|
|
|
|
pullup: true
|
|
|
|
device_class: LIGHT
|
|
|
|
- platform: gpio
|
|
|
|
name: "gartenhaus_taster2"
|
|
|
|
filters:
|
|
|
|
- invert:
|
|
|
|
- delayed_on: 10ms
|
|
|
|
pin:
|
|
|
|
number: 13
|
|
|
|
mode:
|
|
|
|
input: true
|
|
|
|
pullup: true
|
|
|
|
device_class: LIGHT
|
|
|
|
- platform: gpio
|
|
|
|
name: "gartenhaus_taster3"
|
|
|
|
filters:
|
|
|
|
- invert:
|
|
|
|
- delayed_on: 10ms
|
|
|
|
pin:
|
|
|
|
number: 2
|
|
|
|
mode:
|
|
|
|
input: true
|
|
|
|
pullup: true
|
|
|
|
device_class: LIGHT
|
|
|
|
- platform: gpio
|
|
|
|
name: "gartenhaus_taster4"
|
|
|
|
filters:
|
|
|
|
- invert:
|
|
|
|
- delayed_on: 10ms
|
|
|
|
pin:
|
|
|
|
number: 5
|
|
|
|
mode:
|
|
|
|
input: true
|
|
|
|
pullup: true
|
|
|
|
device_class: LIGHT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-08 14:04:37 +01:00
|
|
|
mqtt:
|
|
|
|
broker: homeassistant.fritz.box
|
|
|
|
username: !secret mqtt_ble_username
|
|
|
|
password: !secret mqtt_ble_password
|
|
|
|
discovery: false
|
|
|
|
|
|
|
|
|
|
|
|
esp32_ble_tracker:
|
|
|
|
scan_parameters:
|
|
|
|
interval: 1.2s
|
|
|
|
window: 500ms
|
|
|
|
active: false
|
|
|
|
on_ble_advertise:
|
|
|
|
- then:
|
|
|
|
- lambda: |-
|
|
|
|
const char * detected_device_name = ble_device_name(x.address());
|
|
|
|
if(detected_device_name != nullptr) {
|
|
|
|
auto build_json = [&](JsonObject obj) {
|
|
|
|
obj["id"] = detected_device_name;
|
|
|
|
obj["rssi"] = x.get_rssi();
|
|
|
|
if(x.get_tx_powers().size() > 0)
|
|
|
|
obj["tx_power"] = x.get_tx_powers()[0];
|
|
|
|
};
|
|
|
|
global_mqtt_client->publish_json(std::string("my_btmonitor/devices/") + detected_device_name + "/garten",
|
|
|
|
build_json);
|
|
|
|
}
|
2023-08-22 14:15:17 +02:00
|
|
|
|
|
|
|
|
|
|
|
#on_multi_click:
|
|
|
|
# - timing:
|
|
|
|
# - ON for at most 1s
|
|
|
|
# - OFF for at most 0.3s
|
|
|
|
# - ON for at most 1s
|
|
|
|
# - OFF for at least 0.2s
|
|
|
|
# then:
|
|
|
|
# - homeassistant.event:
|
|
|
|
# event: esphome.gartenhaus_lichtschalter_gross_doubleclick
|
|
|
|
# - homeassistant.service:
|
|
|
|
# service: light.toggle
|
|
|
|
# data:
|
|
|
|
# entity_id: light.gartenhaus_deckenlicht_mitte
|
|
|
|
# - timing:
|
|
|
|
# - ON for at most 1s
|
|
|
|
# - OFF for at least 0.5s
|
|
|
|
# then:
|
|
|
|
# - homeassistant.event:
|
|
|
|
# event: esphome.gartenhaus_lichtschalter_gross_click
|
|
|
|
# - homeassistant.service:
|
|
|
|
# service: light.toggle
|
|
|
|
# data:
|
|
|
|
# entity_id: light.gartenhaus_deckenlicht_hinten
|