djbulsink / panasonic_ac

Panasonic Comfort Cloud HA component
30 stars 16 forks source link

heat pump not visible as hassio entity #17

Open simonunzio opened 4 years ago

simonunzio commented 4 years ago

hello, I have configured three heat pumps in Panasonic comfort Cloud, and initially I saw them all as entities on Hassio, then suddenly I see only two. Thinking it was a wi-fi problem I disabled 5ghz on my router, so that all the pumps are in 2.4 ghz. On the comfort cloud I see and manage all 3 heat pumps. I still attach the log. Thank you and congratulations on your work.

`panasonic_ac: Error on device update! ValueError: 5 is not a valid AirSwingLR

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/config/custom_components/panasonic_ac/climate.py", line 109, in update data= self._api.get_device(self._device['id']) File "/usr/local/lib/python3.7/site-packages/pcomfortcloud/session.py", line 239, in get_device 'parameters': self._read_parameters(_json['parameters']) File "/usr/local/lib/python3.7/site-packages/pcomfortcloud/session.py", line 374, in _read_parameters value['airSwingHorizontal'] = constants.AirSwingLR(parameters['airSwingLR']) File "/usr/local/lib/python3.7/enum.py", line 310, in call return cls.new(cls, value) File "/usr/local/lib/python3.7/enum.py", line 564, in new raise exc File "/usr/local/lib/python3.7/enum.py", line 548, in new result = cls.missing(value) File "/usr/local/lib/python3.7/enum.py", line 577, in missing raise ValueError("%r is not a valid %s" % (value, cls.name)) ValueError: 5 is not a valid AirSwingLR

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 292, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 461, in async_device_update await self.hass.async_add_executor_job(self.update) File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/panasonic_ac/climate.py", line 113, in update data = self._api.get_device(self._device['id']) File "/usr/local/lib/python3.7/site-packages/pcomfortcloud/session.py", line 239, in get_device 'parameters': self._read_parameters(_json['parameters']) File "/usr/local/lib/python3.7/site-packages/pcomfortcloud/session.py", line 374, in _read_parameters value['airSwingHorizontal'] = constants.AirSwingLR(parameters['airSwingLR']) File "/usr/local/lib/python3.7/enum.py", line 310, in call return cls.new(cls, value) File "/usr/local/lib/python3.7/enum.py", line 564, in new raise exc File "/usr/local/lib/python3.7/enum.py", line 548, in new result = cls.missing(value) File "/usr/local/lib/python3.7/enum.py", line 577, in missing raise ValueError("%r is not a valid %s" % (value, cls.name)) ValueError: 5 is not a valid AirSwingLR`

djbulsink commented 4 years ago

Hi @simonunzio,

I don't have a heat pump myself, so I can't reproduce the error. The setting for the air swing left-right is not know by the integration, according to the logs. I like to add the setting, but I dont know what the description should be. Can you tell me what is shown in the comfort app for "Air swing".

Cheers DJBulsink

arnefm commented 4 years ago

I have a heat pump too, which supports the air swing setting both horizontally and vertically. It's been working flawlessly with your integration! Thanks for your hard work. Here is a screenshot of how the air swing setting looks inside the Comfort Cloud app:

comfort_cloud

This probably isn't very helpful, so here is some data from pcomfortcloud:

$ pcomfortcloud -s true xxxxxx@gmail.com myPassword list
list of devices and its device id (1-x)
device #1
    id             : XXXXXXXXXXXXXXXXXXXXXXXXXX
    name           : Air conditioner
    group          : arnefm's heatpump
    model          : CS-HZ25UKE
$ pcomfortcloud -s true xxxxxxxxx@gmail.com myPassword get 1                                
reading from device 'Air conditioner' (XXXXXXXXXXXXXXXXXXXXXXXXXXXX)
id                       : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
parameters
    temperatureInside    : 20
    temperatureOutside   : 3
    power                : On
    temperature          : 20.0
    mode                 : Heat
    fanSpeed             : Auto
    airSwingHorizontal   : Mid
    airSwingVertical     : Up
    eco                  : Auto
pcomfortcloud -s true xxxxxx@gmail.com myPassword dump 1                                         
deviceGuid               : CS-HZ25UKE+4939713442
timestamp                : 1581787900915
summerHouse              : 2
iAutoX                   : False
nanoe                    : True
autoMode                 : True
heatMode                 : True
fanMode                  : True
dryMode                  : True
coolMode                 : True
ecoNavi                  : False
powerfulMode             : True
permission               : 3
quietMode                : True
airSwingLR               : True
ecoFunction              : 0
temperatureUnit          : 0
modeAvlList
    autoMode             : 1
    fanMode              : 1
parameters
    devGuid              : CS-HZ25UKE+4939713442
    eventTime            : None
    online               : True
    operate              : 1
    operationMode        : 3
    temperatureSet       : 20.0
    fanSpeed             : 0
    fanAutoMode          : 1
    airSwingLR           : 2
    airSwingUD           : 0
    airDirection         : 0
    ecoMode              : 0
    ecoNavi              : 0
    nanoe                : 2
    iAuto                : 0
    defrosting           : -255
    errorCode            : KgAACwEBSDAwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==
    errorCodeStr         : H00
    insideTemperature    : 20
    outTemperature       : 2
    devRacCommunicateStatus: -255
    errorStatus          : -255
    errorStatusFlg       : False
    actualNanoe          : 2
    airQuality           : 0
    ecoFunctionData      : 0
    updateTime           : None
autoTempMax              : -1
dryTempMax               : -1
heatTempMax              : -1
coolTempMax              : -1
autoTempMin              : -1
dryTempMin               : -1
heatTempMin              : -1
coolTempMin              : -1
fanSpeedMode             : -1
fanDirectionMode         : -1

Please tell me if you need more information - I could for instance do a "pcomfortcloud get 1" for each swing setting both horizontally and vertically if that would be helpful.

djbulsink commented 4 years ago

Hi @simonunzio @arnefm ,

I've created a quick fix for this problem. Can you test it. By using this file in the custom component: https://github.com/djbulsink/panasonic_ac/blob/fix/heat-pump/custom_components/panasonic_ac/climate.py .

In the future I hope to implement the horizontal airswing. Not sure how to do this because of the limit methods home assistant support for climate devices: https://developers.home-assistant.io/docs/entity_climate/#set-swing-mode

DJ.

nimikko commented 4 years ago

Not sure if this help but there is similar discussion going on another climate device.

https://github.com/home-assistant/core/labels/integration%3A%20melcloud

djbulsink commented 4 years ago

@JoHa-git Thanks for the hint. I implemented it now the same way. I don't have a device that's swings horizontal, so I'm not able to test it.

I still don't know what causes the 'ValueError: 5 is not a valid AirSwingLR' is some cases. Probably the class AirSwingLR is not complete.

nimikko commented 4 years ago

Well i got the same problems when i tried to test the horizontal swing. My guess at the moment is that the AirSwingLR is not correct as for example when i turn the swing to left it says right on home assistant and I get the ValueError: 5 when it is either on the most right position or the second most right position, but i do try to debug it more later.

nimikko commented 4 years ago

I went trough all the horizontal swing settings and commented on the pcomfort cloud. As for me there was some differences on the comfort cloud and AirSwingLR class. On my unit I got these results.

class AirSwingLR(Enum): Auto = -1 Left = 1 LeftMid = 5 Mid = 2 RightMid = 4 Right = 0

com-xuonghuynh commented 4 years ago

I got same issue, any fix for this yet ?

shyne99 commented 4 years ago

I think that this issue comes from the underlying python package that this integration is relying on.

Haven't tested it but there is a ongoing pull request pending : https://github.com/lostfields/python-panasonic-comfort-cloud/pull/24