Frankkkkk / python-daikin-altherma

Interfaces with Daikin Altherma heat pumps via LAN adapter BRP069A61/BRP069A62
11 stars 1 forks source link

Update Daikin heat pump date and time #7

Open remy-lavabre opened 8 months ago

remy-lavabre commented 8 months ago
@property
def unit_datetime(self) -> datetime.datetime:
    """ Returns the current date of the unit. Takes time to refresh """
    d = self._requestValueHP("0/DateTime/la", "/m2m:rsp/pc/m2m:cin/con")
    return datetime.datetime.strptime(d, '%Y%m%dT%H%M%SZ')

With this function, ok we can get the date/time of the PAC (Format 20231029T180710Z) Is it possible in reverse, to write (instead of reading) a date/time group in the PAC ? And how... ?

Thank-you

Frankkkkk commented 8 months ago

Hi, I tried with the following, but it doesn't seem to work:

    def set_unit_datetime(self, d: datetime.datetime):
        """Sets the current date of the unit. XXX Doesn't work rn"""
        date_str = datetime.datetime.strftime(d, self.DATETIME_FMT)

        payload = {
            "con": date_str,
            "cnf": "text/plain:0",
        }

        d = self._requestValueHP("/0/DateTime", "/", payload)
remy-lavabre commented 8 months ago

Request is d = self._requestValueHP("/0/DateTime", "/", payload) or d = self._requestValueHP("0/DateTime", "/", payload) (without the "/" before the 0) ???

But in fact that doesn't change the problem...

Frankkkkk commented 8 months ago

So looking at the reverse engineered code of the phone app, if the d._unit_api route does not return a "DateTime": {"DateTimeAdjustable": true} entry, it is not possible to set the date time.

The correct route would be /0/DateTime and the format "%Y%m%dT%H%M%SZ".

On my heat pump, however, the field does not exist and indeed it does not change the time given the command.

Hopefully it works on yours... I've release 0.3.1 for those that the setting works