Skip to content

Commit

Permalink
Merge pull request #19 from ApolloAutomation/beta
Browse files Browse the repository at this point in the history
Fix ESP Build & Bad Reporting On Wakeup
  • Loading branch information
TrevorSchirmer authored Feb 20, 2025
2 parents 8d40aa6 + ea78953 commit 110d83e
Show file tree
Hide file tree
Showing 20 changed files with 781 additions and 44 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ jobs:
- Integrations/ESPHome/TEMP-1_Beta.yaml
- Integrations/ESPHome/TEMP-1_Minimal.yaml
- Integrations/ESPHome/TEMP-1B_Minimal.yaml

- Integrations/ESPHome/TEMP-1_R2.yaml
- Integrations/ESPHome/TEMP-1B_R2.yaml
- Integrations/ESPHome/TEMP-1_BLE_R2.yaml
- Integrations/ESPHome/TEMP-1B_BLE_R2.yaml
- Integrations/ESPHome/TEMP-1_Minimal_R2.yaml
- Integrations/ESPHome/TEMP-1B_Minimal_R2.yaml
esphome-version:
- stable
- beta
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,30 @@ jobs:
release-summary: ${{ github.event_name == 'release' && github.event.release.body || '' }}
release-url: ${{ github.event_name == 'release' && github.event.release.html_url || '' }}
release-version: ${{ (github.event_name == 'release' && github.event.release.tag_name) || (github.event_name == 'workflow_dispatch' && inputs.version) || '' }}

build-firmware2:
name: Build And Release
uses: esphome/workflows/.github/workflows/build.yml@main
with:
files: |
Integrations/ESPHome/TEMP-1_R2.yaml
esphome-version: stable
combined-name: firmware2
release-summary: ${{ github.event_name == 'release' && github.event.release.body || '' }}
release-url: ${{ github.event_name == 'release' && github.event.release.html_url || '' }}
release-version: ${{ (github.event_name == 'release' && github.event.release.tag_name) || (github.event_name == 'workflow_dispatch' && inputs.version) || '' }}

build-firmware-b2:
name: Build And Release
uses: esphome/workflows/.github/workflows/build.yml@main
with:
files: |
Integrations/ESPHome/TEMP-1B_R2.yaml
esphome-version: stable
combined-name: firmware-b2
release-summary: ${{ github.event_name == 'release' && github.event.release.body || '' }}
release-url: ${{ github.event_name == 'release' && github.event.release.html_url || '' }}
release-version: ${{ (github.event_name == 'release' && github.event.release.tag_name) || (github.event_name == 'workflow_dispatch' && inputs.version) || '' }}

build-site:
name: Build Site
Expand All @@ -59,6 +83,8 @@ jobs:
needs:
- build-firmware
- build-firmware-b
- build-firmware2
- build-firmware-b2
- build-site
permissions:
pages: write
Expand All @@ -75,6 +101,14 @@ jobs:
with:
name: firmware-b
path: firmware-b
- uses: actions/[email protected]
with:
name: firmware-b2
path: firmware-b2
- uses: actions/[email protected]
with:
name: firmware2
path: firmware2

- name: Copy firmware and manifest
run: |-
Expand All @@ -84,6 +118,14 @@ jobs:
run: |-
mkdir -p output/firmware-b
cp -r firmware-b/${{ needs.build-firmware.outputs.version }}/* output/firmware-b/
- name: Copy firmware and manifest
run: |-
mkdir -p output/firmware2
cp -r firmware2/${{ needs.build-firmware.outputs.version }}/* output/firmware2/
- name: Copy firmware and manifest
run: |-
mkdir -p output/firmware-b2
cp -r firmware-b2/${{ needs.build-firmware.outputs.version }}/* output/firmware-b2/
- uses: actions/[email protected]
with:
Expand Down
10 changes: 10 additions & 0 deletions Integrations/ESPHome/100Resistance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
sensor:
- platform: resistance
id: resistance_sensor
sensor: source_sensor
configuration: UPSTREAM
reference_voltage: 3.3V
resistor: 100kOhm
name: Resistance Sensor
internal: true
accuracy_decimals: 4
15 changes: 1 addition & 14 deletions Integrations/ESPHome/Battery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,4 @@ script:
- component.update: wifi_signal_db
- component.update: sys_esp_temperature
- component.update: sys_uptime
- component.update: max_17048

interval:
- interval: 30s
then:
- switch.turn_on: accessory_power
- delay: 10s
- component.update: source_sensor
- component.update: aht_20
- component.update: temp_probe
- delay: 10s
- light.turn_off:
id: rgb_light
- switch.turn_off: accessory_power
- component.update: max_17048
52 changes: 35 additions & 17 deletions Integrations/ESPHome/Core.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
substitutions:
version: "25.1.30.1"
version: "25.2.19.1"

esp32:
board: esp32-c3-devkitm-1
framework:
type: esp-idf
version: 4.4.8
platform_version: 5.4.0

api:
services:
Expand All @@ -28,6 +30,7 @@ api:
ESP_LOGW("Apollo", "Preventing Deep Sleep Due To OTA Or Switch");
id(deep_sleep_1).prevent_deep_sleep();
else:
- switch.turn_on: accessory_power
- delay: 10s
- lambda: |-
id(reportAllValues).execute();
Expand Down Expand Up @@ -72,6 +75,7 @@ i2c:

one_wire:
- platform: gpio
id: one_wire_bus
pin:
number: GPIO6

Expand Down Expand Up @@ -134,7 +138,7 @@ number:
restore_value: true
initial_value: 125.0
min_value: -55.0
max_value: 125.0
max_value: 300.0
entity_category: "CONFIG"
unit_of_measurement: "°C"
optimistic: true
Expand Down Expand Up @@ -169,6 +173,7 @@ number:
update_interval: never
step: 0.1
mode: box
disabled_by_default: true

binary_sensor:
- platform: status
Expand Down Expand Up @@ -245,15 +250,23 @@ sensor:

- platform: dallas_temp
name: "Temperature Probe"
update_interval: never
update_interval: 60s
id: temp_probe
filters:
- lambda: |-
// If the Food probe is selected, return NaN (not a number)
if (isnan(x)) {
return NAN;
}
if (x == 85.0) {
return NAN;
}
if (id(temp_probe_select).state == "Food") {
return NAN; // Report NaN
return NAN;
}
return x; // Otherwise, return the normal value
return x;
on_value:
if:
condition:
Expand All @@ -275,7 +288,7 @@ sensor:
id: aht_humidity
filters:
- lambda: return x - id(aht_humidity_offset).state;
update_interval: never
update_interval: 60s

- platform: ntc
id: ntc_sensor
Expand All @@ -301,21 +314,16 @@ sensor:
- lambda: |-
id(tempRangeCheck).execute();
- platform: resistance
id: resistance_sensor
sensor: source_sensor
configuration: UPSTREAM
reference_voltage: 3.3V
resistor: 100kOhm
name: Resistance Sensor
internal: true

- platform: adc
pin:
number: GPIO4
id: source_sensor
update_interval: never
attenuation: auto
attenuation: 12db
filters:
- sliding_window_moving_average:
window_size: 3
send_every: 3

light:
- platform: esp32_rmt_led_strip
Expand Down Expand Up @@ -351,6 +359,7 @@ button:
name: "Factory Reset ESP"
id: factory_reset_all


select:
- platform: template
name: "Select Probe"
Expand Down Expand Up @@ -424,6 +433,7 @@ switch:
restore_mode: RESTORE_DEFAULT_OFF
optimistic: true
entity_category: "config"
disabled_by_default: true


script:
Expand Down Expand Up @@ -548,3 +558,11 @@ script:
- light.turn_off:
id: rgb_light

interval:
- interval: 1s
then:
- if:
condition:
- switch.is_off: sensor_selector
then:
- component.update: source_sensor
10 changes: 10 additions & 0 deletions Integrations/ESPHome/NewResistance.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
sensor:
- platform: resistance
id: resistance_sensor
sensor: source_sensor
configuration: UPSTREAM
reference_voltage: 3.3V
resistor: 4.7kOhm
name: Resistance Sensor
internal: true
accuracy_decimals: 4
13 changes: 1 addition & 12 deletions Integrations/ESPHome/NonBattery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,4 @@ script:
- component.update: aht_20
- component.update: wifi_signal_db
- component.update: sys_esp_temperature
- component.update: sys_uptime

interval:
- interval: 30s
then:
- switch.turn_on: accessory_power
- delay: 10s
- component.update: source_sensor
- component.update: aht_20
- component.update: temp_probe
- delay: 10s
- switch.turn_off: accessory_power
- component.update: sys_uptime
3 changes: 3 additions & 0 deletions Integrations/ESPHome/TEMP-1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ esphome:
switch.is_on: notify_only_outside_temp_difference
then:
- logger.log: "Apollo Automation: Notify Only Outside Temp Difference"
- switch.turn_on: accessory_power
- delay: 5s
- lambda: |-
id(reportAllValues).execute();
- delay: 5s
Expand Down Expand Up @@ -123,3 +125,4 @@ logger:
packages:
core: !include Core.yaml
nonbattery: !include NonBattery.yaml
100Resistance: !include 100Resistance.yaml
3 changes: 3 additions & 0 deletions Integrations/ESPHome/TEMP-1B.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ esphome:
switch.is_on: notify_only_outside_temp_difference
then:
- logger.log: "Apollo Automation: Notify Only Outside Temp Difference"
- switch.turn_on: accessory_power
- delay: 5s
- lambda: |-
id(reportAllValues).execute();
- delay: 5s
Expand Down Expand Up @@ -123,3 +125,4 @@ logger:
packages:
core: !include Core.yaml
battery: !include Battery.yaml
100Resistance: !include 100Resistance.yaml
3 changes: 3 additions & 0 deletions Integrations/ESPHome/TEMP-1B_BLE.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ esphome:
switch.is_on: notify_only_outside_temp_difference
then:
- logger.log: "Apollo Automation: Notify Only Outside Temp Difference"
- switch.turn_on: accessory_power
- delay: 5s
- lambda: |-
id(reportAllValues).execute();
- delay: 5s
Expand Down Expand Up @@ -96,3 +98,4 @@ esp32_ble_tracker:
packages:
core: !include Core.yaml
battery: !include Battery.yaml
100Resistance: !include 100Resistance.yaml
Loading

0 comments on commit 110d83e

Please sign in to comment.