Panasonic Comfort Cloud to control Heatpumps and Airconditions

My new Panasonic Z25 Heat Pump is controlled via the CZ-TACG1 wifi controller. This is connected to the Panasonic Comfort Cloud. I found this “API” Aircontroller. Unfortunately I don’t have the right skills to “translate” it to Python. Maybe someone can help and make it a component?

BR.

Reik

Are you good in Python? I extracted the requests from the source and it’s working. You can test these commands by downloading VS Code and install extension “REST Client”.

If you are going to use the api, create a new user for this since this will log you out from the app.

###

# @name login
POST https://accsmart.panasonic.com/auth/login HTTP/1.1
X-APP-TYPE: 1
X-APP-VERSION: 2.0.0
User-Agent: G-RAC
Accept: application/json
Content-Type: application/json

{
    "language": "0",
    "loginId": "***",
    "password": "***"
}

### 

# @name device
GET https://accsmart.panasonic.com/device/group HTTP/1.1
X-APP-TYPE: 1
X-APP-VERSION: 2.0.0
X-User-Authorization: {{login.response.body.$.uToken}}
User-Agent: G-RAC
Accept: application/json
Content-Type: application/json

###

GET https://accsmart.panasonic.com/deviceStatus/now/{{device.response.body.$.groupList[0].deviceIdList[0].deviceGuid}} HTTP/1.1
X-APP-TYPE: 1
X-APP-VERSION: 2.0.0
X-User-Authorization: {{login.response.body.$.uToken}}
User-Agent: G-RAC
Accept: application/json
Content-Type: application/json

###

POST https://accsmart.panasonic.com/deviceStatus/control HTTP/1.1
X-APP-TYPE: 1
X-APP-VERSION: 2.0.0
X-User-Authorization: {{login.response.body.$.uToken}}
User-Agent: G-RAC
Accept: application/json
Content-Type: application/json

{
    "deviceGuid": "{{device.response.body.$.groupList[0].deviceIdList[0].deviceGuid}}",
    "parameters": {
        // see next post for parameters
    }
}

the constants/parameters extracted is. A few of these was marked unsure, so we may have to validate them.

"temperatureSet": 23.0

"airSwingUD": {
    "Up": 0,
    "Down": 1,
    "Mid": 2,
    "UpMid": 3,
    "DownMid": 4
}

"airSwingLR": {
    "Left": 0,
    "Right": 1,
    "Mid": 2,
    "RightMid": 3,
    "LeftMid": 4
}

"ecoMode": {
    "Auto": 0,
    "Powerful": 1,
    "Quiet": 2
}

"fanAutoMode": {
    "Disabled": 1,
    "AirSwing": 0,
    "AirSwingLR": 3,
    "AirSwingUD": 2
}

"fanSpeed": {
    "Auto": 0,
    "Low": 1,
    "LowMid": 2,
    "Mid": 3,
    "HighMid": 4,
    "High": 5,
}

"operate": {
    "Off": 0,
    "On": 1
}

"operationMode": {
    "Auto": 0,
    "Dry": 1,
    "Cool": 2,
    "Heat": 3,
    "Fan": 4
}

you may be a little careful, I noticed that my statistics graph stopped working. I’ll try to reset the pump and do the setup once more then try this again to see if I did anything wrong.

I remember that I copied all parameters once, and retransmitted them. Perhaps that broke it.

Hi Nicolai!

Thanks for you help! I will have a look into that :-). The statistics is not really good anyway ;-). I would rather like to measure the real power consumption. I let you know when I figured out something.

BR

/Reik

Great, I have started something too - never done Python before but I’m good enough in other languages so I’m giving it a try. My first reaction to Python will I keep for myself :stuck_out_tongue:

I looked into how to develop platforms/components for hassio and they say you should never use requests call but use an PyPi package instead.

So, I have created one at https://github.com/lostfields/python-panasonic-comfort-cloud but it’s missing control and status now. But it’s a beginning.

It seems you have a lot of time :-). I did not manange to look into that but thanks to you I will need to :-).

I have to work this weekend but I will try to have a look!

Thanks for your effort! I appreciate that alot!

/Reik

I think I have done it - it’s similar to the Verisure module in usage I think. Used that project as a reference. Expect a few changes along the road.

only missing the addon in HA now :stuck_out_tongue:

So I’m back online :-). I have to look into that. How do I install pcomfortcloud on hass.io? A custom component I could probably fix.

/Reik

You are working a lot as I can see :slight_smile: I had a look but got stuck. I guess we could start with somthing like this: https://github.com/home-assistant/home-assistant/blob/master/homeassistant/components/climate/demo.py
put this in the folder custom_components\climate and cal it comfortcloud.py. The configuration should look like this:

climate:

  • platform: comfortcloud
    name: Heatpump
    username: !secret user
    password: !secret password

I started to modify the Demo file but I fear I’m to bad in programming python. I wish I could do more…

/R

I can take a look - but I’m new to Python as well :slight_smile:

I’ve done it quite similar to the Verisure session stuff, so we can probably take a look at https://github.com/home-assistant/home-assistant/blob/master/homeassistant/components/verisure.py to make a Hub and a setup. Then use this in a copy of either /climate/demo.py or climate/generic_thermostat.py.

Usage of the Verisure Hub is done in a few components like these; https://github.com/home-assistant/home-assistant/search?q=verisure&unscoped_q=verisure

I’ve been working on a panasonic component. It’s using the pcomfortcloud module.

It not working flawless yet, but it’s a start.

Hi djbulsink!

Thanks for your work! How do I use it on hass.io? I’m missing the depenency for “pcomfortcloud”. How do I install this? I get the following Error:

2018-12-28 13:05:58 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.climate.panasonic_ac. Make sure all dependencies are installed
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/loader.py”, line 92, in get_component
module = importlib.import_module(path)
File “/usr/local/lib/python3.6/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 994, in _gcd_import
File “”, line 971, in _find_and_load
File “”, line 955, in _find_and_load_unlocked
File “”, line 665, in _load_unlocked
File “”, line 678, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/config/custom_components/climate/panasonic_ac.py”, line 38, in
import pcomfortcloud
ModuleNotFoundError: No module named ‘pcomfortcloud’

BR

/Reik

Hi Reik,

I fixed the problem. The module pcomfortcloud should be installed automatically. But the import of the module was wrong place. (see this note: https://developers.home-assistant.io/docs/en/creating_component_deps_and_reqs.html#note )

If fixed this be moving the import to the setup_platform function.

DJB

Now it works!

Thanks a lot! Only the thermostat card is not completely working. The mode is not shown or can be set. I also miss the nanoeX setting. Now that this works I might have a look into programing new stuff in homeassistant.

Thanks for you great work!

/Reik

Hello again!

I’m missing the eco features in HomeAssistant. I would like to be able to switch to “quiet mode” or powerful with an automation.The nanoeX feature Would be nice to control from HA to. I just started to look into that but the standard climate device in HA does not seem to support that. Any ideas? Another device for the extra features?

/Reik

Hi Reik,

The eco and naxoeX are indeed not supported by the climate component. The component makes use of the https://github.com/lostfields/python-panasonic-comfort-cloud library. This library doesn’t support the naxoeX functionality. It would be possible to add the eco mode as an switch, but the I have to convert the component to an platform, with a switch and a climate component. At the moment I don’t have time to change this. Hopefully in a couple of weeks.

DJB

I have tried it and it works! I am sure it can be improved and I will try to assist when there’s time. In the mean time a few questions.

  1. When using HASS to set the temperature the login from the normal Comfort Cloud Android app is logged out and I have to log back in. Probably a Panasonic thing? Do you have the same?

  2. When using another solution like Android App or the remote to set the temperature HASS never picks this is. Is it possible to achieve this on a regular basis, like every 5 or 15 minutes or so? Relates to point 1 of course - as you don’t want to be logged out from the app if you don’t use HASS to set the temperature.

Other than that and the previous comments about missing some features - this is totally awesome! Thanks so much!

Toband

Hi!

You need to fix one login per “instance”. I have a panasonic account for my mobile and another for HA. To allow another user to use the same panasonic unit is not exactly straight forward but no problem.

For me the temperatures are updating nicely. It takes a few seconds but works good. Maybe that’s related to the logout issue?

BR

/Reik