Skip to content
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

pcomfortcloud/session.py#L221 history data offset by 9 hrs - tz hardcoded to +0100 #55

Open
purcell-lab opened this issue Jul 17, 2021 · 3 comments

Comments

@purcell-lab
Copy link
Contributor

purcell-lab commented Jul 17, 2021

Noticed my history dump for hourly and daily consumption values were 'odd', turns out they were offset by 9hrs..

Suspecting a TZ issue, I found line 221 in session.py

def history(self, id, mode, date, tz="+01:00"):

Changing to my timezone (tz="+10:00") seems to of fixed the offset issue for me.

It would be better for session.py to set tz from the host system, rather than using a hardcoded value.

Thanks

@lostfields
Copy link
Owner

Hi, how are you using this library?

@purcell-lab
Copy link
Contributor Author

purcell-lab commented Jul 17, 2021 via email

@purcell-lab
Copy link
Contributor Author

This issue is still causing me problems.

Some further detail below, it is just after 11pm here, heating was switched on after 9pm and should expose consumption from that time.

When run as distributed with hardcoded Line221 tz="+01:00":

  • consumption : 2.3 at dataNumber : 12 (12am) - incorrect by 10 hrs.
  • OutsideTemp: 20.5 peak at dataNumber: 5 (5 am) - incorrect by 10 hrs.

When run with modified Line221 tz="+11:00", reflecting my timezone:

  • consumption : 2.3 at dataNumber : 22 (10pm) - correct!
  • OutsideTemp: 20.5 peak at dataNumber: 15 (3pm) - correct!

Why is the tz variable at Line221 hardcoded to +01:00 and is it possible to automatically set tz to the current system time, in my case +11:00?

Output below:

mark@penguin:~$ date -R
Tue, 23 Nov 2021 23:12:41 +1100
mark@penguin:~$ grep tz= .local/lib/python3.7/site-packages/pcomfortcloud/session.py 
    def history(self, id, mode, date, tz="+01:00"):
mark@penguin:~$ .local/bin/pcomfortcloud $PUSER $PPASS history 1 Day 20211123 
id                       : 403955336a130ea12f8b436cac9ced90bff4d1513a0d5ba46e06c951f634a0cc
parameters
    currencyUnit         : $
    energyConsumption    : 2.4
    estimatedCost        : 0.0
    historyDataList      :
        dataNumber       : 0
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 15.0
        averageOutsideTemp: 15.5

        dataNumber       : 1
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 15.0
        averageOutsideTemp: 17.0

        dataNumber       : 2
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 15.75
        averageOutsideTemp: 18.0

        dataNumber       : 3
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 16.0
        averageOutsideTemp: 19.75

        dataNumber       : 4
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 16.75
        averageOutsideTemp: 20.0

        dataNumber       : 5
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 17.25
        averageOutsideTemp: 20.5

        dataNumber       : 6
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 18.0
        averageOutsideTemp: 20.5

        dataNumber       : 7
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 18.0
        averageOutsideTemp: 20.0

        dataNumber       : 8
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 18.0
        averageOutsideTemp: 19.75

        dataNumber       : 9
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 18.0
        averageOutsideTemp: 19.0

        dataNumber       : 10
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.5
        averageInsideTemp: 18.0
        averageOutsideTemp: 17.75

        dataNumber       : 11
        consumption      : 0.1
        cost             : 0.0
        averageSettingTemp: 20.0
        averageInsideTemp: 20.25
        averageOutsideTemp: 16.75

        dataNumber       : 12
        consumption      : 2.3
        cost             : 0.0
        averageSettingTemp: 20.0
        averageInsideTemp: 19.25
        averageOutsideTemp: 16.75

        dataNumber       : 13
        consumption      : -255
        cost             : -255
        averageSettingTemp: -255
        averageInsideTemp: -255
        averageOutsideTemp: -255

        dataNumber       : 14
        consumption      : -255
        cost             : -255
        averageSettingTemp: -255
        averageInsideTemp: -255
        averageOutsideTemp: -255

        dataNumber       : 15
        consumption      : -255
        cost             : -255
        averageSettingTemp: -255
        averageInsideTemp: -255
        averageOutsideTemp: -255

        dataNumber       : 16
        consumption      : -255
        cost             : -255
        averageSettingTemp: -255
        averageInsideTemp: -255
        averageOutsideTemp: -255

        dataNumber       : 17
        consumption      : -255
        cost             : -255
        averageSettingTemp: -255
        averageInsideTemp: -255
        return self._devices
        averageOutsideTemp: -255

        dataNumber       : 18
        consumption      : -255
        cost             : -255
        averageSettingTemp: -255
        averageInsideTemp: -255
        averageOutsideTemp: -255

        dataNumber       : 19
        consumption      : -255
        cost             : -255
        averageSettingTemp: -255
        averageInsideTemp: -255
        averageOutsideTemp: -255

        dataNumber       : 20
        consumption      : -255
        cost             : -255
        averageSettingTemp: -255
        averageInsideTemp: -255
        averageOutsideTemp: -255

        dataNumber       : 21
        consumption      : -255
        cost             : -255
        averageSettingTemp: -255
        averageInsideTemp: -255
        averageOutsideTemp: -255

        dataNumber       : 22
        consumption      : -255
        cost             : -255
        averageSettingTemp: -255
        averageInsideTemp: -255
        averageOutsideTemp: -255

        dataNumber       : 23
        consumption      : -255
        cost             : -255
        averageSettingTemp: -255
        averageInsideTemp: -255
        averageOutsideTemp: -255

My edited version:

mark@penguin:~$ vi +221 .local/lib/python3.7/site-packages/pcomfortcloud/session.py 
mark@penguin:~$ date -R
Tue, 23 Nov 2021 23:13:25 +1100
mark@penguin:~$ grep tz= .local/lib/python3.7/site-packages/pcomfortcloud/session.py 
    def history(self, id, mode, date, tz="+11:00"):
mark@penguin:~$ .local/bin/pcomfortcloud $PUSER $PPASS history 1 Day 20211123 
id                       : 403955336a130ea12f8b436cac9ced90bff4d1513a0d5ba46e06c951f634a0cc
parameters
    currencyUnit         : $
    energyConsumption    : 2.4
    estimatedCost        : 0.0
    historyDataList      :
        dataNumber       : 0
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 14.75
        averageOutsideTemp: 12.0

        dataNumber       : 1
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 15.0
        averageOutsideTemp: 12.0

        dataNumber       : 2
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 15.0
        averageOutsideTemp: 12.0

        dataNumber       : 3
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 15.0
        averageOutsideTemp: 12.25

        dataNumber       : 4
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 15.0
        averageOutsideTemp: 12.5

        dataNumber       : 5
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 15.0
        averageOutsideTemp: 12.5

        dataNumber       : 6
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 15.0
        averageOutsideTemp: 13.0

        dataNumber       : 7
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 15.0
        averageOutsideTemp: 13.5

        dataNumber       : 8
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 15.0
        averageOutsideTemp: 14.25

        dataNumber       : 9
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 15.0
        averageOutsideTemp: 15.0

        dataNumber       : 10
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 15.0
        averageOutsideTemp: 15.5

        dataNumber       : 11
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 15.0
        averageOutsideTemp: 17.0

        dataNumber       : 12
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 15.75
        averageOutsideTemp: 18.0

        dataNumber       : 13
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 16.0
        averageOutsideTemp: 19.75

        dataNumber       : 14
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 16.75
        averageOutsideTemp: 20.0

        dataNumber       : 15
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 17.25
        averageOutsideTemp: 20.5

        dataNumber       : 16
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 18.0
        averageOutsideTemp: 20.5

        dataNumber       : 17
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 18.0
        averageOutsideTemp: 20.0

        dataNumber       : 18
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 18.0
        averageOutsideTemp: 19.75

        dataNumber       : 19
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.0
        averageInsideTemp: 18.0
        averageOutsideTemp: 19.0

        dataNumber       : 20
        consumption      : 0.0
        cost             : 0.0
        averageSettingTemp: 18.5
        averageInsideTemp: 18.0
        averageOutsideTemp: 17.75

        dataNumber       : 21
        consumption      : 0.1
        cost             : 0.0
        averageSettingTemp: 20.0
        averageInsideTemp: 20.25
        averageOutsideTemp: 16.75

        dataNumber       : 22
        consumption      : 2.3
        cost             : 0.0
        averageSettingTemp: 20.0
        averageInsideTemp: 19.25
        averageOutsideTemp: 16.75

        dataNumber       : 23
        consumption      : -255
        cost             : -255
        averageSettingTemp: -255
        averageInsideTemp: -255
        averageOutsideTemp: -255

mark@penguin:~$ .local/bin/pcomfortcloud $PUSER $PPASS list
list of devices and its device id (1-x)
device #1
    id                   : 403955336a130ea12f8b436cac9ced90bff4d1513a0d5ba46e06c951f634a0cc
    name                 : Panasonic
    group                : My House
    model                : S-180PE3R5B
mark@penguin:~$ .local/bin/pcomfortcloud $PUSER $PPASS get 1
reading from device 'Panasonic' (403955336a130ea12f8b436cac9ced90bff4d1513a0d5ba46e06c951f634a0cc)
id                       : 403955336a130ea12f8b436cac9ced90bff4d1513a0d5ba46e06c951f634a0cc
parameters
    temperatureInside    : 21
    temperatureOutside   : 16
    temperature          : 20.0
    power                : On
    mode                 : Heat
    fanSpeed             : Auto
    airSwingHorizontal   : Mid
    airSwingVertical     : DownMid
    eco                  : Auto
    nanoe                : Unavailable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants