Panasonic Comfort Cloud integration

openhab2
panasonic
comfortcloud
Tags: #<Tag:0x00007f1e5d2cb118> #<Tag:0x00007f1e5d2cafb0> #<Tag:0x00007f1e5d2cadf8>
(Yogi) #1

Hi,
I would like to ask, if somebody already using or developing connection to Panasonic comfort cloud. I have panasonic airconditioner with builtin wifi module, and it comunicates trough Panasonic Comfort Cloud. I cannot find any addon or binding for openhab.
Only what I found was some project for HA or python script, but I wasn’t able to successfully connect.
Here are some project what I found.

If somebody can help me, it will be great.
Thanks!

0 Likes

(Vincent Regaud) #2

I would use the python module in a python script with mqtt as the communication with OH

0 Likes

(Yogi) #3

Now, I’m able to connect to airconditioner with pcomfortcloud python script. There were some issue with ssl but it’s possible to connect without ssl. But what about mqtt?

0 Likes

(Vincent Regaud) #4

http://www.steves-internet-guide.com/into-mqtt-python-client/

0 Likes

(Yogi) #5

As I understand, mqtt will help me only to send commands to airconditioner, right?
Now, I’m able to do that without mqtt, with one python script, just by changing arguments. But what I still miss, is listening changes from airconditioner. It works fine, when I start it from openhab, but now I don’t know if somebady turned it on by remote controller.

0 Likes

(Vincent Regaud) #6

No, you can receive messages with mqtt too

0 Likes

(Yogi) #7

Sure, but then there should be something which will send that messages. I’m not sure, but that script just connect to cloud and get/set data. But it works on demand. I didn’t saw there any listener which will send data on some change.

0 Likes

(fcela) #8

Hi YogiBB,

I am going to buy Panaonic Etherea AC and one of the possibility is to use Panasonic Comfort Cloud integration. Had you happen to find final solution/binding for Openhab integration?
Have you tried to install two client apps and change setting at one and see if it is reflected at another one?
If so it could imply there are some notification messages we can use/track for AC status refresh.
Thanks.

0 Likes

(Yogi) #9

Hey fcela,
I didn’t find any binding for it. So I made rule, which every 30 minutes runs python script for check actual status. It’s way far from ideal state but it works. I didn’t find any way how to receive notification from panasonic cloud. There is also some missing functionality and for example in my case I’m not able to start nanoe function from script. When I tried to dump data from panasonic cloud, it was same even nanoe was on or off.

0 Likes

(Levente Eotvos) #10

I also have an Etherea at home, but I am not a programmer, so I am not able to set this up unless anyone helps me :-((
But I would be very grateful for a comfort cloud binding :-)))))

0 Likes

(Levente Eotvos) #11

Hi YogiBB,

I installed the python script and it seems to be working from console :smiley:
Could you share your rules for collecting the status information, and controlling the aircon? And maybe your sitemap items :slight_smile:

Thanks for your help!

Br,
Levente

0 Likes

(fcela) #12

Hi YogiBB,

thank for explanation. Is it even possible to turn nanoe using the mobile app?
If yes, there could be some direct communication with the internal unit itself.
I am (was :slight_smile: ) kind of “developer”, but has no experience with openhab bindings implementation principles.
I could create one, once I will choose Panasonic as the final solution.
Thanks once more.

0 Likes

(Yogi) #13

@fcela Good point. There is also no way how to control nanoe via mobile app. So maybe that’s the reason.

@lefi Sure, but keep in mind, that I’m just learning openhab and python, so my solution is not optimal. But it works for me for now. Once I’ll have some free time, I would like to look at it again.
Python:

import pcomfortcloud
import sys

###### Update
import requests

headers = {
    'Content-Type': 'text/plain',
    'Accept': 'application/json',
}
#######

t_power = {
    'Power.Off': "OFF",
    'Power.On': "ON"
}
t_power_set = {
    'OFF': pcomfortcloud.constants.Power.Off,
    'ON': pcomfortcloud.constants.Power.On
}
t_mode = {
    "OperationMode.Auto": "Auto",
    "OperationMode.Dry": "Dry",
    "OperationMode.Cool": "Cool",
    "OperationMode.Heat": "Heat"
}
t_mode_set = {
    "Auto": pcomfortcloud.constants.OperationMode.Auto,
    "Dry": pcomfortcloud.constants.OperationMode.Dry,
    "Cool": pcomfortcloud.constants.OperationMode.Cool,
    "Heat": pcomfortcloud.constants.OperationMode.Heat 
}
t_eco = {
    "EcoMode.Auto": "Auto",
    "EcoMode.Powerful": "Powerful",
    "EcoMode.Quiet": "Quiet"
}
t_eco_set = {
    "Auto": pcomfortcloud.constants.EcoMode.Auto,
    "Powerful": pcomfortcloud.constants.EcoMode.Powerful,
    "Quiet": pcomfortcloud.constants.EcoMode.Quiet 
}
t_fanSpeed = {
    "FanSpeed.Auto": "Auto",
    "FanSpeed.Low": "Low",
    "FanSpeed.LowMid": "LowMid",
    "FanSpeed.Mid": "Mid",
    "FanSpeed.HighMid": "HighMid",
    "FanSpeed.High": "High",
}
t_fanSpeed_set = {
    "Auto": pcomfortcloud.constants.FanSpeed.Auto,
    "Low": pcomfortcloud.constants.FanSpeed.Low,
    "LowMid": pcomfortcloud.constants.FanSpeed.LowMid,
    "Mid": pcomfortcloud.constants.FanSpeed.Mid,
    "HighMid": pcomfortcloud.constants.FanSpeed.HighMid,
    "High": pcomfortcloud.constants.FanSpeed.High,
}
t_airSwingVertical = {
    "AirSwingUD.Auto": "Auto",
    "AirSwingUD.Up": "Up",
    "AirSwingUD.Down": "Down",
    "AirSwingUD.Mid": "Mid",
    "AirSwingUD.UpMid": "UpMid",
    "AirSwingUD.DownMid": "DownMid"
}
t_airSwingVertical_set = {
    "Auto": pcomfortcloud.constants.AirSwingUD.Auto,
    "Up": pcomfortcloud.constants.AirSwingUD.Up,
	"Down": pcomfortcloud.constants.AirSwingUD.Down,
    "Mid": pcomfortcloud.constants.AirSwingUD.Mid,
    "UpMid": pcomfortcloud.constants.AirSwingUD.UpMid,
    "DownMid": pcomfortcloud.constants.AirSwingUD.DownMid
}
t_airSwingHorizontal = {
    "AirSwingLR.Auto": "Auto",
    "AirSwingLR.Left": "Left",
	"AirSwingLR.Right": "Right",
	"AirSwingLR.Mid": "Mid",
	"AirSwingLR.RightMid": "RightMid",
	"AirSwingLR.LeftMid": "LeftMid"
}
t_airSwingHorizontal_set = {
    "Auto": pcomfortcloud.constants.AirSwingLR.Auto,
    "Left": pcomfortcloud.constants.AirSwingLR.Left,
	"Right": pcomfortcloud.constants.AirSwingLR.Right,
	"Mid": pcomfortcloud.constants.AirSwingLR.Mid,
	"RightMid": pcomfortcloud.constants.AirSwingLR.RightMid,
	"LeftMid": pcomfortcloud.constants.AirSwingLR.LeftMid
}



session = pcomfortcloud.Session('XXX@gmail.com', 'XXX', tokenFileName='~/.panasonic-token', raw=False, verifySsl=False)
session.login()


devices = session.get_devices()
status = session.get_device(devices[0]['id'])
action = sys.argv[1]
if len(sys.argv) == 2:
	print(action)
else :
	s_power = sys.argv[2]
	s_mode = sys.argv[3]
	s_ecomode = sys.argv[4]
	s_temperature = sys.argv[5]
	s_fanspeed = sys.argv[6]
	s_airswingvertical = sys.argv[7]
	s_airswinghorizontal = sys.argv[8]

if action == "set":
	session.set_device(devices[0]['id'], 
		power = t_power_set[s_power],
		temperature = s_temperature,
		mode = t_mode_set[s_mode],
		eco = t_eco_set[s_ecomode],
		fanSpeed = t_fanSpeed_set[s_fanspeed],
		airSwingVertical = t_airSwingVertical_set[s_airswingvertical],
		airSwingHorizontal = t_airSwingHorizontal_set[s_airswinghorizontal]
	)
else:
	##response = requests.put('http://myhome:8080/rest/items/Airconditioner_EcoNavi/state', headers=headers, data=econavi)
	response = requests.put('http://myhome:8080/rest/items/Airconditioner_Power/state', headers=headers, data=t_power[str(status["parameters"]["power"])])
	response = requests.put('http://myhome:8080/rest/items/Airconditioner_Sitemap/state', headers=headers, data=t_power[str(status["parameters"]["power"])])
	response = requests.put('http://myhome:8080/rest/items/Airconditioner_Mode/state', headers=headers, data=t_mode[str(status["parameters"]["mode"])])
	response = requests.put('http://myhome:8080/rest/items/Airconditioner_EcoMode/state', headers=headers, data=t_eco[str(status["parameters"]["eco"])])
	response = requests.put('http://myhome:8080/rest/items/Airconditioner_Temperature/state', headers=headers, data=str(status["parameters"]["temperature"]))
	response = requests.put('http://myhome:8080/rest/items/Airconditioner_FanSpeed/state', headers=headers, data=t_fanSpeed[str(status["parameters"]["fanSpeed"])])
	response = requests.put('http://myhome:8080/rest/items/Airconditioner_AirSwingVertical/state', headers=headers, data=t_airSwingVertical[str(status["parameters"]["airSwingVertical"])])
	response = requests.put('http://myhome:8080/rest/items/Airconditioner_AirSwingHorizontal/state', headers=headers, data=t_airSwingHorizontal[str(status["parameters"]["airSwingHorizontal"])])

Rule:

rule "AirConditioner Status Update"
when
    Time cron "0 0/30 * * * ?"
then
    executeCommandLine('sudo python /home/openhabian/.local/lib/python2.7/site-packages/airconditioner.py "state"', 2000)
end

rule "AirConditioner Manual Status Update"
when
    Item Airconditioner_Update changed to ON
then
    executeCommandLine('sudo python /home/openhabian/.local/lib/python2.7/site-packages/airconditioner.py "status"', 2000)
end

rule "AirConditioner Status"
when
    Item Airconditioner_Power received update
then
    sendCommand(Airconditioner_Update, OFF)
end

rule "AirConditioner Set"
when
    Item Airconditioner_Auto changed or
    Item Airconditioner_Power changed or
    Item Airconditioner_Mode changed or
    Item Airconditioner_EcoNavi changed or
    Item Airconditioner_EcoMode changed or
    Item Airconditioner_Temperature changed or
    Item Airconditioner_FanSpeed changed or
    Item Airconditioner_AirSwingVertical changed or
    Item Airconditioner_AirSwingHorizontal changed
then
	logInfo("AirConditioner Set", '/home/openhabian/.local/lib/python2.7/site-packages/airconditioner.py "set" "' + Airconditioner_Power.state.toString + '" "' + Airconditioner_Mode.state.toString + '" "' + Airconditioner_EcoMode.state.toString + '" "' + Airconditioner_Temperature.state + '" "' + Airconditioner_FanSpeed.state.toString + '" "' + Airconditioner_AirSwingVertical.state.toString + '" "' + Airconditioner_AirSwingHorizontal.state.toString + '"')
	executeCommandLine('sudo python /home/openhabian/.local/lib/python2.7/site-packages/airconditioner.py "set" "' + Airconditioner_Power.state.toString + '" "' + Airconditioner_Mode.state.toString + '" "' + Airconditioner_EcoMode.state.toString + '" "' + Airconditioner_Temperature.state + '" "' + Airconditioner_FanSpeed.state.toString + '" "' + Airconditioner_AirSwingVertical.state.toString + '" "' + Airconditioner_AirSwingHorizontal.state.toString + '"', 2000)
    if (Airconditioner_Power.state == OFF){
        sendCommand(Airconditioner_Status, "OFF")
        sendCommand(Airconditioner_GoogleHomeMode, "off")
    } else {
        postUpdate(Airconditioner_Status, Airconditioner_Mode.state)
        switch Airconditioner_Mode.state {
            case "Auto": {
                sendCommand(Airconditioner_GoogleHomeMode, "heatcool")
            }
            case "Cool": {
                sendCommand(Airconditioner_GoogleHomeMode, "cool")
            }
            case "Heat": {
                sendCommand(Airconditioner_GoogleHomeMode, "heat")
            }
            case "Dry": {
                sendCommand(Airconditioner_GoogleHomeMode, "dry")
            }
        }
    }
end

Items:

Switch      Airconditioner_Update               "Airconditioner Status"                 	    <switch>            (gAirconditioner)
Switch      Airconditioner_Auto                 "Airconditioner Auto"                   	    <switch>            (gAirconditioner)
Number      Airconditioner_Auto_InsideTemp      "Airconditioner Max Inside Temperature Limit"   <temperature>       (gAirconditioner)
Number      Airconditioner_Auto_OutsideTemp     "Airconditioner Min Outside Temperature Limit"  <temperature>       (gAirconditioner)
Switch      Airconditioner_Power                "Airconditioner Power"                      	<climate>           (gAirconditioner)
String      Airconditioner_Mode                 "Airconditioner Mode"                       	<text>              (gAirconditioner)
String      Airconditioner_GoogleHomeMode       "Airconditioner Google Home [%s]"               <climate>           (gAirconditioner)    [ "homekit:HeatingCoolingMode" ]
String      Airconditioner_Status               "Airconditioner [%s]"                           <climate>           (gAirconditioner)
Switch      Airconditioner_EcoNavi              "Airconditioner EcoNavi"                	    <motion>            (gAirconditioner)
String      Airconditioner_EcoMode              "Airconditioner EcoMode"                	    <fan>               (gAirconditioner)
Number      Airconditioner_Temperature          "Airconditioner Temperature"            	    <temperature>       (gAirconditioner)    [ "TargetTemperature" ]
String      Airconditioner_FanSpeed             "Airconditioner Fan Speed"              	    <fan>               (gAirconditioner)
String      Airconditioner_AirSwingVertical     "Airconditioner Air Swing Vertical"     	    <movecontrol>       (gAirconditioner)
String      Airconditioner_AirSwingHorizontal   "Airconditioner Air Swing Horizontal"   	    <movecontrol>       (gAirconditioner)
Number      Airconditioner_TADO_Temperature		"Airconditioner Tado Temperature [%.1f]"		<temperature>	    (gAirconditioner)    [ "CurrentTemperature" ] {channel="tado:zone:6fc099d4:1:currentTemperature"}
DateTime	Airconditioner_LastUpdate  			"Airconditioner Last update [%1$ta %1$tR]" 	    <time>
0 Likes

(fcela) #14

Hi YogiBB,

I downloaded Comfort Cloud app for iOS and can clearly see nano-e (and eco navi as well) settings slider in advanced room settings (three dots).
It is just demo but it seems the app is ready for this feature.
If I switched nanoe in the advanced settings, I can see nanoe icon just below the room name:

0 Likes

(Yogi) #15

Yes, I know about that. It’s there for a long time on Android and iOS. But sadly, only in demo. I already tried to write to support, but their email doesn’t work.

0 Likes

(fcela) #16

Hi YogiBB,

I have found how to enable nano-e at app:

  1. click on any device in your group to enable Device list menu item at right corner
  2. click on “Device list” item
  3. click on pencil to edit the device
  4. scroll down to nano and enable the feature

you can now switch on/off the nanoe feature at the app device control panel.

It is strange I could not enable ECONAVI the same way, the item is just not included in the configuration items. I have the top ethereal model. Any hint?

0 Likes

(Yogi) #17

Not in my case :frowning:

0 Likes

(fcela) #18

Really funny, I got no ECONAVI option (see below) and it seems 2019 Etherea model range has no ECONAVI at all?!, can anybody confirm please?

What is your AC model #?
I have CS-Z25VKEW and CS-Z20VKEW with builtin wireless module.

Anyway, I could try to dump command data when enabling nano-e using apps. What tools do you use for the purpose?

0 Likes

(Yogi) #19

I’m using panasonic comfort python script to dump data.
For econavy there is change in “ecoNavi” parameter. 2 = on, 1 = off. I cannot control nanoe via app, but there is also no change in dump, when I enable it via remote control.
I have CU-Z35TKE with CZ-TACG1 wifi adapter.

0 Likes