Enable WIFI interface only if device is started with volume down key pressed
This commit is contained in:
@@ -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 ----------------------
|
||||
|
||||
Reference in New Issue
Block a user