Enable WIFI interface only if device is started with volume down key pressed
This commit is contained in:
@@ -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?
|
||||||
|
|||||||
@@ -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:
|
|
||||||
# wifi.disable:
|
|
||||||
- dfplayer.set_volume: 10
|
|
||||||
- light.turn_on:
|
- light.turn_on:
|
||||||
id: status_led
|
id: status_led
|
||||||
brightness: !lambda if (id(wifi_mode)) return 1.0; else return 0.6;
|
brightness: 100%
|
||||||
red: 0.8
|
red: 100%
|
||||||
green: !lambda if (id(wifi_mode)) return 1.0; else return 0.0;
|
green: 100%
|
||||||
blue: 1.0
|
blue: 100%
|
||||||
|
else:
|
||||||
|
- wifi.disable:
|
||||||
|
- 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 ----------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user