djbulsink / panasonic_ac Goto Github PK
View Code? Open in Web Editor NEWPanasonic Comfort Cloud HA component
Panasonic Comfort Cloud HA component
First thanks for the awesome work, I’ve got 9 split units setup on this working well.
I do also have them pushed to HomeKit and this also for the most part works really well. There’s no fan speed but I can think that’s a Home Assistant issue.
However when trying to set an automation to turn off the AC when leaving if I forget it actually turns it on even if it was off. I suspect looking at the list of changes that it might be down to HomeKit probably sending a temp at the same time as turning the mode to off. I see a commit that turns the devices on if they were off from a change like that so might be causing it.
Any change you have HomeKit as well to look into this to see if it’s solveable?
It seems there have been changes to the API. Home assistant logs tell there is an authentication issue.
Since a few days setup fails with these errors:
Sep 18 08:21:58 dirksehome2 docker/hass[884]: 2020-09-18 08:21:58 ERROR (MainThread) [homeassistant.components.climate] Error while setting up panasonic_ac platform for climate Sep 18 08:21:58 dirksehome2 docker/hass[884]: Traceback (most recent call last): Sep 18 08:21:58 dirksehome2 docker/hass[884]: File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 179, in _async_setup_platform Sep 18 08:21:58 dirksehome2 docker/hass[884]: await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT) Sep 18 08:21:58 dirksehome2 docker/hass[884]: File "/usr/local/lib/python3.8/asyncio/tasks.py", line 483, in wait_for Sep 18 08:21:58 dirksehome2 docker/hass[884]: return fut.result() Sep 18 08:21:58 dirksehome2 docker/hass[884]: File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run Sep 18 08:21:58 dirksehome2 docker/hass[884]: result = self.fn(*self.args, **self.kwargs) Sep 18 08:21:58 dirksehome2 docker/hass[884]: File "/config/custom_components/panasonic_ac/climate.py", line 76, in setup_platform Sep 18 08:21:58 dirksehome2 docker/hass[884]: for device in api.get_devices(): Sep 18 08:21:58 dirksehome2 docker/hass[884]: File "/usr/local/lib/python3.8/site-packages/pcomfortcloud/session.py", line 174, in get_devices Sep 18 08:21:58 dirksehome2 docker/hass[884]: for device in group['deviceIdList']: Sep 18 08:21:58 dirksehome2 docker/hass[884]: KeyError: 'deviceIdList'
Apparently this is caused by a change in JDSON from panasonic, pcomfortcloud 0.16 will fix this(issue #30 deviceIdList error in session.py). Can you let me know how to install this.
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`
TLDR;
Changes requires to session.py
-> Update app version to 1.20 on line 111
Cheers to Cheesekeeper for the solution this time around.
lostfields/python-panasonic-comfort-cloud#85
Note: Cheesekeeper suggests adding quotes around the number 0 on line 125, but this was not required in my case.
Guide for pcomfortcloud and HACS users.
ssh into your HomeAssistant box
docker container ls
Copy your Home-Assistant CONTAINER ID
Mine is 572e4558ea59 so:
docker exec -it -u root 572e4558ea59 sh
Find the pcomfortcloud directory:
pip show pcomfortcloud
eg: Location: /usr/local/lib/python3.11/site-packages
Backup your session.py
cp /usr/local/lib/python3.11/site-packages/pcomfortcloud/session.py /usr/local/lib/python3.11/site-packages/pcomfort cloud/session.py.bak
Edit session.py
nano /usr/local/lib/python3.11/site-packages/pcomfortcloud/session.py
Find the line that has app version (Ctrl+W, X-APP-VERSION, enter)
Mine is line 111
Change
"X-APP-VERSION": "1.19.0" to "X-APP-VERSION": "1.20.0"
Ctrl+X to exit, Y to write changes to file
exit
to exit docket
sudo reboot now
to restart your HomeAssistant machine
The python-panasonic-comfort-cloud library used by this component supports setting of the Eco mode of the device (Quiet, Powerful or Auto). It would be good to have this supported by this component so that it could be adjusted by Home Assistant.
For implementation is should be straightforward to call this, it would be a call to the EcoMode contant from pcomfortcloud's constants. As far as integration using the climate integration goes, I assume this would be implemented in the 0.96 onwards HA climate integration as a preset mode.
Hello there!
I'm quite new to this integration and have included it through HACS with native HA install on a RPI4.
The integration starts and can logon:
2021-10-20 18:59:06 INFO (MainThread) [homeassistant.components.climate] Setting up climate.panasonic_ac
The plugin seem to take a long time to start though:
2021-10-20 19:54:21 WARNING (MainThread) [homeassistant.helpers.entity] Update of climate.villagustaf is taking over 10 seconds
But I dont see anything else in the HA logfile. No entries and no integration visible in the config->integrations.
Also in terminal I can find my heatpump:
pcomfortcloud <username> <psswd> get 1
Gives
reading from device myhouse (id)
id id
parameters
temperatureInside 14
etc
What am I missing?
Add this to HACS with a little instruction how to get it working.
I just installed it manually via HACS and i just love it!
My Air To Water aquarea Heat pump is imported but cannot be operated by the created enstatites. If needed I can provide access to my machine. This integration will be very useful since the original app is very weak,
Hi!
My heatpump has a range of 8-15 and can operate if the min value is changed to 8. But I dont know how to get a good check which HP that can do this or not to change the code.
Changing in works for me but I guess is not a good change for a HP that does not operate in this intervall.
Hello!
If your devices are all unavailable as of this week, and a restart of homeassistant isn't fixing it as usual:
docker container ls
-> copy your homeassistant container ID
docker exec -it -u root [container ID] sh
Now in the docker shell:
pip show pcomfortcloud
-> check the location of pcomfort cloud.
Likely: /usr/local/lib/python3.9/site-packages, we'll stick to that.
Make a backup of session.py
cp /usr/local/lib/python3.9/site-packages/session.py.bak
Edit session.py
nano /usr/local/lib/python3.9/site-packages/session.py
modify the function _headers() to read as follows:
def _headers(self): return { "X-APP-TYPE": "1", "X-APP-VERSION": "1.19.0", "X-User-Authorization": self._vid, "X-APP-TIMESTAMP": "1", "X-APP-NAME": "Comfort Cloud", "X-CFC-API-KEY": "Comfort Cloud", "User-Agent": "G-RAC", "Accept": "application/json; charset=utf-8", "Content-Type": "application/json; charset=utf-8" }
save, exit docker shell, restart the container (or reboot).
Tested and working on my HASS install.
Cheers to user marc2106 for pointing out the panasonic comfort cloud REST call had changed to require additional headers.
lostfields/python-panasonic-comfort-cloud#78
Howdy,
I've had this integration working in my Home Assistant deployment just fine for quite sometime, however it stopped working for no apparent reason (though, tbh, I keep HA etc pretty up-to-date, so it's possible one of the updates broke it - I just can't directly correlate an update to the break). The logs in HA show this:
Logger: homeassistant.components.climate
Source: custom_components/panasonic_ac/climate.py:71
Integration: Climate (documentation, issues)
First occurred: 9:14:41 AM (1 occurrences)
Last logged: 9:14:41 AMError while setting up panasonic_ac platform for climate
<title>403 Forbidden</title>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 197, in _async_setup_platform
await asyncio.shield(task)
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/panasonic_ac/climate.py", line 71, in setup_platform
api.login()
File "/usr/local/lib/python3.8/site-packages/pcomfortcloud/session.py", line 99, in login
self._create_token()
File "/usr/local/lib/python3.8/site-packages/pcomfortcloud/session.py", line 131, in _create_token
raise ResponseError(response.status_code, response.text)
pcomfortcloud.session.ResponseError: Invalid response, status code: 403 - Data:403 Forbidden
nginx
Any suggestions much appreciated.
Hi,
Plugin not detecting heatpump
Hello,
I would like to use your implementation to read out data from my new heatpump. but unfortunately i get below error when i have installed it via HACS:
2022-01-22 09:10:56 ERROR (MainThread) [homeassistant.components.climate] panasonic_ac: Error on device update!
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.9/site-packages/pcomfortcloud/session.py", line 274, in get_device
raise ResponseError(response.status_code, response.text)
pcomfortcloud.session.ResponseError: Invalid response, status code: 500 - Data: {"message":"Adapter Communication error","code":5005}
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 684, in async_device_update
await task
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, 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.9/site-packages/pcomfortcloud/session.py", line 274, in get_device
raise ResponseError(response.status_code, response.text)
pcomfortcloud.session.ResponseError: Invalid response, status code: 500 - Data: {"message":"Adapter Communication error","code":5005}
The componenet needs to be updated to the HA 0.96 climate cleanup changes . Who has the time and knowledge to do so?
I recently installed two new Panasonic AC (Z20-XKE; pls. see bellow), but the custom component doesn't show them neither after restart, nor after component reinstall. All I can see is the older Panasonic AC.
The Panasonic Comfort Cloud Android application shows all three devices. The same goes for the pcomfortcloud python module:
(ha_venv3_8) pi@raspberrypi:~/homeassistant_conf $pcomfortcloud "[email protected]" mypwd list
list of devices and its device id (1-x)
device #1
id : 986f71b9902a75bf5e82718876ff0000
name : Panasonic_nappali
group : B3
model :
device #2
id : 065d28a2cd5266d490b82c51ae3cd387ec245ed11b476ee11bff375349ff0000
name : Panasonic_Akos
group : B3
model : CS-Z20XKEW
device #3
id : 4e5b887fc19dfeb4d399a7da3ef88c737e4c21d9feaf1e4a3af8bcf931ff0000
name : Panasonic_Reni
group : B3
model : CS-Z20XKEW
(ha_venv3_8) pi@raspberrypi:~/homeassistant_conf $
I can see in the code [1] that it should list all devices.
Do you have an idea why only the older device gets listed?
[1] https://github.com/djbulsink/panasonic_ac/blob/master/custom_components/panasonic_ac/climate.py#L76
Hi, can you merge updated version of library into component. I have an issue described here, and it's fixed in python-panasonic-comfort-cloud library but it still doesn't work here. lostfields/python-panasonic-comfort-cloud#32
Climate.py line 208 should read "outside" instead of "Current".
Also outside_temperature returns "none" as the initial parameter and is not called for update as absent from lostfields library session.py.
ATTR import from home assistant constant is missing for outside temperature.
Hi,
i see only two heatpump , i have 4 Ac in my house .
In Hassio i see that error:
2020-03-16 16:41:34 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for panasonic_ac which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2020-03-16 16:41:44 WARNING (MainThread) [homeassistant.components.climate] Setup of climate platform panasonic_ac is taking over 10 seconds.
2020-03-16 16:42:01 ERROR (MainThread) [homeassistant.components.climate] 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 312, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 476, 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 222, in get_device
raise ResponseError(response.status_code, response.text)
pcomfortcloud.session.ResponseError: Invalid response, status code: 500 - Data: {"message":"Adapter Communication error","code":5005}
Can you help me ? thanks :)
Unable to get the integration working as of a few days. I have the latest version installed with manifest.json showing pcomfortcloud==0.0.21
I’ve also logged on to the app using the separate account I use for this integration and accepted the new terms
i did check the old tickets but I think all apply to now fixed, similar, breaks
This error originated from a custom integration.
Logger: homeassistant.config_entries
Source: custom_components/panasonic_cc/__init__.py:79
Integration: Panasonic Comfort Cloud (documentation)
First occurred: 3:04:33 AM (1 occurrences)
Last logged: 3:04:33 AM
Error setting up entry for panasonic_cc
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 293, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/config/custom_components/panasonic_cc/__init__.py", line 79, in async_setup_entry
devices = await hass.async_add_executor_job(api.get_devices)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.9/site-packages/pcomfortcloud/session.py", line 172, in get_devices
self.login()
File "/usr/local/lib/python3.9/site-packages/pcomfortcloud/session.py", line 99, in login
self._create_token()
File "/usr/local/lib/python3.9/site-packages/pcomfortcloud/session.py", line 132, in _create_token
raise ResponseError(response.status_code, response.text)
pcomfortcloud.session.ResponseError: Invalid response, status code: 401 - Data: {"message":"New version app has been published","code":4106}
Maybe the recent updates to the library by lostfields corrects the issue.
lostfields/python-panasonic-comfort-cloud#82 (comment)
Unfortunately I don't have the skills to update this repo. Hopefully someone can help?
@SeraphimSerapis ?
In 0.89.0 the panasonic component is not working anymore... I did some quick changes to get it running again:
from homeassistant.components.climate import (
ClimateDevice, STATE_HEAT, STATE_COOL,
STATE_AUTO, STATE_DRY, STATE_FAN_ONLY,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_FAN_MODE,
SUPPORT_OPERATION_MODE, SUPPORT_SWING_MODE,
SUPPORT_ON_OFF, PLATFORM_SCHEMA)
changed to:
from homeassistant.components.climate import ClimateDevice, PLATFORM_SCHEMA
from homeassistant.components.climate.const import (
STATE_HEAT, STATE_COOL,
STATE_AUTO, STATE_DRY, STATE_FAN_ONLY,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_FAN_MODE,
SUPPORT_OPERATION_MODE, SUPPORT_SWING_MODE,
SUPPORT_ON_OFF)
I don't if that is all and I have no idea how to push this change but some one can for sure :-)
/Reik
Due to changes in the api, the intégration is broken. The underlying python library has been updated to 0.0.19 to fix this.
I am on my phone now so i cannot do the PR. If someone Can Do it, it would be great.
Thank you
Getting this warning message in the HA log which presumably HA will at some point stop loading this integration.
FWIW, I'm running the latest version from HACS.
Thanks
Steve
Logger: homeassistant.loader
Source: loader.py:802
First occurred: 8:45:22 PM (1 occurrences)
Last logged: 8:45:22 PM
No 'version' key in the manifest file for custom integration 'panasonic_ac'. This will not be allowed in a future version of Home Assistant. Please report this to the maintainer of 'panasonic_ac'
Hi, first of all, thanks for the great work you did with this component. I really appreciate it!
I have a small suggestion which could improve the integration with some other components, especially schedulers. Service climate.set_temperature
accepts several additional data attributes besides the entity_id
and temperature
. I think it would be great to make use of hvac_mode
attribute which would allow us to set the target temperature and start the AC in a single call. As far as I know, this is how most climate integrations should work.
Besides other benefits, this would also allow us to use the integration with increasingly popular scheduler component. The scheduler defines several schedulable actions (e.g. heat
, cool
) which execute set_temperature
service with temperature
and hvac_mode
attributes (more details here). For example, if you schedule a cool
action with target temperature of 21°C, the scheduler will try to execute set_temperature
with hvac_mode: cool
and temperature: 21
, however our climate component will only set the target temperature but won't turn on the AC or set the HVAC mode.
Here is how set_temperature
method in climate.py
can be updated to make use of hvac_mode
:
@api_call_login
def set_temperature(self, **kwargs):
"""Set new target temperature."""
target_temp = kwargs.get(ATTR_TEMPERATURE)
if target_temp is None:
return
_LOGGER.debug("Set %s temperature %s", self.name, target_temp)
self._api.set_device(
self._device['id'],
temperature = target_temp
)
hvac_mode = kwargs.get(ATTR_HVAC_MODE)
if hvac_mode is None:
return
_LOGGER.debug("Set %s mode %s", self.name, hvac_mode)
if hvac_mode == HVAC_MODE_OFF:
self._api.set_device(
self._device['id'],
power = self._constants.Power.Off
)
else:
self._api.set_device(
self._device['id'],
power = self._constants.Power.On,
mode = self._constants.OperationMode[OPERATION_LIST[hvac_mode]]
)
I've already tested this implementation and it works correctly (even with scheduler component). I'm not a native Python developer, so maybe this could be done more elegantly.
Let me know what do you think... If you agree with this implementation I can create a PR.
Once again, thanks for the great work!
Hello,
I've noticed issues with airswing. Constants sets on pcomfortcloud start at -1 (which is Auto) and it seems that it create issues with HA.
To reproduce, open the Comfort cloud app, and set swing to Auto. Ha start to hang, and can't send any new commands until we change the mode.
Tell me if yçou can't reproduce, I'll try to be more specific.
Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.