Skip to content

Commit

Permalink
Merge pull request #21 from ApolloAutomation/Smol
Browse files Browse the repository at this point in the history
Reduce Firmware Size During ESPHome Addon Import
  • Loading branch information
TrevorSchirmer authored Dec 22, 2024
2 parents d7bcbb2 + 65bff77 commit 9cbec7f
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
- Integrations/ESPHome/PLT-1_BLE.yaml
- Integrations/ESPHome/PLT-1B_BLE.yaml
- Integrations/ESPHome/PLT-1B.yaml
- Integrations/ESPHome/PLT-1B_Minimal.yaml
- Integrations/ESPHome/PLT-1_Minimal.yaml
esphome-version:
- stable
- beta
Expand Down
5 changes: 2 additions & 3 deletions Integrations/ESPHome/Core.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
substitutions:
version: "24.12.7.1"
version: "24.12.21.1"

esp32:
board: esp32-c3-devkitm-1
framework:
type: esp-idf


api:
services:
- service: play_buzzer
Expand Down Expand Up @@ -68,8 +69,6 @@ globals:

captive_portal:

web_server:
port: 80

i2c:
sda: GPIO1
Expand Down
5 changes: 4 additions & 1 deletion Integrations/ESPHome/PLT-1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,17 @@ esphome:
- light.turn_off: rgb_light

dashboard_import:
package_import_url: github://ApolloAutomation/PLT-1/Integrations/ESPHome/PLT-1.yaml
package_import_url: github://ApolloAutomation/PLT-1/Integrations/ESPHome/PLT-1_Minimal.yaml
import_full_config: false

improv_serial:

esp32_improv:
authorizer: none

web_server:
port: 80

ota:
- platform: esphome
id: ota_esphome
Expand Down
5 changes: 4 additions & 1 deletion Integrations/ESPHome/PLT-1B.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ esphome:
- switch.turn_off: accessory_power

dashboard_import:
package_import_url: github://ApolloAutomation/PLT-1/Integrations/ESPHome/PLT-1B.yaml
package_import_url: github://ApolloAutomation/PLT-1/Integrations/ESPHome/PLT-1B_Minimal.yaml
import_full_config: false

improv_serial:
Expand All @@ -58,6 +58,9 @@ http_request:

safe_mode:

web_server:
port: 80

update:
- platform: http_request
id: firmware_update
Expand Down
62 changes: 62 additions & 0 deletions Integrations/ESPHome/PLT-1B_Minimal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
esphome:
name: "apollo-plt-1b-minimal"
friendly_name: Apollo PLT-1B Minimal
comment: Apollo PLT-1B Minimal
name_add_mac_suffix: true
platformio_options:
board_build.flash_mode: dio

project:
name: "ApolloAutomation.PLT-1B_Minimal"
version: "${version}"

min_version: 2024.2.0
on_boot:
- priority: 999.0
then:
- lambda: |-
id(deep_sleep_1).set_sleep_duration(id(deep_sleep_sleep_duration).state * 60 * 60 * 1000);
id(deep_sleep_1).set_run_duration(90 * 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();
- priority: -10
then:
- if:
condition:
- lambda: "return id(runTest);"
then:
- lambda: "id(testScript).execute();"

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

dashboard_import:
package_import_url: github://ApolloAutomation/PLT-1/Integrations/ESPHome/PLT-1B_Minimal.yaml
import_full_config: false

improv_serial:

ota:
- platform: esphome
id: ota_esphome

web_server:
port: 80

wifi:
ap:
ssid: "Apollo PLT1B Hotspot"

logger:

packages:
core: !include Core.yaml
battery: !include Battery.yaml
62 changes: 62 additions & 0 deletions Integrations/ESPHome/PLT-1_Minimal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
esphome:
name: "apollo-plt-1-minimal"
friendly_name: Apollo PLT-1 Minimal
comment: Apollo PLT-1 Minimal
name_add_mac_suffix: true
platformio_options:
board_build.flash_mode: dio

project:
name: "ApolloAutomation.PLT-1_Minimal"
version: "${version}"

min_version: 2024.2.0
on_boot:
- priority: 800.0
then:
- lambda: |-
id(deep_sleep_1).set_sleep_duration(id(deep_sleep_sleep_duration).state * 60 * 1000);
id(deep_sleep_1).set_run_duration(90 * 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();
- priority: -10
then:
- if:
condition:
- lambda: "return id(runTest);"
then:
- lambda: "id(testScript).execute();"

on_shutdown:
- light.turn_off: rgb_light

dashboard_import:
package_import_url: github://ApolloAutomation/PLT-1/Integrations/ESPHome/PLT-1_Minimal.yaml
import_full_config: false

improv_serial:

ota:
- platform: esphome
id: ota_esphome

web_server:
port: 80

wifi:
ap:
ssid: "Apollo PLT1 Hotspot"

logger:

packages:
core: !include Core.yaml
nonbattery: !include NonBattery.yaml

0 comments on commit 9cbec7f

Please sign in to comment.