diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..115d2ab --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,49 @@ + +Version: + + +## What does this implement/fix? + + + +## Types of changes + + +- [ ] Bugfix (fixed change that fixes an issue) +- [ ] New feature (thanks!) +- [ ] Breaking change (repair/feature that breaks existing functionality) +- [ ] Dependency Update - Does not publish +- [ ] Other - Does not publish +- [ ] Website of github readme file update - Does not publish +- [ ] Github workflows - Does not publish + + +## Checklist / Checklijst: + + + - [ ] The code change has been tested and works locally + - [ ] The code change has not yet been tested + +If user-visible functionality or configuration variables are added/modified: + - [ ] Added/updated documentation for the web page + + + + diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..115b41c --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,51 @@ +name-template: 'Release v$NEXT_PATCH_VERSION' +tag-template: "$RESOLVED_VERSION" +change-template: "- #$NUMBER $TITLE @$AUTHOR" +sort-direction: ascending + +categories: + - title: "🚨 Breaking changes" + labels: + - "breaking-change" + - title: "✨ New features" + labels: + - "new-feature" + - title: "🐛 Bug fixes" + labels: + - "bugfix" +# - title: "🚀 Enhancements" +# labels: +# - "enhancement" +# - "refactor" +# - "performance" +# - title: "🧰 Maintenance" +# labels: +# - "maintenance" +# - "ci" +# - title: "📚 Documentation" +# labels: +# - "documentation" + - title: "⬆️ Dependency updates" + collapse-after: 5 + labels: + - "dependency-update" +# - title: "🚨🚨 Security Fixes 🚨🚨" +# labels: +# - "security" + + +include-labels: + - "bugfix" + - "new-feature" + - "breaking-change" + +no-changes-template: '- No changes' + +template: | + ## What's Changed + + $CHANGES + + **Full Changelog**: https://github.com/ApolloAutomation/PLT-1/compare/$PREVIOUS_TAG...$RESOLVED_VERSION.1 + + Be sure to 🌟 this repository for updates! \ No newline at end of file diff --git a/.github/workflows/autoassign.yml b/.github/workflows/autoassign.yml index 0158e68..d5a6557 100644 --- a/.github/workflows/autoassign.yml +++ b/.github/workflows/autoassign.yml @@ -12,7 +12,7 @@ jobs: pull-requests: write steps: - name: 'Auto-assign issue' - uses: pozil/auto-assign-issue@v1 + uses: pozil/auto-assign-issue@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} assignees: TrevorSchirmer diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..e6173e3 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,37 @@ +name: Build and Publish + +on: + push: + branches: + - main + workflow_dispatch: + inputs: + bypass-yaml-check: + description: 'Bypass YAML change check (force build/publish)' + type: boolean + required: false + default: false + # release: + # types: [published] + +jobs: + build-and-publish: + uses: ApolloAutomation/Workflows/.github/workflows/build.yml@main + permissions: + contents: write + pages: write + id-token: write + pull-requests: write + with: + device-name: plt-1 + yaml-files: | + Integrations/ESPHome/PLT-1.yaml + Integrations/ESPHome/PLT-1B.yaml + firmware-names: "1:firmware,1B:firmware-b" + core-yaml-path: Integrations/ESPHome/Core.yaml + esphome-version: stable + # Bypass check if manually triggered with bypass option + check-yaml-changes: ${{ !(github.event_name == 'workflow_dispatch' && github.event.inputs.bypass-yaml-check == 'true') }} + publish-to-pages: true + has-installer: true + installer-path: static \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 356c486..3a52c00 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,32 +3,45 @@ name: CI on: pull_request: -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number }} - cancel-in-progress: true +permissions: + # Allow GITHUB_TOKEN to add labels to pull requests + pull-requests: write + issues: write + contents: read + id-token: write jobs: + label-check: + name: Label Check + uses: ApolloAutomation/Workflows/.github/workflows/label-check.yml@main + ci: - name: Building ${{ matrix.file }} + name: Building ${{ matrix.file }} / ESPHome ${{ matrix.esphome-version }} / ESPHome ${{ matrix.esphome-version }} runs-on: ubuntu-latest strategy: - fail-fast: false matrix: file: - Integrations/ESPHome/PLT-1.yaml - 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-1B_BLE.yaml - Integrations/ESPHome/PLT-1_Minimal.yaml + - Integrations/ESPHome/PLT-1B_Minimal.yaml esphome-version: - stable - beta - dev steps: - name: Checkout source code - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.2 - name: Build ESPHome firmware to verify configuration - uses: esphome/build-action@v6 + uses: esphome/build-action@v7 with: - yaml-file: ${{ matrix.file }} \ No newline at end of file + yaml-file: ${{ matrix.file }} + + + + + + + diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index c067ebb..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,103 +0,0 @@ -name: Publish -on: - push: - branches: - - main - workflow_dispatch: - inputs: - version: - description: 'The version of the firmware to build' - required: true - release: - types: [published] - -jobs: - build-firmware: - name: Build And Release - uses: esphome/workflows/.github/workflows/build.yml@main - with: - files: | - Integrations/ESPHome/PLT-1.yaml - esphome-version: stable - combined-name: firmware - 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-b: - name: Build And Release - uses: esphome/workflows/.github/workflows/build.yml@main - with: - files: | - Integrations/ESPHome/PLT-1B.yaml - esphome-version: stable - combined-name: firmware-b - 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 - runs-on: ubuntu-latest - steps: - - name: Checkout source code - uses: actions/checkout@v4.1.7 - - name: Build - uses: actions/jekyll-build-pages@v1.0.13 - with: - source: ./static - destination: ./output - - name: Upload - uses: actions/upload-artifact@v4.3.6 - with: - name: site - path: output - - publish: - name: Publish to GitHub Pages - runs-on: ubuntu-latest - needs: - - build-firmware - - build-firmware-b - - build-site - permissions: - pages: write - id-token: write - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - steps: - - uses: actions/download-artifact@v4.1.8 - with: - name: firmware - path: firmware - - uses: actions/download-artifact@v4.1.8 - with: - name: firmware-b - path: firmware-b - - - name: Copy firmware and manifest - run: |- - mkdir -p output/firmware - cp -r firmware/${{ needs.build-firmware.outputs.version }}/* output/firmware/ - - name: Copy firmware and manifest - run: |- - mkdir -p output/firmware-b - cp -r firmware-b/${{ needs.build-firmware.outputs.version }}/* output/firmware-b/ - - - uses: actions/download-artifact@v4.1.8 - with: - name: site - path: output - - - uses: actions/upload-pages-artifact@v3.0.1 - with: - path: output - retention-days: 1 - - - name: Setup Pages - uses: actions/configure-pages@v5.0.0 - - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4.0.5 diff --git a/.github/workflows/weekly.yml b/.github/workflows/weekly.yml new file mode 100644 index 0000000..16c7541 --- /dev/null +++ b/.github/workflows/weekly.yml @@ -0,0 +1,30 @@ +name: Weekly Firmware Build + +on: + schedule: + - cron: '0 0 * * 1' + +jobs: + build: + name: Building ${{ matrix.file }} / ESPHome ${{ matrix.esphome-version }} + runs-on: ubuntu-latest + strategy: + matrix: + file: + - Integrations/ESPHome/PLT-1.yaml + - Integrations/ESPHome/PLT-1_BLE.yaml + - Integrations/ESPHome/PLT-1B.yaml + - Integrations/ESPHome/PLT-1B_BLE.yaml + - Integrations/ESPHome/PLT-1_Minimal.yaml + - Integrations/ESPHome/PLT-1B_Minimal.yaml + esphome-version: + - stable + - beta + - dev + steps: + - name: Checkout source code + uses: actions/checkout@v4.2.2 + - name: Build ESPHome firmware to verify configuration + uses: esphome/build-action@v7 + with: + yaml-file: ${{ matrix.file }} \ No newline at end of file diff --git a/Integrations/ESPHome/Battery.yaml b/Integrations/ESPHome/Battery.yaml index 1a210af..9e77255 100644 --- a/Integrations/ESPHome/Battery.yaml +++ b/Integrations/ESPHome/Battery.yaml @@ -36,7 +36,7 @@ number: id: deep_sleep_sleep_duration min_value: 0 max_value: 800 - step: 1 + step: 0.01 mode: box update_interval: never optimistic: true diff --git a/Integrations/ESPHome/Core.yaml b/Integrations/ESPHome/Core.yaml index 141dec0..e316633 100644 --- a/Integrations/ESPHome/Core.yaml +++ b/Integrations/ESPHome/Core.yaml @@ -1,10 +1,13 @@ substitutions: - version: "25.3.13.1" + version: "25.8.6.1" esp32: board: esp32-c3-devkitm-1 framework: type: esp-idf + advanced: + assertion_level: SILENT + enable_lwip_assert: false api: services: @@ -120,7 +123,7 @@ number: initial_value: '1.55' optimistic: true update_interval: never - step: 0.1 + step: 0.01 mode: box restore_value: true entity_category: "CONFIG" @@ -134,7 +137,7 @@ number: entity_category: "CONFIG" optimistic: true update_interval: never - step: 0.1 + step: 0.01 mode: box min_value: 0.0 max_value: 5.0 @@ -150,6 +153,7 @@ binary_sensor: mode: input: true pullup: true + ignore_strapping_warning: true id: reset_button on_press: then: @@ -270,8 +274,8 @@ sensor: float low = id(dry_voltage).state; float x = id(soil_adc).state; - // Perform linear calibration manually - float calibrated_value = ((100 - 0)/(high - low)) * x + (100 - (((100 - 0)/(high - low)) * high)); + // Perform linear calibration + float calibrated_value = ((x - low)/(high - low)) * 100; // Bound the result between 0 and 100 if (calibrated_value < 0) return 0; @@ -346,6 +350,7 @@ switch: - lambda: |- id(deep_sleep_1).allow_deep_sleep(); + script: - id: statusCheck then: @@ -471,3 +476,4 @@ script: + diff --git a/Integrations/ESPHome/PLT-1.yaml b/Integrations/ESPHome/PLT-1.yaml index 15a5c94..98c5ea7 100644 --- a/Integrations/ESPHome/PLT-1.yaml +++ b/Integrations/ESPHome/PLT-1.yaml @@ -10,7 +10,7 @@ esphome: name: "ApolloAutomation.PLT-1" version: "${version}" - min_version: 2024.2.0 + min_version: 2025.6.0 on_boot: - priority: 800.0 then: diff --git a/Integrations/ESPHome/PLT-1B.yaml b/Integrations/ESPHome/PLT-1B.yaml index 37f5d51..98bfe86 100644 --- a/Integrations/ESPHome/PLT-1B.yaml +++ b/Integrations/ESPHome/PLT-1B.yaml @@ -10,7 +10,7 @@ esphome: name: "ApolloAutomation.PLT-1B" version: "${version}" - min_version: 2024.2.0 + min_version: 2025.6.0 on_boot: - priority: 999.0 then: diff --git a/Integrations/ESPHome/PLT-1B_BLE.yaml b/Integrations/ESPHome/PLT-1B_BLE.yaml index 3a46a70..781f70a 100644 --- a/Integrations/ESPHome/PLT-1B_BLE.yaml +++ b/Integrations/ESPHome/PLT-1B_BLE.yaml @@ -10,7 +10,7 @@ esphome: name: "ApolloAutomation.PLT-1BBLE" version: "${version}" - min_version: 2024.2.0 + min_version: 2025.6.0 on_boot: priority: 500 then: diff --git a/Integrations/ESPHome/PLT-1B_Minimal.yaml b/Integrations/ESPHome/PLT-1B_Minimal.yaml index e874c64..52a85a2 100644 --- a/Integrations/ESPHome/PLT-1B_Minimal.yaml +++ b/Integrations/ESPHome/PLT-1B_Minimal.yaml @@ -10,7 +10,7 @@ esphome: name: "ApolloAutomation.PLT-1B_Minimal" version: "${version}" - min_version: 2024.2.0 + min_version: 2025.6.0 on_boot: - priority: 999.0 then: diff --git a/Integrations/ESPHome/PLT-1_BLE.yaml b/Integrations/ESPHome/PLT-1_BLE.yaml index 1e8241d..c414d28 100644 --- a/Integrations/ESPHome/PLT-1_BLE.yaml +++ b/Integrations/ESPHome/PLT-1_BLE.yaml @@ -10,7 +10,7 @@ esphome: name: "ApolloAutomation.PLT-1BLE" version: "${version}" - min_version: 2024.2.0 + min_version: 2025.6.0 on_boot: priority: 500 then: diff --git a/Integrations/ESPHome/PLT-1_Minimal.yaml b/Integrations/ESPHome/PLT-1_Minimal.yaml index cc5fb26..87722e2 100644 --- a/Integrations/ESPHome/PLT-1_Minimal.yaml +++ b/Integrations/ESPHome/PLT-1_Minimal.yaml @@ -10,7 +10,7 @@ esphome: name: "ApolloAutomation.PLT-1_Minimal" version: "${version}" - min_version: 2024.2.0 + min_version: 2025.6.0 on_boot: - priority: 800.0 then: