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.
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?

View File

@@ -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 ----------------------