Skip to content

Commit f7835a3

Browse files
Merge pull request #5 from ApolloAutomation/AddOnBootForOtherYAML
Add On Boot To Other YAMLs
2 parents 76daa7d + 2547964 commit f7835a3

File tree

3 files changed

+79
-1
lines changed

3 files changed

+79
-1
lines changed

Integrations/ESPHome/Core.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
substitutions:
22
name: apollo-temp-1
3-
version: "24.9.21.1"
3+
version: "24.9.21.2"
44
device_description: ${name} made by Apollo Automation - version ${version}.
55

66
esp32:

Integrations/ESPHome/TEMP-1_BLE.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,47 @@ esphome:
1515
priority: 500
1616
then:
1717
- switch.turn_on: accessory_power
18+
- lambda: |-
19+
id(deep_sleep_1).set_run_duration(id(deep_sleep_run_duration).state * 1000);
20+
id(deep_sleep_1).set_sleep_duration(id(deep_sleep_sleep_duration).state * 60 * 60 * 1000);
21+
- if:
22+
condition:
23+
or:
24+
- binary_sensor.is_on: ota_mode
25+
- switch.is_on: prevent_sleep
26+
then:
27+
- lambda: |-
28+
ESP_LOGW("Apollo", "Preventing Deep Sleep Due To OTA On Boot");
29+
id(deep_sleep_1).prevent_deep_sleep();
30+
31+
- if:
32+
condition:
33+
switch.is_on: notify_only_outside_temp_difference
34+
then:
35+
- logger.log: "Apollo Automation: Notify Only Outside Temp Difference"
36+
- delay: 2s
37+
- if: # Check If Temp Probe Is Outside Threshold
38+
condition:
39+
- lambda: |-
40+
return std::abs(id(temp_probe).state - id(last_temp)) > id(temp_diff_threshold)->state;
41+
then: # If So Then Turn On Wifi To Update
42+
- logger.log: "Apollo Automation: Outside Temp Change Detected"
43+
- wifi.enable:
44+
- lambda: |-
45+
id(last_temp) = id(temp_probe).state;
46+
else: # If Not Then Check OTA And Sleep
47+
- if:
48+
condition:
49+
and:
50+
- binary_sensor.is_off: ota_mode
51+
- switch.is_off: prevent_sleep
52+
then:
53+
- switch.turn_off: accessory_power
54+
- deep_sleep.enter:
55+
id: deep_sleep_1
1856

1957
on_shutdown:
58+
- light.turn_off: rgb_light
2059
- switch.turn_off: accessory_power
2160

2261

Integrations/ESPHome/TEMP-1_Minimal.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,47 @@ esphome:
1515
priority: 500
1616
then:
1717
- switch.turn_on: accessory_power
18+
- lambda: |-
19+
id(deep_sleep_1).set_run_duration(id(deep_sleep_run_duration).state * 1000);
20+
id(deep_sleep_1).set_sleep_duration(id(deep_sleep_sleep_duration).state * 60 * 60 * 1000);
21+
- if:
22+
condition:
23+
or:
24+
- binary_sensor.is_on: ota_mode
25+
- switch.is_on: prevent_sleep
26+
then:
27+
- lambda: |-
28+
ESP_LOGW("Apollo", "Preventing Deep Sleep Due To OTA On Boot");
29+
id(deep_sleep_1).prevent_deep_sleep();
30+
31+
- if:
32+
condition:
33+
switch.is_on: notify_only_outside_temp_difference
34+
then:
35+
- logger.log: "Apollo Automation: Notify Only Outside Temp Difference"
36+
- delay: 2s
37+
- if: # Check If Temp Probe Is Outside Threshold
38+
condition:
39+
- lambda: |-
40+
return std::abs(id(temp_probe).state - id(last_temp)) > id(temp_diff_threshold)->state;
41+
then: # If So Then Turn On Wifi To Update
42+
- logger.log: "Apollo Automation: Outside Temp Change Detected"
43+
- wifi.enable:
44+
- lambda: |-
45+
id(last_temp) = id(temp_probe).state;
46+
else: # If Not Then Check OTA And Sleep
47+
- if:
48+
condition:
49+
and:
50+
- binary_sensor.is_off: ota_mode
51+
- switch.is_off: prevent_sleep
52+
then:
53+
- switch.turn_off: accessory_power
54+
- deep_sleep.enter:
55+
id: deep_sleep_1
1856

1957
on_shutdown:
58+
- light.turn_off: rgb_light
2059
- switch.turn_off: accessory_power
2160

2261

0 commit comments

Comments
 (0)