Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge branch 'main' into beta #42

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Integrations/ESPHome/AIR-1_Factory.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
121 changes: 85 additions & 36 deletions Integrations/ESPHome/Core.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -87,7 +99,7 @@ binary_sensor:
mode:
input: true
pullup: true
id: reset_button
id: reset_button
on_press:
then:
- lambda: |-
Expand All @@ -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();
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Loading