Skip to content

Commit

Permalink
Merge pull request #5 from ApolloAutomation/AddOnBootForOtherYAML
Browse files Browse the repository at this point in the history
Add On Boot To Other YAMLs
  • Loading branch information
TrevorSchirmer authored Sep 22, 2024
2 parents 76daa7d + 2547964 commit f7835a3
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Integrations/ESPHome/Core.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
substitutions:
name: apollo-temp-1
version: "24.9.21.1"
version: "24.9.21.2"
device_description: ${name} made by Apollo Automation - version ${version}.

esp32:
Expand Down
39 changes: 39 additions & 0 deletions Integrations/ESPHome/TEMP-1_BLE.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,47 @@ esphome:
priority: 500
then:
- switch.turn_on: accessory_power
- lambda: |-
id(deep_sleep_1).set_run_duration(id(deep_sleep_run_duration).state * 1000);
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"
- delay: 2s
- if: # Check If Temp Probe Is Outside Threshold
condition:
- lambda: |-
return std::abs(id(temp_probe).state - id(last_temp)) > id(temp_diff_threshold)->state;
then: # If So Then Turn On Wifi To Update
- logger.log: "Apollo Automation: Outside Temp Change Detected"
- wifi.enable:
- 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:
- switch.turn_off: accessory_power
- deep_sleep.enter:
id: deep_sleep_1

on_shutdown:
- light.turn_off: rgb_light
- switch.turn_off: accessory_power


Expand Down
39 changes: 39 additions & 0 deletions Integrations/ESPHome/TEMP-1_Minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,47 @@ esphome:
priority: 500
then:
- switch.turn_on: accessory_power
- lambda: |-
id(deep_sleep_1).set_run_duration(id(deep_sleep_run_duration).state * 1000);
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"
- delay: 2s
- if: # Check If Temp Probe Is Outside Threshold
condition:
- lambda: |-
return std::abs(id(temp_probe).state - id(last_temp)) > id(temp_diff_threshold)->state;
then: # If So Then Turn On Wifi To Update
- logger.log: "Apollo Automation: Outside Temp Change Detected"
- wifi.enable:
- 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:
- switch.turn_off: accessory_power
- deep_sleep.enter:
id: deep_sleep_1

on_shutdown:
- light.turn_off: rgb_light
- switch.turn_off: accessory_power


Expand Down

0 comments on commit f7835a3

Please sign in to comment.