Skip to content

Daikin Airbase Zone Temperature Control #146279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 32 commits into
base: dev
Choose a base branch
from

Conversation

barneyonline
Copy link

Proposed change

Add ability to set the temperature for zones of compatible Daikin Airbase systems.

  • Via a service call, zone temperature can be set +/- 2 degrees celsius of the controller (Daikin limitation)
  • The current set temperature of each enabled zone is displayed in the Daikin climate state attributes

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 adds a new service daikin.set_zone_temperature that allows users to control individual zone temperatures on compatible Daikin Airbase systems. The service includes:

  • Input validation for zone IDs and temperature ranges
  • Error handling for various scenarios (inactive zones, out-of-range temperatures, etc.)
  • Retry mechanism for failed operations
  • Automatic state updates after temperature changes

The service includes test cases covering:

  • Successful temperature setting
  • Out-of-range temperature handling
  • Invalid input validation
  • Multiple device support
  • Error scenarios and retry mechanisms
  • Service registration/unregistration

Checklist

  • 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.

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 link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

@home-assistant
Copy link

home-assistant bot commented Jun 7, 2025

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

Code owner commands

Code owners of daikin can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign daikin Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

@barneyonline
Copy link
Author

@fredrike Hopefully this second attempt is up to scratch. Let me know what you think

@barneyonline barneyonline marked this pull request as ready for review June 7, 2025 11:53
@joostlek
Copy link
Member

Okay so I checked the previous PR and we proposed to use a climate entity, which Erik showed was still quite usable, why did we decide not to go with that one and go with a service call?

A service call isn't very user friendly as you need to automate with it per se and you can't just drop it in a card on your dashboard.

WDYT?

@barneyonline
Copy link
Author

barneyonline commented Jun 23, 2025

Last comment from Erik was to implement as service call so have done so here.

Agree service call isn't very user friendly and in parallel have been investigating how to address the limitations previously raised (e.g. no current temp for zone) but to no avail.

Keen to get thoughts on implementing this capability as a "feature" in the climate card. However, this gets a bit complicated with zone switches on top of set temperature, so I'm not sure if these should be conditionally combined or available as separate elements. Thoughts?

image

Once I get some feedback on the interface I'll raise a separate PR after this is merged.

@joostlek
Copy link
Member

However, this gets a bit complicated with zone switches on top of set temperature, so I'm not sure if these should be conditionally combined or available as separate elements. Thoughts?

How do you mean? Is this a frontend question or something for core?

@barneyonline
Copy link
Author

How do you mean? Is this a frontend question or something for core?

Daikin ducted systems can support either zone on/off control, or zone on/off and zone set temperature control. One approach to making these controls available via the frontend would be to create separate controls for each control:
Zone toggle
Zone temp

Another approach would be to combine the two controls into a single element (as above).

I'm unsure which approach would be preferable to implement and keen for thoughts before I start writing it up.

@frenck frenck requested a review from Copilot June 27, 2025 09:03
Copy link
Contributor

@Copilot 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

This pull request adds the ability to control individual zone temperatures on compatible Daikin Airbase systems. Key changes include:

  • A new custom service implementation in services.py (with retry mechanisms and error handling) and corresponding YAML service definition.
  • Updated tests in tests/components/daikin/test_services.py covering various scenarios for zone temperature setting.
  • Enhancements in the climate component to expose zone temperature state attributes and updates in init.py to correctly register the service and coordinator.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/components/daikin/test_services.py Added extensive test cases for the new service functionality.
homeassistant/components/daikin/services.yaml Introduced the service schema for setting zone temperature.
homeassistant/components/daikin/services.py Implemented the set_zone_temperature service with validation, retry mechanism, and logging.
homeassistant/components/daikin/climate.py Updated extra_state_attributes to report zone temperatures based on the current HVAC mode.
homeassistant/components/daikin/init.py Modified integration setup to initialize hass.data and register the new custom service.
Comments suppressed due to low confidence (1)

homeassistant/components/daikin/init.py:68

  • Ensure that the initialization of hass.data[DOMAIN] during the integration setup is performed in a thread-safe manner to avoid potential race conditions in concurrent environments.
    if DOMAIN not in hass.data:

@joostlek
Copy link
Member

Daikin ducted systems can support either zone on/off control, or zone on/off and zone set temperature control.

So you mean it either supports on off or on off and setting temperature?

I guess then it still makes sense.

But I still feel like you have concerns, and since I don't want to send you into the woods with an impossible task, be sure to voice the concerns so I can also see what you're seeing :)

@barneyonline
Copy link
Author

barneyonline commented Jun 27, 2025

So you mean it either supports on off or on off and setting temperature?

Correct

But I still feel like you have concerns, and since I don't want to send you into the woods with an impossible task, be sure to voice the concerns so I can also see what you're seeing :)

No concerns from me; this PR shouldn't cause any issues, but I would like to get feedback and suggestions on the frontend approach before implementing. What is the best way to engage the community for this?

@jmadden91
Copy link

So you mean it either supports on off or on off and setting temperature?

Correct

But I still feel like you have concerns, and since I don't want to send you into the woods with an impossible task, be sure to voice the concerns so I can also see what you're seeing :)

No concerns from me; this PR shouldn't cause any issues, but I would like to get feedback and suggestions on the frontend approach before implementing. What is the best way to engage the community for this?

I'm running your PR as a custom component and can confirm it causes no issues with my setup.

I like the way you combine the front end setup in your first example. Ideally if its possible to obtain the zone temp sensor data we could create individual climate entities for each room, but I don't think this is available from the API?

@barneyonline
Copy link
Author

I'm running your PR as a custom component and can confirm it causes no issues with my setup.

Nice! Does your system support the set temperature for zones? How did you find the error handling?

I like the way you combine the front end setup in your first example. Ideally if its possible to obtain the zone temp sensor data we could create individual climate entities for each room, but I don't think this is available from the API?

Noted. I think combining zone on/off and set temp into a single looks better so I might try that approach first. Yeah unfortunately the zone sensors aren't exposed in the known endpoints (note: there is no official docs from Daikin). I tried brute-forcing possible combinations but discovered no useful endpoints. Hence implementing this control as a "feature" above.

@joostlek
Copy link
Member

Well, a thing is that the community doesn't really decide how an entity is implemented. That is all decided by the available data and the behaviour of the device.

For example, a climate entity would allow users to directly use voice commands out of the box, while if it was a number or an action, it requires effort from the user to support that.

@barneyonline
Copy link
Author

Well, a thing is that the community doesn't really decide how an entity is implemented. That is all decided by the available data and the behaviour of the device.

For example, a climate entity would allow users to directly use voice commands out of the box, while if it was a number or an action, it requires effort from the user to support that.

Makes sense. Are you OK for me to raise a separate PR to implement a new feature for the climate entity as below?
image

@jmadden91
Copy link

I'm running your PR as a custom component and can confirm it causes no issues with my setup.

Nice! Does your system support the set temperature for zones? How did you find the error handling?

Yes I have 6 individual zones and have no issues changing the temperature of a running zone +- 2deg, If I modify a zone that is not on, it sets the temp and also turns the zone on. If I try to adjust outside of 2deg, it throws an error no problem. So all works great.

I like the way you combine the front end setup in your first example. Ideally if its possible to obtain the zone temp sensor data we could create individual climate entities for each room, but I don't think this is available from the API?

Noted. I think combining zone on/off and set temp into a single looks better so I might try that approach first. Yeah unfortunately the zone sensors aren't exposed in the known endpoints (note: there is no official docs from Daikin). I tried brute-forcing possible combinations but discovered no useful endpoints. Hence implementing this control as a "feature" above.

Yep I've had no luck finding it either. I started trying p1p2mqtt and have bought a faikin, but have come back to this component for now.

Thanks for your work on this PR!

@joostlek
Copy link
Member

I'm still not sure what you exactly mean with your screenshot as it looks like custom cards.

But so far I understand:

  • we have a target temp
  • min max is +-2 of target temp
  • there are no modes
  • there is no temperature measurement for the zones

We should then attach the zone each to their own device, so users can assign their device to the right areas.

Does this align with what you're seeing?

@barneyonline
Copy link
Author

I'm still not sure what you exactly mean with your screenshot as it looks like custom cards.

Ideally I'd like to update the existing climate card with new attributes to expose to the user as "features" to control zones.

But so far I understand:

  • we have a target temp
  • min max is +-2 of target temp
  • there are no modes
  • there is no temperature measurement for the zones

Correct. Additionally, zones can be turned on and off separate to the climate system being turned off or on (to a selected mode).

We should then attach the zone each to their own device, so users can assign their device to the right areas.

Does this align with what you're seeing?

Since the zones are dependant on the climate entity, my thinking on the approach is to:

  1. Add a "ZONE_TOGGLE" and "ZONE_TEMP" feature to climate entities,
  2. Update the Daikin climate entity to publish these and expose as extra attributes, and then
  3. Update the Climate Lovelace card to support the zone features

@joostlek
Copy link
Member

Add a "ZONE_TOGGLE" and "ZONE_TEMP" feature to climate entities,

That would require an architectural decision and IMO we can do this without these features as they would be their own device and climate entity

@barneyonline
Copy link
Author

That would require an architectural decision and IMO we can do this without these features as they would be their own device and climate entity

My personal preference would be for this to be implemented as a feature of climate entities and leverage the climate Lovelace card for frontend. Could I seek an architecture review of this approach?

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.

3 participants