Skip to content

Add Zendure Smart Meter P1 integration#171027

Draft
NextNebula wants to merge 20 commits into
home-assistant:devfrom
NextNebula:zendure-p1
Draft

Add Zendure Smart Meter P1 integration#171027
NextNebula wants to merge 20 commits into
home-assistant:devfrom
NextNebula:zendure-p1

Conversation

@NextNebula
Copy link
Copy Markdown
Contributor

@NextNebula NextNebula commented May 17, 2026

Proposed change

This PR adds a new integration for the Zendure Smart Meter P1, a local P1 smart meter dongle that reads energy data from a smart meter and exposes it via a local HTTP API. The integration uses a DataUpdateCoordinator to poll the device and exposes the reported values as sensor entities. It communicates with devices on the local network using the zendure-p1 library.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds the new zendure_p1 Home Assistant integration (Zendure Smart Meter P1) with config flow + coordinator-driven sensor entities, plus test coverage and required metadata/requirements.

Changes:

  • Introduces the zendure_p1 integration (config flow, coordinator, base entity, sensors, translations, manifest, quality scale)
  • Adds comprehensive pytest coverage + snapshots for config flow, init/unload, entities, and sensor values
  • Registers the integration in generated registries, requirements files, and CODEOWNERS

Reviewed changes

Copilot reviewed 19 out of 21 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
homeassistant/components/zendure_p1/init.py Sets up config entry, coordinator, unload/reload wiring
homeassistant/components/zendure_p1/config_flow.py Implements user config flow and host validation
homeassistant/components/zendure_p1/coordinator.py Polling coordinator and error translation mapping
homeassistant/components/zendure_p1/sensor.py Coordinator-backed sensor entities and descriptions
homeassistant/components/zendure_p1/entity.py Base CoordinatorEntity + DeviceInfo
homeassistant/components/zendure_p1/const.py Defines domain/platforms + polling interval
homeassistant/components/zendure_p1/strings.json UI strings, entity names, exception translations
homeassistant/components/zendure_p1/manifest.json Integration metadata + dependency pin
homeassistant/components/zendure_p1/quality_scale.yaml Declares quality scale rule status
tests/components/zendure_p1/conftest.py Shared fixtures/mocks for integration tests
tests/components/zendure_p1/test_config_flow.py Config flow success/abort/error handling tests
tests/components/zendure_p1/test_init.py Setup/unload and setup-retry tests
tests/components/zendure_p1/test_entity.py Device registry association test
tests/components/zendure_p1/test_sensor.py Snapshot + coordinator refresh value assertions
tests/components/zendure_p1/snapshots/test_sensor.ambr Sensor entity/state snapshots
homeassistant/generated/integrations.json Registers integration metadata
homeassistant/generated/config_flows.py Registers config flow domain
requirements_all.txt Adds runtime dependency for integration
requirements_test_all.txt Adds test dependency for integration
CODEOWNERS Adds code ownership for integration + tests

Comment thread homeassistant/components/zendure_p1/__init__.py Outdated
Comment thread homeassistant/components/zendure_p1/config_flow.py Outdated
Comment thread homeassistant/components/zendure_p1/const.py Outdated
Comment thread tests/components/zendure_p1/test_init.py Outdated
Comment thread tests/components/zendure_p1/test_init.py Outdated
Copilot AI review requested due to automatic review settings May 17, 2026 21:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 19 out of 21 changed files in this pull request and generated 4 comments.

Comment thread homeassistant/components/zendure_p1/coordinator.py
Comment thread homeassistant/components/zendure_p1/config_flow.py Outdated
Comment thread tests/components/zendure_p1/test_sensor.py
Comment thread tests/components/zendure_p1/conftest.py
Copilot AI review requested due to automatic review settings May 17, 2026 22:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 19 out of 21 changed files in this pull request and generated 3 comments.

Comment thread homeassistant/components/zendure_p1/__init__.py Outdated
Comment thread homeassistant/components/zendure_p1/config_flow.py Outdated
Comment thread homeassistant/components/zendure_p1/config_flow.py Outdated
Copilot AI review requested due to automatic review settings May 17, 2026 22:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 19 out of 21 changed files in this pull request and generated 3 comments.

Comment thread tests/components/zendure_p1/test_init.py Outdated
Comment thread tests/components/zendure_p1/test_config_flow.py
Comment thread homeassistant/components/zendure_p1/sensor.py Outdated
Copilot AI review requested due to automatic review settings May 17, 2026 23:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 22 out of 24 changed files in this pull request and generated 4 comments.

Comment thread tests/components/zendure_p1/test_sensor.py
ZendureP1TimeoutError,
) as err:
LOGGER.debug("Cannot connect to Zendure P1: %s", err)
errors["base"] = "cannot_connect"
Comment thread homeassistant/components/zendure_p1/const.py
self._attr_device_info = DeviceInfo(
identifiers={(DOMAIN, coordinator.data.device_id)},
manufacturer="Zendure",
name="Smart Meter P1",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants