Fixed led when not connected to wifi. Added 8 clicks action.

This commit is contained in:
Nikolay Vasilchuk
2022-10-28 13:58:49 +03:00
parent 7cdf11042d
commit afd80a46e6
3 changed files with 35 additions and 31 deletions

View File

@@ -11,7 +11,7 @@ esphome:
platformio_options: platformio_options:
build_flags: -DBEARSSL_SSL_BASIC -DMMU_IRAM_SIZE=0xC000 -DMMU_ICACHE_SIZE=0x4000 -DMMU_IRAM_HEAP build_flags: -DBEARSSL_SSL_BASIC -DMMU_IRAM_SIZE=0xC000 -DMMU_ICACHE_SIZE=0x4000 -DMMU_IRAM_HEAP
on_boot: on_boot:
priority: -100 priority: 600
then: then:
- script.execute: state_ready - script.execute: state_ready
- light.turn_on: - light.turn_on:

View File

@@ -88,31 +88,31 @@ binary_sensor:
} }
} }
# # 8 clicks - forget wifi settings # 8 clicks - forget wifi settings
# - timing: - timing:
# - ON for 5ms to 1s - ON for 5ms to 1s
# - OFF for 5ms to 1s - OFF for 5ms to 1s
# - ON for 5ms to 1s - ON for 5ms to 1s
# - OFF for 5ms to 1s - OFF for 5ms to 1s
# - ON for 5ms to 1s - ON for 5ms to 1s
# - OFF for 5ms to 1s - OFF for 5ms to 1s
# - ON for 5ms to 1s - ON for 5ms to 1s
# - OFF for 5ms to 1s - OFF for 5ms to 1s
# - ON for 5ms to 1s - ON for 5ms to 1s
# - OFF for 5ms to 1s - OFF for 5ms to 1s
# - ON for 5ms to 1s - ON for 5ms to 1s
# - OFF for 5ms to 1s - OFF for 5ms to 1s
# - ON for 5ms to 1s - ON for 5ms to 1s
# - OFF for 5ms to 1s - OFF for 5ms to 1s
# - ON for 5ms to 1s - ON for 5ms to 1s
# then: then:
# lambda: |- lambda: |-
# ESP_LOGW("DMF", "Erase settings and restart..."); ESP_LOGW("DMF", "Erase settings and restart...");
# id(mode_auto_open) = false; id(mode_auto_open) = false;
# id(mode_auto_open_once) = false; id(mode_auto_open_once) = false;
# id(mode_auto_reject) = false; id(mode_auto_reject) = false;
# id(mode_mute) = false; id(mode_mute) = false;
# id(mode_mute_once) = false; id(mode_mute_once) = false;
# wifi::global_wifi_component->save_wifi_sta("-----", ""); wifi::global_wifi_component->save_wifi_sta("-----", "");
# delay(500); delay(500);
# ESP.restart(); ESP.restart();

View File

@@ -47,12 +47,16 @@ light:
|| auto_reject != old_auto_reject; || auto_reject != old_auto_reject;
auto call = id(rgb_led).turn_on(); auto call = id(rgb_led).turn_on();
bool connected = network::is_connected();
if (initial_run || state_updated) { if (initial_run || state_updated || !connected) {
tick = 0; tick = 0;
} }
if (tick == 0) { if (!connected) {
call.set_rgb(0.0, 0.0, 1.0); // blue
call.set_brightness(0.01);
} else if (tick == 0) {
if (incoming || auto_reject) { if (incoming || auto_reject) {
call.set_rgb(1.0, 0.0, 0.0); // red call.set_rgb(1.0, 0.0, 0.0); // red
call.set_brightness(brigtness); call.set_brightness(brigtness);