From fece0359bcf9a3e2e37f5865edd0213466dd255b Mon Sep 17 00:00:00 2001 From: Daniele Verducci Date: Wed, 13 May 2026 00:34:17 +0200 Subject: [PATCH] Enable WIFI interface only if device is started with volume down key pressed --- README.md | 5 +++++ esphome/fabula.yaml | 39 ++++++++++++++++++++------------------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index ac26bf6..5a368f2 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,11 @@ Then, model the character: I used Mifare ultralight tags. A valid tag should contain a single text field containing the name of the directory to play (a number between 01 and 99). +## Debugging + +Turn on Fabula keeping the Volume Down key pressed for some seconds, until the status led turns white. The WIFI is now enabled on the ESP8266 and logs can be accessed via ESPHome: +`esphome logs Fabula/esphome/fabula.yaml` + # Contributions ## Why isn't this hosted on GitHub? diff --git a/esphome/fabula.yaml b/esphome/fabula.yaml index f74a303..fcebe6a 100644 --- a/esphome/fabula.yaml +++ b/esphome/fabula.yaml @@ -10,13 +10,6 @@ globals: type: int restore_value: no initial_value: '0' - # The ESP8266 Wi-fi interferes with the NFC reader, for this reason is usually - # disabled. When the devices is turned on with the "volume up" key pressed, it - # enables the wifi. Used for firmware update, home assistant control and as a night light. - - id: wifi_mode - type: bool - restore_value: no - initial_value: 'false' # ---------------------- Global config ---------------------- @@ -25,20 +18,27 @@ esphome: on_boot: - priority: 300 then: + - delay: 1s + - dfplayer.set_volume: 6 - if: condition: - binary_sensor.is_on: vol_up - then: !lambda id(wifi_mode) = true; - #else: - # then: - # wifi.disable: - - dfplayer.set_volume: 10 - - light.turn_on: - id: status_led - brightness: !lambda if (id(wifi_mode)) return 1.0; else return 0.6; - red: 0.8 - green: !lambda if (id(wifi_mode)) return 1.0; else return 0.0; - blue: 1.0 + binary_sensor.is_on: vol_down + then: + - wifi.enable: + - light.turn_on: + id: status_led + brightness: 100% + red: 100% + green: 100% + blue: 100% + else: + - wifi.disable: + - light.turn_on: + id: status_led + brightness: 60% + red: 80% + green: 0% + blue: 100% esp8266: board: d1_mini_lite @@ -55,6 +55,7 @@ wifi: ssid: "Pew" password: "SediaChinita@Terrazzo2017" reboot_timeout: 0s + #enable_on_boot: False # ---------------------- PN532 NFC Reader ----------------------