- marked as minor
Support zone temperature
I have recently had a ducted unit with linear zone control installed and wanted to control the zone temperatures, just like the Airbase app. I’ve done a packet capture and I can see how it works so I managed to get it to work with this code
@property
def zones(self):
"""Return list of zones."""
if not self.values.get("zone_name"):
return None
zone_onoff = self.represent("zone_onoff")[1]
if self.support_zone_temperature:
zone_temp = self.represent("lztemp_h")[1]
return [
(name.strip(" +,"), zone_onoff[i], float(zone_temp[i]))
for i, name in enumerate(self.represent("zone_name")[1])
]
return [
(name.strip(" +,"), zone_onoff[i], 0)
for i, name in enumerate(self.represent("zone_name")[1])
]
async def set_zone(self, zone_id, key, value):
"""Set zone status."""
current_state = await self._get_resource("aircon/get_zone_setting")
self.values.update(current_state)
current_group = self.represent(key)[1]
current_group[zone_id] = value
self.values[key] = quote(";".join(current_group)).lower()
query = "aircon/set_zone_setting?zone_name={}&zone_onoff={}".format(
current_state["zone_name"],
self.values["zone_onoff"],
)
if self.support_zone_temperature:
query += "&lztemp_h=%s" % self.values["lztemp_h"]
_LOGGER.debug("Set zone:: %s", query)
await self._get_resource(query)
It is a bit rough
Comments (7)
-
reporter -
It looks good to me. Add a PR and I’ll merge it.
How are you using the lib? Are you using it trough HomeAssistant (which is the main purpose).
-
reporter Thanks I’ll add a PR. I am using it for Home Assistant and I have added this feature to the integration too.
-
Closed by #59
-
- changed status to open
-
- changed status to resolved
Closed by #59
-
I’ve created the version 2.9.1 with your changes. It would be great if you would like to update in HomeAssistant too (perhaps even add yourself as code-owner in HomeAssistant, https://developers.home-assistant.io/docs/creating_integration_manifest#code-owners).
- Log in to comment