Enable WIFI interface only if device is started with volume down key pressed

This commit is contained in:
Daniele Verducci
2026-05-13 00:34:17 +02:00
parent 02a15c01f1
commit fece0359bc
2 changed files with 25 additions and 19 deletions

View File

@@ -62,6 +62,11 @@ Then, model the character:
I used Mifare ultralight tags. 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). 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 # Contributions
## Why isn't this hosted on GitHub? ## Why isn't this hosted on GitHub?

View File

@@ -10,13 +10,6 @@ globals:
type: int type: int
restore_value: no restore_value: no
initial_value: '0' 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 ---------------------- # ---------------------- Global config ----------------------
@@ -25,20 +18,27 @@ esphome:
on_boot: on_boot:
- priority: 300 - priority: 300
then: then:
- delay: 1s
- dfplayer.set_volume: 6
- if: - if:
condition: condition:
binary_sensor.is_on: vol_up binary_sensor.is_on: vol_down
then: !lambda id(wifi_mode) = true; then:
#else: - wifi.enable:
# then: - light.turn_on:
# wifi.disable: id: status_led
- dfplayer.set_volume: 10 brightness: 100%
- light.turn_on: red: 100%
id: status_led green: 100%
brightness: !lambda if (id(wifi_mode)) return 1.0; else return 0.6; blue: 100%
red: 0.8 else:
green: !lambda if (id(wifi_mode)) return 1.0; else return 0.0; - wifi.disable:
blue: 1.0 - light.turn_on:
id: status_led
brightness: 60%
red: 80%
green: 0%
blue: 100%
esp8266: esp8266:
board: d1_mini_lite board: d1_mini_lite
@@ -55,6 +55,7 @@ wifi:
ssid: "Pew" ssid: "Pew"
password: "SediaChinita@Terrazzo2017" password: "SediaChinita@Terrazzo2017"
reboot_timeout: 0s reboot_timeout: 0s
#enable_on_boot: False
# ---------------------- PN532 NFC Reader ---------------------- # ---------------------- PN532 NFC Reader ----------------------