Skip to content

Add sensors, number and select for Tuya EV charger (qccdz) - #181453

Draft
o-borovets wants to merge 1 commit into
home-assistant:devfrom
o-borovets:tuya-qccdz-ev-charger
Draft

Add sensors, number and select for Tuya EV charger (qccdz)#181453
o-borovets wants to merge 1 commit into
home-assistant:devfrom
o-borovets:tuya-qccdz-ev-charger

Conversation

@o-borovets

Copy link
Copy Markdown

Proposed change

The Tuya qccdz (EV charger) category currently exposes only the on/off switch.
This adds the remaining data points these chargers report:

  • sensors: work_state (status enum), forward_energy_total (total energy, kWh,
    total_increasing), charge_energy_once (session energy), sigle_phase_power
    and power_total (kW), temp_current (°C, diagnostic)
  • number: charge_cur_set (charging current, A)
  • select: work_mode (charge_now / charge_pct / charge_energy / charge_schedule)

New DP codes: charge_cur_set, charge_energy_once, sigle_phase_power
(Tuya's own spelling). Fixture qccdz_dsmsam7xpb3ht7rl added from device
diagnostics; snapshots updated — the existing qccdz_7bvgooyjhiua1yyq fixture
gains status, session energy and mode entities.

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

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:

Copilot AI balanced review requested due to automatic review settings September 6, 2026 13:41

@home-assistant home-assistant Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @o-borovets

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@home-assistant home-assistant Bot added cla-needed has-tests integration: tuya new-feature Top 100 Integration is ranked within the top 100 by usage Top 200 Integration is ranked within the top 200 by usage Top 50 Integration is ranked within the top 50 by usage labels Sep 6, 2026
@home-assistant

home-assistant Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant
home-assistant Bot marked this pull request as draft September 6, 2026 13:41
@home-assistant

home-assistant Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Hey there @tuya, @zlinoliver, mind taking a look at this pull request as it has been labeled with an integration (tuya) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of tuya can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign tuya Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant update-branch Update the pull request branch with the base branch.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The entity definitions align with Tuya metadata and are covered by representative fixtures and snapshots.

Pull request overview

Adds broader Tuya qccdz EV charger support across sensor, number, and select platforms.

Changes:

  • Adds charger status, energy, power, temperature, current, and mode entities.
  • Adds DP codes and entity translations.
  • Adds a charger fixture and comprehensive discovery snapshots.
File summaries
File Description
homeassistant/components/tuya/const.py Defines new charger DP codes.
homeassistant/components/tuya/number.py Adds charging-current control.
homeassistant/components/tuya/select.py Adds charging-mode selection.
homeassistant/components/tuya/sensor.py Adds charger telemetry sensors.
homeassistant/components/tuya/strings.json Adds entity and state translations.
tests/components/tuya/fixtures/qccdz_dsmsam7xpb3ht7rl.json Adds EV charger diagnostics fixture.
tests/components/tuya/snapshots/test_init.ambr Covers device registration.
tests/components/tuya/snapshots/test_number.ambr Covers charging-current discovery.
tests/components/tuya/snapshots/test_select.ambr Covers charging-mode discovery.
tests/components/tuya/snapshots/test_sensor.ambr Covers charger sensor discovery.
tests/components/tuya/snapshots/test_switch.ambr Covers switch discovery for the new fixture.
Review details
  • Files reviewed: 11/11 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

The qccdz category only exposed the on/off switch. Add the remaining data
points these chargers report:

- sensors: work_state (status enum), forward_energy_total (kWh,
  total_increasing), charge_energy_once (session energy),
  sigle_phase_power and power_total (kW), temp_current (°C, diagnostic)
- number: charge_cur_set (charging current, A)
- select: work_mode (charge_now / charge_pct / charge_energy /
  charge_schedule)

New DP codes: charge_cur_set, charge_energy_once, sigle_phase_power
(Tuya's own spelling). Add the qccdz_dsmsam7xpb3ht7rl fixture from device
diagnostics and update snapshots; the existing qccdz_7bvgooyjhiua1yyq
fixture gains status, session energy and mode entities.
Copilot AI review requested due to automatic review settings September 6, 2026 13:46
@o-borovets
o-borovets force-pushed the tuya-qccdz-ev-charger branch from 885bfbc to 188e07c Compare September 6, 2026 13:46

@home-assistant home-assistant Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @o-borovets

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The mappings match the supplied device metadata and have comprehensive snapshot coverage, with only a non-blocking comment cleanup.

Review details
  • Files reviewed: 11/11 changed files
  • Comments generated: 1
  • Review effort level: Balanced

CH2O_VALUE = "ch2o_value"
CH4_SENSOR_STATE = "ch4_sensor_state"
CH4_SENSOR_VALUE = "ch4_sensor_value"
CHARGE_CUR_SET = "charge_cur_set" # Charging current setpoint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-needed has-tests integration: tuya new-feature Quality Scale: No score Top 50 Integration is ranked within the top 50 by usage Top 100 Integration is ranked within the top 100 by usage Top 200 Integration is ranked within the top 200 by usage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants