Noltari / aioairzone

Python library to control Airzone via Local API
Apache License 2.0
2 stars 0 forks source link

DHW support #3

Closed fredericseiler closed 1 year ago

fredericseiler commented 1 year ago

Hi Noltari,

First of all, thanks for your work!

Is there any way to add support for domestic hot water to the lib and HA integration (as a water heater entity for example)?

I was about to try to draft a PR (not very comfortable with python tbh), but my main concern is that I don't really know how to distinguish systems that handle DHW from systems that don't.

On my Aidoo Pro HI4 (AZAI6WSPHI4 linked to a Hitachi air/water heat pump), I can get DHW data when I send a POST request to the /hvac endpoint with only the global system ID and no specific zone:

{
  "systemID": 0
}

And the values returned by the local API:

{
  "data": {
    "systemID": 0,
    "acs_temp": 43,
    "acs_setpoint": 45,
    "acs_mintemp": 30,
    "acs_maxtemp": 75,
    "acs_power": 1,
    "acs_powerful": 0
  }
}

I can also set the DHW setpoint, power and powerful operation mode, with a PUT request.

But, if I try the same on my Aidoo Pro HI2 (AZAI6WSPHI2 linked to a Hitachi air/air ducted AC, so no DHW), I get similar results:

{
  "data": {
    "systemID": 0,
    "acs_temp": 0,
    "acs_setpoint": 0,
    "acs_mintemp": 0,
    "acs_maxtemp": 0,
    "acs_power": 0,
    "acs_powerful": 0
  }
}

Besides that all values are set to 0, there's no way to tell them apart (same ws_type ws_aidoo, and system_type 2).

All Airzone integration users that don't deal with DHW will have a ghost water heater, that's far from ideal...

What about another integration dedicated to airzone DHW only? Seems redondant?

Noltari commented 1 year ago

Hi @fredericseiler,

Hi Noltari,

First of all, thanks for your work!

Thanks!

Is there any way to add support for domestic hot water to the lib and HA integration (as a water heater entity for example)?

I was about to try to draft a PR (not very comfortable with python tbh), but my main concern is that I don't really know how to distinguish systems that handle DHW from systems that don't.

On my Aidoo Pro HI4 (AZAI6WSPHI4 linked to a Hitachi air/water heat pump), I can get DHW data when I send a POST request to the /hvac endpoint with only the global system ID and no specific zone:

{
  "systemID": 0
}

Yes, this is documented in the Airzone Local API. In order to get/update the DHW config systemID should be 0 and there should be no zoneID at all. What does your device return when performing a POST request with both zoneID and systemID?

{
  "systemID": 0,
  "zoneID": 0
}

I need to know how hard it would be to distinguish between HVAC and DHW devices.

And the values returned by the local API:

{
  "data": {
    "systemID": 0,
    "acs_temp": 43,
    "acs_setpoint": 45,
    "acs_mintemp": 30,
    "acs_maxtemp": 75,
    "acs_power": 1,
    "acs_powerful": 0
  }
}

Luckily those values seem pretty simple, so it shouldn't be hard to support DHW.

I can also set the DHW setpoint, power and powerful operation mode, with a PUT request.

But, if I try the same on my Aidoo Pro HI2 (AZAI6WSPHI2 linked to a Hitachi air/air ducted AC, so no DHW), I get similar results:

{
  "data": {
    "systemID": 0,
    "acs_temp": 0,
    "acs_setpoint": 0,
    "acs_mintemp": 0,
    "acs_maxtemp": 0,
    "acs_power": 0,
    "acs_powerful": 0
  }
}

Yeah, that seems to be a bug, since that device shouldn't return any of those values. My Airzone Flexa just returns an error stating that there's no DHW device available.

Besides that all values are set to 0, there's no way to tell them apart (same ws_type ws_aidoo, and system_type 2).

All Airzone integration users that don't deal with DHW will have a ghost water heater, that's far from ideal...

We can see if some/all of those values are 0 and avoid exposing the DHW device in that specific case. It's not ideal, but it should work.

What about another integration dedicated to airzone DHW only? Seems redondant?

No, that isn't an option. We should be able to distinguish between both types of devices and expose the corresponding devices (HVAC, DHW...) with the same integration.

fredericseiler commented 1 year ago

What does your device return when performing a POST request with both zoneID and systemID?

{
  "systemID": 0,
  "zoneID": 0
}
{
"systems": [{
"data": [{
"systemID": 1,
"zoneID": 1,
"name": "heatpump",
"on": 0,
"double_sp": 0,
"coolsetpoint": 17,
"coolmaxtemp": 0,
"coolmintemp": 15,
"heatsetpoint": 5,
"heatmaxtemp": 0,
"heatmintemp": 15,
"maxTemp": 0,
"minTemp": 15,
"setpoint": 5,
"roomTemp": 0,
"sleep": 0,
"temp_step": 0.5,
"modes": [3],
"mode": 3,
"speed_values": [0],
"speeds": 0,
"speed_type": 0,
"speed": 0,
"coldStages": 0,
"coldStage": 0,
"heatStages": 0,
"heatStage": 0,
"humidity": 0,
"units": 0,
"errors": [],
"air_demand": 0,
"cold_demand": 0,
"heat_demand": 0,
"heatangle": 0,
"coldangle": 0
}]
}]
}

We can see if some/all of those values are 0 and avoid exposing the DHW device in that specific case. It's not ideal, but it should work.

Yeah, maybe acs_mintemp and acs_maxtemp (I don't think that's something you can tweak in the appliance or via Airtools) and eventually acs_temp because if the tank water is at 0°C, that's probably not a good sign for the owner.

Noltari commented 1 year ago

Thanks @fredericseiler,

What does your device return when performing a POST request with both zoneID and systemID?

{
  "systemID": 0,
  "zoneID": 0
}
{
  "systems": [{
    "data": [{
      "systemID": 1,
      "zoneID": 1,
      "name": "heatpump",
      "on": 0,
      "double_sp": 0,
      "coolsetpoint": 17,
      "coolmaxtemp": 0,
      "coolmintemp": 15,
      "heatsetpoint": 5,
      "heatmaxtemp": 0,
      "heatmintemp": 15,
      "maxTemp": 0,
      "minTemp": 15,
      "setpoint": 5,
      "roomTemp": 0,
      "sleep": 0,
      "temp_step": 0.5,
      "modes": [3],
      "mode": 3,
      "speed_values": [0],
      "speeds": 0,
      "speed_type": 0,
      "speed": 0,
      "coldStages": 0,
      "coldStage": 0,
      "heatStages": 0,
      "heatStage": 0,
      "humidity": 0,
      "units": 0,
      "errors": [],
      "air_demand": 0,
      "cold_demand": 0,
      "heat_demand": 0,
      "heatangle": 0,
      "coldangle": 0
    }]
  }]
}

Ouch, that system/zone data seems to be completely broken... xD

If you add your device to Home Assistant, is it exposed as a climate device? Does it work?

I wonder if there are any devices which can have both climate and water heater devices... If there aren't any, then we should clearly prevent creating climate devices if water heater data is provided and has valid values...

We can see if some/all of those values are 0 and avoid exposing the DHW device in that specific case. It's not ideal, but it should work.

Yeah, maybe acs_mintemp and acs_maxtemp (I don't think that's something you can tweak in the appliance or via Airtools) and eventually acs_temp because if the tank water is at 0°C, that's probably not a good sign for the owner.

Exactly ;)

fredericseiler commented 1 year ago

Ouch, that system/zone data seems to be completely broken... xD

It doesn't bother me; I have the needed attributes for my heat pump (on, heat* and errors) and I just ignore the rest (I admit that cool*, speed* and *angle for hot water radiators seems a bit odd). My guess is that Airzone targets mainly air to air multizone HVAC systems, so Aidoo just uses the "regular" architecture whatever the appliance behind it.

If you add your device to Home Assistant, is it exposed as a climate device? Does it work?

Yes, it is exposed as a climate device, and yes it works well ;)

I wonder if there are any devices which can have both climate and water heater devices...

You mean to have one device in Home Assistant with a climate and water_heater entities ? That would be great because there are so many models on the market that handle both home heating and domestic water heating (including mine). But if the features are divided into two different HA devices, that'll still be nice!

What's the best angle here? I'm not quite sure where to start or how to help.

fredericseiler commented 1 year ago

I didn't get what you meant by "prevent creating climate devices if water heater data is provided", so, after reading again the whole conversation, just to be super clear: my heat pump is a regular climate device that can also handle DHW (model Hitachi Yutaki S Combi). The systemID 1 > zoneID 1 is thereby totally legit.

Noltari commented 1 year ago

I didn't get why you meant by "prevent creating climate devices if water heater data is provided", so, after reading again the whole conversation, just to be super clear: my heat pump is a regular climate device that can also handle DHW (model Hitachi Yutaki S Combi). The systemID 1 > zoneID 1 is thereby totally legit.

Ok!

Ouch, that system/zone data seems to be completely broken... xD

It doesn't bother me; I have the needed attributes for my heat pump (on, heat* and errors) and I just ignore the rest (I admit that cool*, speed* and *angle for hot water radiators seems a bit odd). My guess is that Airzone targets mainly air to air multizone HVAC systems, so Aidoo just uses the "regular" architecture whatever the appliance behind it.

If you add your device to Home Assistant, is it exposed as a climate device? Does it work?

Yes, it is exposed as a climate device, and yes it works well ;)

I wonder if there are any devices which can have both climate and water heater devices...

You mean to have one device in Home Assistant with a climate and water_heater entities ? That would be great because there are so many models on the market that handle both home heating and domestic water heating (including mine). But if the features are divided into two different HA devices, that'll still be nice!

What's the best angle here? I'm not quite sure where to start or how to help.

I've already started working on it :) I need you to provide the answer of the API when you change a DHW parameter: curl -s --location --request POST "http://IP_ADDR:3000/api/v1/hvac" -d '{"systemID": 0, "acs_power": 1}' | jq

fredericseiler commented 1 year ago

I've already started working on it :)

Wow, so cool!

I need you to provide the answer of the API when you change a DHW parameter

Like for the usual /hvac endpoint, the response only contains the attributes you submitted:

{
  "data": {
    "systemID": 0,
    "acs_power": 1
  }
}

If I add the setpoint in the request:

{
  "data": {
    "systemID": 0,
    "acs_power": 1,
    "acs_setpoint": 45
  }
}

(I'm sure it was a typo, but you also need to use the PUT HTTP verb to make some changes for DHW)

Noltari commented 1 year ago

Thanks for the info @fredericseiler,

I've now released a new version of aioairzone and I've submitted a PR to the Home Assistant repo with it: https://github.com/home-assistant/core/pull/98399

After that dependency upgrade PR is merged, I will submit another PR with the Water Heater functionality, which you can find in the following branch: https://github.com/Noltari/home-assistant-core/commits/airzone-dhw

Best regards, Álvaro.

fredericseiler commented 1 year ago

Thank you so much!

Noltari commented 1 year ago

Water Heater entities PR is now created: https://github.com/home-assistant/core/pull/98401

Noltari commented 1 year ago

@fredericseiler I also created a separate PR for exposing the DHW temperature as a sensor: https://github.com/home-assistant/core/pull/98500

Fonsohome commented 1 year ago

Hello, on the ACS device only one sensor appears with the temperature. Is it okay or should I also have an entity to be able to turn it off and on?

fredericseiler commented 1 year ago

Hello, on the ACS device only one sensor appears with the temperature. Is it okay or should I also have an entity to be able to turn it off and on?

Hi, that's because the PR for the sensor is already merged, but the PR for the entity is still in review. With a bit of luck, it'll be available in the 2023.10 release, so, just wait until October 4 ;)

Noltari commented 1 year ago

@Fonsohome @fredericseiler is the hot water sensor working correctly on the 2023.9 release so far?

BTW, I'm currently on vacation without access to a computer, so I'm not sure the water heater entity will be ready for 2023.10 if more changes are requested, but I'll try.

fredericseiler commented 1 year ago

is the hot water sensor working correctly on the 2023.9 release so far?

@Noltari so far so good, thanks!

2023-09-09-19-39-31 Google Chrome Settings – Home Assistant
Fonsohome commented 1 year ago

@Fonsohome @fredericseiler is the hot water sensor working correctly on the 2023.9 release so far?

BTW, I'm currently on vacation without access to a computer, so I'm not sure the water heater entity will be ready for 2023.10 if more changes are requested, but I'll try.

Yes it works perfectly. Could the set temperature also be added?

Noltari commented 1 year ago

Yes it works perfectly. Could the set temperature also be added?

Yes, it could be added but I don't think it would be accepted. Anyhow, you will be able to manually create it as a template sensor by exposing the water heater setpoint attribute.

Fonsohome commented 1 year ago

Sorry for taking advantage of the topic but I have the problem that the temperature of the aerothermal thermostat is always at 0°. Both the machine and the airzone application are correct. Screenshot_2023-09-10-09-02-27-243_io homeassistant companion android

Noltari commented 1 year ago

Sorry for taking advantage of the topic but I have the problem that the temperature of the aerothermal thermostat is always at 0°. Both the machine and the airzone application are correct.

Screenshot_2023-09-10-09-02-27-243_io homeassistant companion android

Please don't reuse this topic for that and create a new one instead providing more data like the Home Asaistant integration diagnostics. I think that some devices do not report that data or use a different parameter name than other Airzone devices, so taking a look at diagnostics data would help a lot since it contains the raw API data.

Also you can do that in spanish.

fredericseiler commented 1 year ago

@Fonsohome that's an issue with your Airzone device: I have the same issue ("Zone temp" is fine in Airtools, but "roomTemp" from the local API always returns 0°C) and the Airzone support is aware of it, as well as min/max temperatures not correctly returned by the local API.

@Noltari so it seems that this DHW support will be available in 2023.10 after all ;) Many thanks for your work!

Fonsohome commented 1 year ago

@Fonsohome that's an issue with your Airzone device: I have the same issue ("Zone temp" is fine in Airtools, but "roomTemp" from the local API always returns 0°C) and the Airzone support is aware of it, as well as min/max temperatures not correctly returned by the local API.

@Noltari so it seems that this DHW support will be available in 2023.10 after all ;) Many thanks for your work!

Thanks

Noltari commented 1 year ago

@fredericseiler @Fonsohome thanks for providing all the info about DHW. Please, let me know if there are any issues once 2023.10 is out.

Fonsohome commented 1 year ago

@fredericseiler @Fonsohome thanks for providing all the info about DHW. Please, let me know if there are any issues once 2023.10 is out.

Home Assistant updated and the ACS working perfectly Screenshot_2023-10-04-23-42-27-332_io homeassistant companion android