Skip to content

Commit

Permalink
Remove Sleep After Connecting, Fix Sleep Numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
TrevorSchirmer committed Nov 9, 2024
1 parent c762784 commit ed0a16a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 41 deletions.
3 changes: 1 addition & 2 deletions Integrations/ESPHome/AIR-1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ esphome:
priority: 500
then:
- 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);
id(deep_sleep_1).set_sleep_duration(id(deep_sleep_sleep_duration).state * 60 * 1000);
- if:
condition:
or:
Expand Down
3 changes: 1 addition & 2 deletions Integrations/ESPHome/AIR-1_Factory.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ esphome:
- priority: 500
then:
- 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);
id(deep_sleep_1).set_sleep_duration(id(deep_sleep_sleep_duration).state * 60 * 1000);
- if:
condition:
or:
Expand Down
58 changes: 21 additions & 37 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.10.29.1"
version: "24.11.8.1"
device_description: ${name} made by Apollo Automation - version ${version}.

esp32:
Expand All @@ -20,13 +20,9 @@ api:
- lambda: |-
ESP_LOGW("Apollo", "Preventing Deep Sleep Due To OTA Or Switch");
id(deep_sleep_1).prevent_deep_sleep();
else:
- if:
condition:
switch.is_on: sleep_after_connecting
then:
- deep_sleep.enter:
id: deep_sleep_1
else:
- deep_sleep.enter:
id: deep_sleep_1
services:
#Co2 Calibration Service
- service: calibrate_co2_value
Expand Down Expand Up @@ -77,7 +73,7 @@ i2c:
deep_sleep:
id: deep_sleep_1
sleep_duration: 5min
run_duration: 1min
run_duration: 2min

number:
- platform: template
Expand Down Expand Up @@ -106,25 +102,6 @@ number:
update_interval: never
step: 0.1
mode: box

- platform: template
name: "Run Duration"
id: deep_sleep_run_duration
min_value: 1
max_value: 800
step: 1
mode: box
update_interval: never
optimistic: true
restore_value: true
initial_value: 1
icon: "mdi:arrow-collapse-right"
entity_category: CONFIG
unit_of_measurement: "min"
on_value:
then:
- lambda: |-
id(deep_sleep_1).set_run_duration(x * 1000);

- platform: template
name: "Sleep Duration"
Expand All @@ -143,7 +120,7 @@ number:
on_value:
then:
- lambda: |-
id(deep_sleep_1).set_sleep_duration(x * 60 * 60 * 1000);
id(deep_sleep_1).set_sleep_duration(x * 60 * 1000);

binary_sensor:
Expand Down Expand Up @@ -432,13 +409,6 @@ switch:
then:
- lambda: |-
id(deep_sleep_1).allow_deep_sleep();
- platform: template
name: "Sleep After Connecting"
id: sleep_after_connecting
icon: mdi:sleep
restore_mode: RESTORE_DEFAULT_ON
optimistic: true
entity_category: "config"
script:
- id: testScript
Expand Down Expand Up @@ -542,4 +512,18 @@ script:
green: 100%
blue: 0%
- delay: 5s
- light.turn_off: rgb_light
- light.turn_off: rgb_light
- id: reportAllValues
then:
- component.update: mics4514
- component.update: sen55
- component.update: dps_310
- component.update: scd40
- component.update: wifi_signal_db
- component.update: sys_esp_temperature
- component.update: sys_uptime
- component.update: voc_quality
- component.update: pm0_3_to_1
- component.update: pm1_to_2_5
- component.update: pm2_5_to_4
- component.update: pm4_to_10

0 comments on commit ed0a16a

Please sign in to comment.