Skip to content

fix: replace deprecated OTA password with encryption - #150

Merged
Lewa-Reka merged 1 commit into
Lewa-Reka:mainfrom
Bonabrux:fix/ota-encryption
Oct 10, 2026
Merged

Lewa-Reka merged 1 commit into
Lewa-Reka:mainfrom
Bonabrux:fix/ota-encryption

Conversation

@Bonabrux

@Bonabrux Bonabrux commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

ESPHome 2026.9 warns that the OTA password is redundant: the API encryption key already authenticates uploads. OTA now uses encryption (same key), the ota_password substitution is dropped everywhere, min_version is 2026.9.0.

Description

ESPHome 2026.9 flags the OTA password as redundant:

'ota' password wastes significant flash and RAM (about 3.5 KB and 60 bytes plus the password on the heap): the device already offers encryption with the 'api' encryption key, which authenticates any uploader that takes it [...] remove 'password' and add 'encryption' under 'ota'

This PR follows that recommendation: OTA uploads are now authenticated and encrypted with the
existing API encryption key, so a separate OTA password is no longer needed.

Changes

  • pv_inverter/packages/init.yaml: ota_esphome uses encryption: (reuses the API key)
    instead of password: ${ota_password}; min_version bumped to 2026.9.0
  • devices/*/Deye-*.factory.yaml: encryption: !remove instead of password: !remove
  • devices/*/Deye-*.yaml: ota_password substitution removed, min_version → 2026.9.0
  • pv-inverter*.yaml, tests/*.yaml, tests/secrets.yaml, docs/INSTALLATION.md:
    ota_password / pv_inverter_ota_password removed

Impact for users

  • An ota_password substitution left in a user's config is simply unused; nothing breaks.
  • ESPHome 2026.9.0 or newer is required.
  • Uploads from the ESPHome dashboard/CLI keep working with the API key already in the config.

Testing

  • esphome config passes on ESPHome 2026.9.1 for all CI configs
    (deye_hybrid_1p_lv, deye_hybrid_3p_lv, deye_hybrid_3p_hv); the OTA warning is gone
  • ESP32 for Deye SG0xLP1 device running this config, updated over the air with encryption-only OTA, migrated from password OTA to encryption OTA without the need of a serial reflash

Changes relate to

  • Docs
  • Deye 3P LP
  • Deye 3P HV
  • Deye 1P LP
  • Other

Summary by Sourcery

Migrate ESPHome OTA updates from dedicated passwords to API-key-based encryption and remove the redundant OTA password configuration.

Bug Fixes:

  • Replace password-based ESPHome OTA authentication with encrypted OTA using the existing API encryption key.

Enhancements:

  • Remove obsolete OTA password substitutions and factory overrides from device configurations and test fixtures.
  • Require ESPHome 2026.9.0 or newer across supported configurations.

Documentation:

  • Update installation instructions to remove the no-longer-required OTA password secret.

ESPHome 2026.9 warns that the OTA password is redundant: the API encryption
key already authenticates uploads. OTA now uses encryption (same key), the
ota_password substitution is dropped everywhere, min_version is 2026.9.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Lewa-Reka

Copy link
Copy Markdown
Owner

@sourcery-ai review

@sourcery-ai

sourcery-ai Bot commented Oct 10, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR updates all ESPHome configurations to use the API encryption key for encrypted OTA uploads, removes the redundant OTA password substitution from device configs, tests, secrets, and documentation, and requires ESPHome 2026.9.0 or newer.

Flow diagram for the OTA configuration migration

flowchart TD
    Config[Device configuration]
    Version[Require ESPHome 2026.9.0+]
    Encryption[Configure ota_esphome with encryption]
    Remove[Remove ota_password substitution]
    Upload[Dashboard or CLI encrypted OTA upload]

    Config --> Version --> Encryption
    Config --> Remove
    Encryption --> Upload
    Upload --> Device[Device accepts upload using API encryption key]
Loading

File-Level Changes

Change Details Files
Migrate ESPHome OTA authentication from a standalone password to API-key-based encryption.
  • Replace the OTA password setting with an empty encryption: configuration that reuses the API encryption key.
  • Update factory variants to remove the inherited encryption setting where required by the factory configuration.
  • Raise the ESPHome minimum version to 2026.9.0.
pv_inverter/packages/init.yaml
devices/Waveshare-ESP32-S3-RS485-CAN/Deye-SG0xHP3.factory.yaml
devices/Waveshare-ESP32-S3-RS485-CAN/Deye-SG0xHP3.yaml
devices/Waveshare-ESP32-S3-RS485-CAN/Deye-SG0xLP1.factory.yaml
devices/Waveshare-ESP32-S3-RS485-CAN/Deye-SG0xLP1.yaml
devices/Waveshare-ESP32-S3-RS485-CAN/Deye-SG0xLP3.factory.yaml
devices/Waveshare-ESP32-S3-RS485-CAN/Deye-SG0xLP3.yaml
Remove obsolete OTA password inputs from user configurations, test fixtures, and installation documentation.
  • Delete ota_password and pv_inverter_ota_password substitutions and test secrets.
  • Remove the OTA password from documented setup examples while retaining the API key requirement.
pv-inverter.Deye-SG0XHP3.yaml
pv-inverter.Deye-SG0XLP1.yaml
pv-inverter.Deye-SG0XLP3.yaml
pv-inverter.yaml
tests/deye_hybrid_1p_lv.yaml
tests/deye_hybrid_3p_hv.yaml
tests/deye_hybrid_3p_lv.yaml
tests/secrets.yaml
docs/INSTALLATION.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="pv_inverter/packages/init.yaml" line_range="22" />
<code_context>
   name: deye-inverter
   friendly_name: Deye Inverter
-  min_version: "2026.8.0"
+  min_version: "2026.9.0"
   name_add_mac_suffix: true

</code_context>
<issue_to_address>
**ESPHome 2026.8 rejects configuration**

When a user follows the documented minimum and runs ESPHome 2026.8, the `min_version` check rejects the configuration, so users cannot validate, build, or install it and see a version error.

Align `min_version` with the documented 2026.8 minimum, or update the documentation to require 2026.9.

Also at `devices/Waveshare-ESP32-S3-RS485-CAN/Deye-SG0xHP3.yaml:42`, `devices/Waveshare-ESP32-S3-RS485-CAN/Deye-SG0xLP1.yaml:39`, `devices/Waveshare-ESP32-S3-RS485-CAN/Deye-SG0xLP3.yaml:42`.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 1 finding to address first, and this changes the OTA trust boundary for every generated device: OTA authentication moves from a separate password to the API encryption key, and deployed devices retain that decision even if the repository change is reverted. If the key reuse or encryption configuration is unsuitable, OTA access could be broadly exposed or become unusable without a physical recovery path.

Blocking findings: pv_inverter/packages/init.yaml:22


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

friendly_name: "${friendly_name}"
comment: "${device_description} by Lewa-Reka https://github.com/Lewa-Reka/esphome-deye-inverter"
min_version: "2026.8.0"
min_version: "2026.9.0"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · ESPHome 2026.8 rejects configuration

When a user follows the documented minimum and runs ESPHome 2026.8, the min_version check rejects the configuration, so users cannot validate, build, or install it and see a version error.

Align min_version with the documented 2026.8 minimum, or update the documentation to require 2026.9.

Also at devices/Waveshare-ESP32-S3-RS485-CAN/Deye-SG0xHP3.yaml:42, devices/Waveshare-ESP32-S3-RS485-CAN/Deye-SG0xLP1.yaml:39, devices/Waveshare-ESP32-S3-RS485-CAN/Deye-SG0xLP3.yaml:42.

Prompt for AI agents
In `pv_inverter/packages/init.yaml` at line 22:

**ESPHome 2026.8 rejects configuration**

When a user follows the documented minimum and runs ESPHome 2026.8, the `min_version` check rejects the configuration, so users cannot validate, build, or install it and see a version error.

Align `min_version` with the documented 2026.8 minimum, or update the documentation to require 2026.9.

Also at `devices/Waveshare-ESP32-S3-RS485-CAN/Deye-SG0xHP3.yaml:42`, `devices/Waveshare-ESP32-S3-RS485-CAN/Deye-SG0xLP1.yaml:39`, `devices/Waveshare-ESP32-S3-RS485-CAN/Deye-SG0xLP3.yaml:42`.

@Lewa-Reka

Copy link
Copy Markdown
Owner

@Bonabrux thx

@Lewa-Reka
Lewa-Reka merged commit c68768a into Lewa-Reka:main Oct 10, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants