Skip to content

Add target flow level and mode end time sensors to Duco integration#169298

Merged
joostlek merged 2 commits into
home-assistant:devfrom
ronaldvdmeer:feat/duco-box-ventilation-sensors
Apr 30, 2026
Merged

Add target flow level and mode end time sensors to Duco integration#169298
joostlek merged 2 commits into
home-assistant:devfrom
ronaldvdmeer:feat/duco-box-ventilation-sensors

Conversation

@ronaldvdmeer
Copy link
Copy Markdown
Contributor

@ronaldvdmeer ronaldvdmeer commented Apr 27, 2026

Proposed change

Adds two new sensor entities to the Duco integration for the BOX node:

  • Target flow level (target_flow_level): the actual airflow target as reported by the Duco box, in percent (0–100 %). Uses SensorStateClass.MEASUREMENT and PERCENTAGE as unit. Useful because the fan entity exposes abstract speed levels (33 / 66 / 100 %) that do not match the real firmware-configured airflow percentages.
  • Mode time remaining (time_state_remain): the number of seconds remaining in the current timed ventilation mode. Uses SensorDeviceClass.DURATION and UnitOfTime.SECONDS. Returns 0 when no timer is active.

Both sensors are scoped to NodeType.BOX and read from node.ventilation.flow_lvl_tgt resp. node.ventilation.time_state_remain, which are already fetched by the coordinator.

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.

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 two new Duco BOX-node sensor entities to expose the box’s actual target airflow percentage and the remaining time in timed ventilation modes.

Changes:

  • Add target_flow_level (% measurement) and time_state_remain (seconds, duration) sensor descriptions for NodeType.BOX.
  • Add new entity name strings (and an icon for target_flow_level).
  • Update Duco sensor snapshot tests to cover the newly added entities.

Reviewed changes

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

File Description
homeassistant/components/duco/sensor.py Registers the two new BOX-scoped sensors sourced from node.ventilation.*.
homeassistant/components/duco/strings.json Adds English source strings for the new sensor translation keys.
homeassistant/components/duco/icons.json Adds an icon mapping for the new target_flow_level sensor.
tests/components/duco/snapshots/test_sensor.ambr Updates snapshots to include registry/state for the two new sensor entities.

Comment thread tests/components/duco/snapshots/test_sensor.ambr Outdated
Comment thread tests/components/duco/snapshots/test_sensor.ambr Outdated
Comment thread homeassistant/components/duco/sensor.py
Comment thread homeassistant/components/duco/icons.json
@ronaldvdmeer ronaldvdmeer force-pushed the feat/duco-box-ventilation-sensors branch from cabae80 to 46cddf2 Compare April 27, 2026 14:58
Copilot AI review requested due to automatic review settings April 27, 2026 15:03
@ronaldvdmeer ronaldvdmeer force-pushed the feat/duco-box-ventilation-sensors branch from 46cddf2 to 74f5075 Compare April 27, 2026 15:03
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 4 out of 4 changed files in this pull request and generated no new comments.

@ronaldvdmeer
Copy link
Copy Markdown
Contributor Author

@erwindouna @joostlek Would this also be a candidate for inclusion in the current beta? It adds two sensors that are directly tied to the initial release of the integration, and having them in from the start keeps it as complete as possible.

One of the sensors (target_flow_level) is particularly relevant in combination with the existing fan entity: the fan control exposes abstract speed levels (33 / 66 / 100 %) that do not correspond to the actual airflow percentages configured in the firmware. This sensor gives users real insight into what the device is actually doing, which makes the fan control meaningfully more useful from day one.

I am not entirely sure what the criteria are for including changes during the beta phase, so happy to hear your thoughts.

Comment thread homeassistant/components/duco/sensor.py
@home-assistant home-assistant Bot marked this pull request as draft April 29, 2026 17:49
@home-assistant
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.

…mp sensor

Replace the countdown sensor (seconds remaining) with a timestamp sensor
(absolute end time) to avoid stale values between polls. The library
already exposes time_state_end as a Unix timestamp; 0 indicates no active
timer, which maps to None (unknown state) in Home Assistant.

Truncate to minute precision to suppress poll-drift noise in the
activity log.

Addresses review feedback from joostlek.
Copilot AI review requested due to automatic review settings April 29, 2026 18:25
@ronaldvdmeer ronaldvdmeer force-pushed the feat/duco-box-ventilation-sensors branch from eaf09d5 to 89539a4 Compare April 29, 2026 18: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 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread homeassistant/components/duco/sensor.py
Comment thread homeassistant/components/duco/strings.json
@ronaldvdmeer ronaldvdmeer changed the title Add target flow level and mode time remaining sensors to Duco integration Add target flow level and mode end time sensors to Duco integration Apr 29, 2026
@ronaldvdmeer ronaldvdmeer marked this pull request as ready for review April 29, 2026 18:36
@home-assistant home-assistant Bot requested a review from joostlek April 29, 2026 18:37
@joostlek joostlek merged commit fd34aa0 into home-assistant:dev Apr 30, 2026
36 of 37 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 1, 2026
@frenck frenck added this to the 2026.5.2 milestone May 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants