Skip to content

Support Yardian YC models#172347

Merged
joostlek merged 4 commits into
home-assistant:devfrom
aeon-matrix:yardian-feature-c1
Jun 1, 2026
Merged

Support Yardian YC models#172347
joostlek merged 4 commits into
home-assistant:devfrom
aeon-matrix:yardian-feature-c1

Conversation

@aeon-matrix

@aeon-matrix aeon-matrix commented May 27, 2026

Copy link
Copy Markdown
Contributor

Breaking change

Proposed change

Support Yardian standalone firmware with pyyardian 1.3.3.

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:

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.

Pull request overview

Note

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

Updates the Yardian integration to use the client factory pattern and adds global services, while adjusting tests and snapshots to reflect new entity/service behavior.

Changes:

  • Refactor config flow and setup to use AsyncYardianClient.create and store extra device info in config entries.
  • Add start_irrigation / stop_all_irrigation services (plus icon/translation/service schema updates).
  • Update Yardian tests and snapshots to align with changed entity IDs/naming and service behavior.

Reviewed changes

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

Show a summary per file
File Description
tests/components/yardian/test_switch.py Makes switch tests dynamic by selecting entities from the state machine and relaxes client call assertions.
tests/components/yardian/test_sensor.py Uses unique_id lookups in entity registry for diagnostic sensor assertions.
tests/components/yardian/test_config_flow.py Updates config flow tests to patch AsyncYardianClient.create and changes expected entry title.
tests/components/yardian/snapshots/test_sensor.ambr Updates snapshots to match new/changed sensor entity IDs and attributes.
tests/components/yardian/snapshots/test_binary_sensor.ambr Updates snapshots to match new/changed binary sensor entity IDs and attributes.
tests/components/yardian/conftest.py Refactors Yardian client mocks to use create() and AsyncMock for async methods.
homeassistant/components/yardian/translations/en.json Adds English translations for config flow and service UI strings.
homeassistant/components/yardian/strings.json Updates service strings and removes entity translation definitions.
homeassistant/components/yardian/services.yaml Tweaks duration unit formatting and adds stop_all_irrigation service schema.
homeassistant/components/yardian/icons.json Updates service icons and adds icon for stop_all_irrigation.
homeassistant/components/yardian/const.py Updates product name, default duration, and introduces a PLATFORMS constant.
homeassistant/components/yardian/config_flow.py Refactors user step to use AsyncYardianClient.create, set unique_id, and include device info in entry data.
homeassistant/components/yardian/init.py Adds global services registration, switches setup to AsyncYardianClient.create, and stores coordinators in hass.data.

Comment thread homeassistant/components/yardian/config_flow.py Outdated
Comment thread homeassistant/components/yardian/__init__.py Outdated
Comment thread homeassistant/components/yardian/const.py Outdated
Comment thread homeassistant/components/yardian/strings.json
Comment thread tests/components/yardian/test_config_flow.py Outdated
Comment thread tests/components/yardian/test_switch.py Outdated
Comment thread tests/components/yardian/test_switch.py Outdated
Copilot AI review requested due to automatic review settings May 27, 2026 13:32

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.

Pull request overview

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

Comment on lines +83 to +84

for entity_id in call.data[ATTR_ENTITY_ID]:
Comment on lines +108 to +109
hass.services.async_register(DOMAIN, "stop_all_irrigation", handle_stop_all)
hass.services.async_register(DOMAIN, "start_irrigation", handle_start_irrigation)
entity_reg = er.async_get(hass)
if not (yardian_data := hass.data.get(DOMAIN)):
return
duration = call.data.get("duration", 6)
Comment thread homeassistant/components/yardian/strings.json
Comment on lines 34 to 41

await self.async_set_unique_id(str(yid))
self._abort_if_unique_id_configured()

return self.async_create_entry(
title=f"{PRODUCT_NAME} ({user_input[CONF_HOST]})",
data={**user_input, **info},
)
DOMAIN, context={"source": config_entries.SOURCE_USER}
)

mock_factory_error = _get_mock_client_factory(side_effect=NotAuthorizedException)
Comment thread tests/components/yardian/test_switch.py Outdated
Comment on lines +46 to +50
# Grab the first switch directly from the state machine
switches = hass.states.async_entity_ids(SWITCH_DOMAIN)
assert switches, "No switch entities found in the state machine!"
switches.sort()
entity_id = switches[0]
Comment thread tests/components/yardian/test_switch.py Outdated
Comment on lines +59 to +60
# Assert it was called, without enforcing strict argument matching
mock_yardian_client.start_irrigation.assert_called_once()
Comment on lines 19 to 29
from .const import DOMAIN
from .coordinator import YardianConfigEntry, YardianUpdateCoordinator

_LOGGER = logging.getLogger(__name__)

PLATFORMS: list[Platform] = [
Platform.BINARY_SENSOR,
Platform.SENSOR,
Platform.SWITCH,
]

Copilot AI review requested due to automatic review settings May 28, 2026 13:49

@joostlek joostlek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I have no clue what you are trying to achieve with this PR. The PR description and title make it sound like you add a new integration, but the integration already exists. Instead a lot of entities seem to break now.

@home-assistant home-assistant Bot marked this pull request as draft May 28, 2026 13:55
@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.

@aeon-matrix

Copy link
Copy Markdown
Contributor Author

It's not a new integration. I would like to add new features (services).

@aeon-matrix

Copy link
Copy Markdown
Contributor Author

I need to do a git push to include my latest changes.

@aeon-matrix

Copy link
Copy Markdown
Contributor Author

I saw many comments from Copilot, so I was trying to fix them.

@joostlek

Copy link
Copy Markdown
Member

I mean, even the first commit was not really doing what it's doing now, so I think you need to zoom out and look what you want to do. As in, we want PRs to be small and easy to review. So look at a single bug you want to fix or feature to add, and just change that and open separate PRs for other things

@aeon-matrix

Copy link
Copy Markdown
Contributor Author

Got it. I will clean up and submit again.

@aeon-matrix aeon-matrix force-pushed the yardian-feature-c1 branch from f791e14 to e40cb54 Compare May 29, 2026 05:31
@aeon-matrix aeon-matrix marked this pull request as ready for review May 29, 2026 12:13
@home-assistant home-assistant Bot requested a review from joostlek May 29, 2026 12:13
@joostlek joostlek marked this pull request as draft May 29, 2026 12:52
@joostlek

Copy link
Copy Markdown
Member

My question is still the same, what are you intending this PR to do? Because it's again touching a ton of code without doing anything sensible

@aeon-matrix

Copy link
Copy Markdown
Contributor Author

The goal of this PR is to add irrigation control services (start/stop/stop_all) to work with the updated pyyardian 1.3.3. This enables support for both our original and new firmware versions. I’ve also added tests to achieve 100% coverage and ensure stability across all hardware.

@aeon-matrix

Copy link
Copy Markdown
Contributor Author

Our new "standalone" firmware allows for 100% local control without internet access, aligning with HA’s core goals.

@joostlek

Copy link
Copy Markdown
Member

Sure, but this PR is doing way more than just adding a service, hence I said last time to take a step back and try to make it so that the PR does one thing at a time

@aeon-matrix

aeon-matrix commented May 29, 2026

Copy link
Copy Markdown
Contributor Author

I separated the whole change into a few "git commit". Do you want me to turn each commit into a different PR?

@joostlek

Copy link
Copy Markdown
Member

I think a lot of commits here are unneeded, but yes, smaller. Want to clean up code? New PR. Want to bump the dependency? New PR. Want to add actions? New PR. Want to refactor existing actions? New PR. That way it's easy to review and speeds up the process

@aeon-matrix

Copy link
Copy Markdown
Contributor Author

Got it.

@aeon-matrix aeon-matrix force-pushed the yardian-feature-c1 branch from 323d13e to 990d844 Compare May 30, 2026 19:10
@aeon-matrix

Copy link
Copy Markdown
Contributor Author

Thanks for the suggestion! I will fix the "pytest" for this PR.

@aeon-matrix aeon-matrix force-pushed the yardian-feature-c1 branch from 990d844 to e833287 Compare May 30, 2026 20:47
@aeon-matrix aeon-matrix marked this pull request as ready for review May 30, 2026 20:51
@joostlek

Copy link
Copy Markdown
Member

Okay, but the PR still changes too many unrelated files. And like said I am questioning the way we implement this

@joostlek joostlek marked this pull request as draft May 30, 2026 21:32
@aeon-matrix

Copy link
Copy Markdown
Contributor Author

When I added a service, I need to update other related files like the icons.json, __initi__py., etc. Do I need to worry about those test results? I modified many things to make these formatting and testing scripts happy.

@aeon-matrix aeon-matrix marked this pull request as ready for review May 31, 2026 10:20
@aeon-matrix

Copy link
Copy Markdown
Contributor Author

Let me try again to make this PR even smaller. I am taking over someone else's work, and I need more time to get the whole picture rather than focusing on passing the bots' tests.

@aeon-matrix aeon-matrix force-pushed the yardian-feature-c1 branch from e833287 to 6f5c8c7 Compare May 31, 2026 11:09
@aeon-matrix aeon-matrix changed the title Add Yardian Integration for Standalone Firmware Fix broken Yardian sensor tests and snapshots May 31, 2026
@aeon-matrix

Copy link
Copy Markdown
Contributor Author

I just fixed existing testing issues in this PR.

@joostlek

Copy link
Copy Markdown
Member

Yea no worries, like I'm happy to make sure you know your way around the codebase.

As far as I know the snapshots are not broken. Home Assistant sources it's translations from translations/en.json (which should not be committed) and not from strings.json. So if you update strings.json, you need to regenerate translations again (which updates the en.json). (The exact command for this can be found in the docs, I'm on mobile right now).

I think a good first PR would be to split each zone into its own device. After that you can create a button for each device (zone) which stops irrigation.

@aeon-matrix aeon-matrix changed the title Fix broken Yardian sensor tests and snapshots Support Yardian YC models and fix diagnostic sensor naming May 31, 2026
@aeon-matrix

Copy link
Copy Markdown
Contributor Author

I've fixed some bugs in HA to work with the new pyyardian 1.3.3. I think this should be the first step.

@joostlek joostlek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Okay, now we are getting somewhere. I want to push back a single one last time, let's split them into 2. Changing the way we create the client is a valid way of doing things, but it's a new feature. The entity name change seems to be a bugfix as it has been incorrect. So if you create a single PR with the bugfix, then we can take it into the beta and release that earlier as that will improve a faulty experience.

@home-assistant home-assistant Bot marked this pull request as draft June 1, 2026 06:13
@aeon-matrix

Copy link
Copy Markdown
Contributor Author

Got it! Can I create a new PR for the bug fix (step 1) and use this PR for "new feature" (step 2)?

@joostlek

joostlek commented Jun 1, 2026

Copy link
Copy Markdown
Member

Yep! It's fine to have multiple PRs open at the same time. That's also a good way to work in parallel

@aeon-matrix

Copy link
Copy Markdown
Contributor Author

Great. Hope I get it right this time!

@aeon-matrix aeon-matrix marked this pull request as ready for review June 1, 2026 09:05
@home-assistant home-assistant Bot requested a review from joostlek June 1, 2026 09:05
@joostlek joostlek changed the title Support Yardian YC models and fix diagnostic sensor naming Support Yardian YC models Jun 1, 2026
@joostlek joostlek merged commit be2aaf9 into home-assistant:dev Jun 1, 2026
33 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 2, 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.

3 participants