esphome: name: gartenhaus-taster-input 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 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: |- auto build_json = [&](JsonObject obj) { obj["rssi"] = x.get_rssi(); obj["address"] = x.address_str(); obj["address_uint64"] = x.address_uint64(); if(x.get_tx_powers().size() > 0) obj["tx_power"] = x.get_tx_powers()[0]; }; global_mqtt_client->publish_json("my_btmonitor/raw_measurements/garten", build_json); #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