From 619978533291545aead39ae48c6f9710416af3c8 Mon Sep 17 00:00:00 2001 From: Trevor Schirmer Date: Tue, 29 Oct 2024 21:50:01 -0400 Subject: [PATCH] Merge branch 'main' into beta # Conflicts: # Integrations/ESPHome/AIR-1.yaml # Integrations/ESPHome/Core.yaml # README.md --- Integrations/ESPHome/AIR-1_Factory.yaml | 8 ++ Integrations/ESPHome/Core.yaml | 121 +++++++++++++++++------- README.md | 2 +- 3 files changed, 94 insertions(+), 37 deletions(-) diff --git a/Integrations/ESPHome/AIR-1_Factory.yaml b/Integrations/ESPHome/AIR-1_Factory.yaml index 3cd0580..f6b5fce 100644 --- a/Integrations/ESPHome/AIR-1_Factory.yaml +++ b/Integrations/ESPHome/AIR-1_Factory.yaml @@ -11,6 +11,14 @@ esphome: version: "${version}" min_version: 2024.6.4 + on_boot: + - priority: -10 + then: + - if: + condition: + - lambda: "return id(runTest);" + then: + - lambda: "id(testScript).execute();" dashboard_import: package_import_url: github://ApolloAutomation/AIR-1/Integrations/ESPHome/AIR-1.yaml diff --git a/Integrations/ESPHome/Core.yaml b/Integrations/ESPHome/Core.yaml index dd71569..43be1cd 100644 --- a/Integrations/ESPHome/Core.yaml +++ b/Integrations/ESPHome/Core.yaml @@ -1,6 +1,6 @@ substitutions: name: apollo-air-1 - version: "24.8.30.1" + version: "24.10.29.1" device_description: ${name} made by Apollo Automation - version ${version}. esp32: @@ -40,6 +40,18 @@ globals: restore_value: no type: uint32_t initial_value: '0' + - id: runTest + restore_value: yes + type: bool + initial_value: "true" + - id: testCycleCount + type: int + restore_value: no + initial_value: "0" + - id: dps310Passed + restore_value: no + type: bool + initial_value: "false" i2c: @@ -87,7 +99,7 @@ binary_sensor: mode: input: true pullup: true - id: reset_button + id: reset_button on_press: then: - lambda: |- @@ -99,6 +111,11 @@ binary_sensor: // Remove Wifi id(factory_reset_switch).turn_on(); } + else if (millis() - id(button_press_timestamp) >= 1000) { + id(testCycleCount) = 0; + id(runTest) = true; + id(testScript).execute(); + } else { // StatusCheck id(statusCheck).execute(); @@ -315,47 +332,79 @@ text_sensor: return std::string("Extremely abnormal");} switch: - - platform: template - name: "Startup Light Blink" - id: startup_light_blink - icon: mdi:lightbulb - restore_mode: RESTORE_DEFAULT_ON - optimistic: true - entity_category: "config" - platform: factory_reset id: factory_reset_switch internal: true -#Used To Control RGB Light On Startup. Tells User Status Of Device -interval: - - interval: 1s - then: - - if: - condition: - - binary_sensor.is_off: ink_ha_connected - - lambda: 'return id(cycleCounter) < 30;' - - switch.is_on: startup_light_blink - then: - - light.toggle: - id: rgb_light - - lambda: 'id(cycleCounter) += 1;' - - - interval: 1s +script: + - id: testScript then: - - if: - condition: - - binary_sensor.is_off: ink_ha_connected - - lambda: 'return id(cycleCounter) > 30;' - - lambda: 'return id(cycleCounter) < 31;' - - switch.is_on: startup_light_blink + if: + condition: + - lambda: "return id(runTest) == true;" + then: + - lambda: "id(runTest) = false;" + - lambda: "id(testCycleCount) = 0;" + - while: + condition: + - lambda: "return id(testCycleCount) < 5;" + then: + - if: + condition: + - lambda: "return id(dps310Passed) == false;" + then: + - if: + condition: + - lambda: "return id(dps310pressure).state > 800 && id(dps310pressure).state < 1200;" + then: + - lambda: "id(dps310Passed) = true;" + + - if: + condition: + - lambda: "return id(dps310Passed);" + then: + - lambda: "id(testCycleCount) = 10;" + - lambda: "id(runTest) = false;" + - delay: 1s + - lambda: "id(testCycleCount) += 1;" + + #Check If Test Passed To Trigger Lights + - if: + condition: + - lambda: "return id(dps310Passed);" + then: + - lambda: "id(runTest) = false;" + - light.turn_on: + id: rgb_light + red: 0% + green: 100% + blue: 0% + - delay: 5s + - light.turn_on: + id: rgb_light + red: 0% + green: 0% + blue: 0% + - light.turn_off: + id: rgb_light + + else: + - lambda: "id(runTest) = false;" + - light.turn_on: + id: rgb_light + red: 100% + green: 0% + blue: 0% + - delay: 5s + - light.turn_on: + id: rgb_light + red: 0% + green: 0% + blue: 0% + - light.turn_off: + id: rgb_light - then: - - light.turn_off: - id: rgb_light - - lambda: 'id(cycleCounter) += 1;' - -script: - id: statusCheck then: - if: diff --git a/README.md b/README.md index 30c0262..ca180a0 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ YAML Files: Links: -Discord (Support/feedback/discussion/future products): [https://discord.gg/8PpS4yUaUh](https://discord.gg/mMNgQPyF94) \ +Discord (Support/feedback/discussion/future products): [https://dsc.gg/ApolloAutomation] \ Shop: [https://apolloautomation.com](https://apolloautomation.com/products/air-1) \ Wiki: [https://wiki.apolloautomation.com](https://wiki.apolloautomation.com/) \ 3D Files: [https://www.printables.com/model/932001-apollo-automation-air-1-air-quality-sensor-for-hom](https://www.printables.com/model/932001-apollo-automation-air-1-air-quality-sensor-for-hom)