diff --git a/Integrations/ESPHome/Core.yaml b/Integrations/ESPHome/Core.yaml index b2b42b9..ac12d84 100644 --- a/Integrations/ESPHome/Core.yaml +++ b/Integrations/ESPHome/Core.yaml @@ -1,5 +1,5 @@ substitutions: - version: "25.1.23.1" + version: "25.1.24.1" esp32: board: esp32-c3-devkitm-1 @@ -190,9 +190,12 @@ binary_sensor: - lambda: |- if (millis() - id(button_press_timestamp) >= 10000) { // Remove Wifi + id(testCycleCount) = 0; + id(runTest) = true; + id(prevent_sleep).turn_on(); id(factory_reset_switch).turn_on(); } - else if (millis() - id(button_press_timestamp) >= 1000) { + else if (millis() - id(button_press_timestamp) >= 3000) { //Turn Prevent Sleep On id(prevent_sleep).turn_on(); //Prevent Sleep @@ -201,6 +204,10 @@ binary_sensor: else { // StatusCheck id(statusCheck).execute(); + delay(3000); + id(testCycleCount) = 0; + id(runTest) = true; + id(testScript).execute(); } - platform: homeassistant name: "OTA Mode" @@ -486,6 +493,7 @@ script: then: - lambda: "id(runTest) = false;" - lambda: "id(testCycleCount) = 0;" + - switch.turn_on: accessory_power - while: condition: - lambda: "return id(testCycleCount) < 5;" diff --git a/Integrations/ESPHome/TEMP-1.yaml b/Integrations/ESPHome/TEMP-1.yaml index d413e6a..c2c7f09 100644 --- a/Integrations/ESPHome/TEMP-1.yaml +++ b/Integrations/ESPHome/TEMP-1.yaml @@ -12,62 +12,70 @@ esphome: min_version: 2024.2.0 on_boot: - priority: 800 - then: - - lambda: |- - id(deep_sleep_1).set_sleep_duration(id(deep_sleep_sleep_duration).state * 60 * 1000); - - if: - condition: - or: - - binary_sensor.is_on: ota_mode - - switch.is_on: prevent_sleep - then: - - lambda: |- - ESP_LOGW("Apollo", "Preventing Deep Sleep Due To OTA On Boot"); - id(deep_sleep_1).prevent_deep_sleep(); + - priority: 800 + then: + - lambda: |- + id(deep_sleep_1).set_sleep_duration(id(deep_sleep_sleep_duration).state * 60 * 1000); + - if: + condition: + or: + - binary_sensor.is_on: ota_mode + - switch.is_on: prevent_sleep + then: + - lambda: |- + ESP_LOGW("Apollo", "Preventing Deep Sleep Due To OTA On Boot"); + id(deep_sleep_1).prevent_deep_sleep(); - - if: - condition: - switch.is_on: notify_only_outside_temp_difference - then: - - logger.log: "Apollo Automation: Notify Only Outside Temp Difference" - - lambda: |- - id(reportAllValues).execute(); - - delay: 5s - - if: # Check If Temp Probe Is Outside Threshold - condition: - - lambda: |- - // Determine the selected probe - std::string selected_probe = id(temp_probe_select).state.c_str(); - float current_temp; + - if: + condition: + switch.is_on: notify_only_outside_temp_difference + then: + - logger.log: "Apollo Automation: Notify Only Outside Temp Difference" + - lambda: |- + id(reportAllValues).execute(); + - delay: 5s + - if: # Check If Temp Probe Is Outside Threshold + condition: + - lambda: |- + // Determine the selected probe + std::string selected_probe = id(temp_probe_select).state.c_str(); + float current_temp; - if (selected_probe == "Dallas") { - current_temp = id(temp_probe).state; - } else { - current_temp = id(ntc_sensor).state; - } + if (selected_probe == "Dallas") { + current_temp = id(temp_probe).state; + } else { + current_temp = id(ntc_sensor).state; + } - // Check temperature difference - if (std::abs(current_temp - id(last_temp)) > id(temp_diff_threshold)->state) { - return true; - id(last_temp) = current_temp; - } else { - return false; - } - then: # If So Then Turn On Wifi To Update - - logger.log: "Apollo Automation: Outside Temp Change Detected" - - lambda: |- - id(last_temp) = id(temp_probe).state; - else: # If Not Then Check OTA And Sleep - - if: - condition: - and: - - binary_sensor.is_off: ota_mode - - switch.is_off: prevent_sleep - then: - - deep_sleep.enter: - id: deep_sleep_1 - + // Check temperature difference + if (std::abs(current_temp - id(last_temp)) > id(temp_diff_threshold)->state) { + return true; + id(last_temp) = current_temp; + } else { + return false; + } + then: # If So Then Turn On Wifi To Update + - logger.log: "Apollo Automation: Outside Temp Change Detected" + - lambda: |- + id(last_temp) = id(temp_probe).state; + else: # If Not Then Check OTA And Sleep + - if: + condition: + and: + - binary_sensor.is_off: ota_mode + - switch.is_off: prevent_sleep + then: + - deep_sleep.enter: + id: deep_sleep_1 + - priority: -500 + then: + - switch.turn_on: accessory_power + - if: + condition: + - lambda: "return id(runTest);" + then: + - delay: 10s + - lambda: "id(testScript).execute();" on_shutdown: - light.turn_off: rgb_light diff --git a/Integrations/ESPHome/TEMP-1B.yaml b/Integrations/ESPHome/TEMP-1B.yaml index 3f76ce1..6a79380 100644 --- a/Integrations/ESPHome/TEMP-1B.yaml +++ b/Integrations/ESPHome/TEMP-1B.yaml @@ -12,61 +12,69 @@ esphome: min_version: 2024.2.0 on_boot: - priority: 500 - then: - - lambda: |- - id(deep_sleep_1).set_sleep_duration(id(deep_sleep_sleep_duration).state * 60 * 60 * 1000); - - if: - condition: - or: - - binary_sensor.is_on: ota_mode - - switch.is_on: prevent_sleep - then: - - lambda: |- - ESP_LOGW("Apollo", "Preventing Deep Sleep Due To OTA On Boot"); - id(deep_sleep_1).prevent_deep_sleep(); + - priority: 500 + then: + - lambda: |- + id(deep_sleep_1).set_sleep_duration(id(deep_sleep_sleep_duration).state * 60 * 60 * 1000); + - if: + condition: + or: + - binary_sensor.is_on: ota_mode + - switch.is_on: prevent_sleep + then: + - lambda: |- + ESP_LOGW("Apollo", "Preventing Deep Sleep Due To OTA On Boot"); + id(deep_sleep_1).prevent_deep_sleep(); - - if: - condition: - switch.is_on: notify_only_outside_temp_difference - then: - - logger.log: "Apollo Automation: Notify Only Outside Temp Difference" - - lambda: |- - id(reportAllValues).execute(); - - delay: 5s - - if: # Check If Temp Probe Is Outside Threshold - condition: - - lambda: |- - // Determine the selected probe - std::string selected_probe = id(temp_probe_select).state.c_str(); - float current_temp; + - if: + condition: + switch.is_on: notify_only_outside_temp_difference + then: + - logger.log: "Apollo Automation: Notify Only Outside Temp Difference" + - lambda: |- + id(reportAllValues).execute(); + - delay: 5s + - if: # Check If Temp Probe Is Outside Threshold + condition: + - lambda: |- + // Determine the selected probe + std::string selected_probe = id(temp_probe_select).state.c_str(); + float current_temp; - if (selected_probe == "Dallas") { - current_temp = id(temp_probe).state; - } else { - current_temp = id(ntc_sensor).state; - } + if (selected_probe == "Dallas") { + current_temp = id(temp_probe).state; + } else { + current_temp = id(ntc_sensor).state; + } - // Check temperature difference - if (std::abs(current_temp - id(last_temp)) > id(temp_diff_threshold)->state) { - return true; - id(last_temp) = current_temp; - } else { - return false; - } - then: # If So Then Turn On Wifi To Update - - logger.log: "Apollo Automation: Outside Temp Change Detected" - - lambda: |- - id(last_temp) = id(temp_probe).state; - else: # If Not Then Check OTA And Sleep - - if: - condition: - and: - - binary_sensor.is_off: ota_mode - - switch.is_off: prevent_sleep - then: - - deep_sleep.enter: - id: deep_sleep_1 + // Check temperature difference + if (std::abs(current_temp - id(last_temp)) > id(temp_diff_threshold)->state) { + return true; + id(last_temp) = current_temp; + } else { + return false; + } + then: # If So Then Turn On Wifi To Update + - logger.log: "Apollo Automation: Outside Temp Change Detected" + - lambda: |- + id(last_temp) = id(temp_probe).state; + else: # If Not Then Check OTA And Sleep + - if: + condition: + and: + - binary_sensor.is_off: ota_mode + - switch.is_off: prevent_sleep + then: + - deep_sleep.enter: + id: deep_sleep_1 + - priority: -300 + then: + - if: + condition: + - lambda: "return id(runTest);" + then: + - delay: 10s + - lambda: "id(testScript).execute();" on_shutdown: - light.turn_off: rgb_light @@ -108,7 +116,7 @@ wifi: on_disconnect: - ble.enable: ap: - ssid: "Apollo TEMP1 Hotspot" + ssid: "Apollo TEMP1B Hotspot" logger: