Btw, can you see inside and outside temperature in app? Because I have only outside temperature there.
Yes, I can see for the āsplitā units:
The KIT is reporting inside temp only, donāt know why and didnāt notice it before. Will report later regarding KIT unit.
It really seems only the split unit shows outdoor temp if switched off (wifi is on of course).
I have to turn my other kit unit (CS-Z25VKEW + CU-Z25TKE) ON to report the outdoor temp to the comfort cloud app.
Continuing the discussion from Panasonic Comfort Cloud integration:
@YogiBB Thank you for your post as it has helped me get 80% of the way to getting my panasonic air conditioners to talk to openhab but I get the following error:
Traceback (most recent call last):
File āairconditioner.pyā, line 100, in
action = sys.argv[1]
IndexError: list index out of range
As this is literally the first time Iāve worked with Python Iām a little stuck. If I run the pcomforcloud script with user and pass I get the command I require eg: pcomforcloud user pass list and I get a list of the 3 air cons.
Any help, and let me know what other info youāll need would be greatly appreciated.
It looks like you are missing some parameters while running script.
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)
Hi Yogi,
Ok, So, I have just spent another 18 hours on it and after editing this post for the 4th time (feel free to look at the history for a laugh), but by talking it out Iām starting to get a handle on it.
Iām just focusing on getting info for now, then Iāll move onto control/
From what I understand it doesnāt matter what argument you pass to it, i.e. status, state, blah (literally blah) as long as you pass one āwordā it will get the status, and post it.
Iām doing it from the command line so now I just need to figure out how to get it to run from executeCommandLine because mine isnāt at the moment.
Also a number of options have changed, or are just different in Australia. i.e. Mode has Auto, Dry, Cool, Heat, but there is also fan. So Iāll keep plugging away and see what happensā¦
Lastly, it looks like it supports only 1 aircon in its current configuration?
Iāll post the final files here if it helps anyone elseā¦
Below are the final versions of what Iām using to connect my Panasonic Air Conditioners to Openhab2. There are current 3 units so you will need to adjust a couple of the files to suit the number of air conditioners you have. Iām sure there is someone smarter than me who can turn that into some sort of array but itās beyond my coding ability at this point.
If anything is unclear or missing just let me know & Iāll do my best to update it.
Prerequisites
- Python 3 installed (including pip installer)
- pcomfortcloud python script. https://pypi.org/project/pcomfortcloud/0.0.16/
scripts/airconditioner.py
- Line 103 Youāll need to have the same amount of variables as you do airconditioners e.g. status1, status 2, etc
- Line 136 You need to have the same 9 lines for each air conditioner with a different name allocated. These will match the names in the items/aircon.items file.
items/aircon.items
- The switch at the top allows you to get manual updates as Panasonic ComfortCloud is not a push service.
- Duplicate each aircon for as many as you have, named differently of course.
rules/panaair.rules
- First rule is a cron to get updates every 30 mins. Feel free to change this to longer or shorter. Be mindful of the 4 second (4000) timeout and make longer if you have more aircons as it give OH2 time to process all the updates as the panasonic serice isnāt fast.
- Second and Third rules deal with the manual switch (in items file) to get an update whenever you want.
- Note: Youāll always have 1 aircon minimum and this is what the third rules looks for receiving the update to turn the manual update switch off, watch the naming.
sitemaps/your.sitemap
- This is just how I setup the user GUI. Feel free to make your own.
In case youāre wondering I did the horizontal & vertical swing as both a switch & selection just to see which I prefer, and havenāt decided yet.
scripts/airconditioner.py
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",
"OperationMode.Fan": "Fan"
}
t_mode_set = {
"Auto": pcomfortcloud.constants.OperationMode.Auto,
"Dry": pcomfortcloud.constants.OperationMode.Dry,
"Cool": pcomfortcloud.constants.OperationMode.Cool,
"Heat": pcomfortcloud.constants.OperationMode.Heat,
"Fan": pcomfortcloud.constants.OperationMode.Fan
}
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
}
## Log into panasonic
session = pcomfortcloud.Session('youremail@yousigneduptopanasonicwith.com', 'YourPassword', tokenFileName='~/.panasonic-token', raw=False, verifySsl=False)
session.login()
## Gets list of devices
devices = session.get_devices()
## Stores the aircon current settings to status variable
status = session.get_device(devices[0]['id'])
status2 = session.get_device(devices[2]['id'])
status3 = session.get_device(devices[1]['id'])
## Gets the first variable passed from openhab to this script
action = sys.argv[1]
## Decides if it is a get or set. 1st variable is this script name, 2nd is the first variable passed. i.e. status
if len(sys.argv) == 2:
print(action)
else :
s_power = sys.argv[2]
s_temperature = sys.argv[3]
s_mode = sys.argv[4]
s_fanspeed = sys.argv[5]
s_airswinghorizontal = sys.argv[6]
s_airswingvertical = sys.argv[7]
s_ecomode = sys.argv[8]
s_device = sys.argv[9]
if action == "set":
session.set_device(devices[int(s_device)]['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:
##Econavi disabled by Panasonic## response = requests.put('http://myhome:8080/rest/items/Airconditioner_EcoNavi/state', headers=headers, data=econavi)
response = requests.put('http://localhost:8080/rest/items/Aircon1_Power/state', headers=headers, data=t_power[str(status["parameters"]["power"])])
response = requests.put('http://localhost:8080/rest/items/Aircon1_Mode/state', headers=headers, data=t_mode[str(status["parameters"]["mode"])])
response = requests.put('http://localhost:8080/rest/items/Aircon1_EcoMode/state', headers=headers, data=t_eco[str(status["parameters"]["eco"])])
response = requests.put('http://localhost:8080/rest/items/Aircon1_Temperature/state', headers=headers, data=str(status["parameters"]["temperature"]))
response = requests.put('http://localhost:8080/rest/items/Aircon1_FanSpeed/state', headers=headers, data=t_fanSpeed[str(status["parameters"]["fanSpeed"])])
response = requests.put('http://localhost:8080/rest/items/Aircon1_AirSwingVertical/state', headers=headers, data=t_airSwingVertical[str(status["parameters"]["airSwingVertical"])])
response = requests.put('http://localhost:8080/rest/items/Aircon1_AirSwingHorizontal/state', headers=headers, data=t_airSwingHorizontal[str(status["parameters"]["airSwingHorizontal"])])
response = requests.put('http://localhost:8080/rest/items/Aircon1_TempInside/state', headers=headers, data=str(status["parameters"]["temperatureInside"]))
response = requests.put('http://localhost:8080/rest/items/Aircon1_TempOutside/state', headers=headers, data=str(status["parameters"]["temperatureOutside"]))
response = requests.put('http://localhost:8080/rest/items/Aircon2_Power/state', headers=headers, data=t_power[str(status2["parameters"]["power"])])
response = requests.put('http://localhost:8080/rest/items/Aircon2_Mode/state', headers=headers, data=t_mode[str(status2["parameters"]["mode"])])
response = requests.put('http://localhost:8080/rest/items/Aircon2_EcoMode/state', headers=headers, data=t_eco[str(status2["parameters"]["eco"])])
response = requests.put('http://localhost:8080/rest/items/Aircon2_Temperature/state', headers=headers, data=str(status2["parameters"]["temperature"]))
response = requests.put('http://localhost:8080/rest/items/Aircon2_FanSpeed/state', headers=headers, data=t_fanSpeed[str(status2["parameters"]["fanSpeed"])])
response = requests.put('http://localhost:8080/rest/items/Aircon2_AirSwingVertical/state', headers=headers, data=t_airSwingVertical[str(status2["parameters"]["airSwingVertical"])])
response = requests.put('http://localhost:8080/rest/items/Aircon2_AirSwingHorizontal/state', headers=headers, data=t_airSwingHorizontal[str(status2["parameters"]["airSwingHorizontal"])])
response = requests.put('http://localhost:8080/rest/items/Aircon2_TempInside/state', headers=headers, data=str(status2["parameters"]["temperatureInside"]))
response = requests.put('http://localhost:8080/rest/items/Aircon2_TempOutside/state', headers=headers, data=str(status2["parameters"]["temperatureOutside"]))
response = requests.put('http://localhost:8080/rest/items/Aircon3_Power/state', headers=headers, data=t_power[str(status3["parameters"]["power"])])
response = requests.put('http://localhost:8080/rest/items/Aircon3_Mode/state', headers=headers, data=t_mode[str(status3["parameters"]["mode"])])
response = requests.put('http://localhost:8080/rest/items/Aircon3_EcoMode/state', headers=headers, data=t_eco[str(status3["parameters"]["eco"])])
response = requests.put('http://localhost:8080/rest/items/Aircon3_Temperature/state', headers=headers, data=str(status3["parameters"]["temperature"]))
response = requests.put('http://localhost:8080/rest/items/Aircon3_FanSpeed/state', headers=headers, data=t_fanSpeed[str(status3["parameters"]["fanSpeed"])])
response = requests.put('http://localhost:8080/rest/items/Aircon3_AirSwingVertical/state', headers=headers, data=t_airSwingVertical[str(status3["parameters"]["airSwingVertical"])])
response = requests.put('http://localhost:8080/rest/items/Aircon3_AirSwingHorizontal/state', headers=headers, data=t_airSwingHorizontal[str(status3["parameters"]["airSwingHorizontal"])])
response = requests.put('http://localhost:8080/rest/items/Aircon3_TempInside/state', headers=headers, data=str(status3["parameters"]["temperatureInside"]))
response = requests.put('http://localhost:8080/rest/items/Aircon3_TempOutside/state', headers=headers, data=str(status3["parameters"]["temperatureOutside"]))
items/aircon.item
Switch Aircon_Update "Aircon Status" <switch>
Number Aircon1_TempInside "Aircon1 Inside Temp" <temperature>
Number Aircon1_TempOutside "Aircon1 Outside Temp" <temperature>
Switch Aircon1_Power "Airconditioner Power" <climate> (gAirPower)
String Aircon1_Mode "Airconditioner Mode" <heating>
String Aircon1_Status "Airconditioner [%s]" <climate>
String Aircon1_EcoMode "Airconditioner EcoMode" <fan>
Number Aircon1_Temperature "Airconditioner Temperature" <temperature>
String Aircon1_FanSpeed "Airconditioner Fan Speed" <fan>
String Aircon1_AirSwingVertical "Airconditioner Air Swing Vertical" <movecontrol>
String Aircon1_AirSwingHorizontal "Airconditioner Air Swing Horizontal" <movecontrol>
DateTime Aircon1_LastUpdate "Airconditioner Last update [%1$ta %1$tR]" <time>
Number Aircon2_TempInside "Aircon1 Inside Temp" <temperature>
Number Aircon2_TempOutside "Aircon1 Outside Temp" <temperature>
Switch Aircon2_Power "Airconditioner Power" <climate> (gAirPower)
String Aircon2_Mode "Airconditioner Mode" <heating>
String Aircon2_Status "Airconditioner [%s]" <climate>
String Aircon2_EcoMode "Airconditioner EcoMode" <fan>
Number Aircon2_Temperature "Airconditioner Temperature" <temperature>
String Aircon2_FanSpeed "Airconditioner Fan Speed" <fan>
String Aircon2_AirSwingVertical "Airconditioner Air Swing Vertical" <movecontrol>
String Aircon2_AirSwingHorizontal "Airconditioner Air Swing Horizontal" <movecontrol>
Number Aircon3_TempInside "Aircon1 Inside Temp" <temperature>
Number Aircon3_TempOutside "Aircon1 Outside Temp" <temperature>
Switch Aircon3_Power "Airconditioner Power" <climate> (gAirPower)
String Aircon3_Mode "Airconditioner Mode" <heating>
String Aircon3_Status "Airconditioner [%s]" <climate>
String Aircon3_EcoMode "Airconditioner EcoMode" <fan>
Number Aircon3_Temperature "Airconditioner Temperature" <temperature>
String Aircon3_FanSpeed "Airconditioner Fan Speed" <fan>
String Aircon3_AirSwingVertical "Airconditioner Air Swing Vertical" <movecontrol>
String Aircon3_AirSwingHorizontal "Airconditioner Air Swing Horizontal" <movecontrol>
Group:Switch:OR(ON,OFF) gAirPower "Actve Aircon [%d]" <presence>
rules/panaair.rules
rule "AirConditioner Status Update"
when
Time cron "0 0/30 * * * ?"
then
executeCommandLine("sudo@@python3@@/etc/openhab2/scripts/airconditioner.py@@status", 4000)
end
rule "AirCon Manual Status Update"
when
Item Aircon_Update changed to ON
then
executeCommandLine("sudo@@python3@@/etc/openhab2/scripts/airconditioner.py@@status", 4000)
end
rule "AirConditioner Status"
when
Item Aircon1_Power received update
then
sendCommand(Aircon_Update, OFF)
end
rule "AirCon1 Set"
when
Item Aircon1_Power changed or
Item Aircon1_Mode changed or
Item Aircon1_EcoNavi changed or
Item Aircon1_EcoMode changed or
Item Aircon1_Temperature changed or
Item Aircon1_FanSpeed changed or
Item Aircon1_AirSwingVertical changed or
Item Aircon1_AirSwingHorizontal changed
then
logInfo("AirConditioner Set", '/etc/openhab2/scripts/airconditioner.py "set" "' + Aircon1_Power.state.toString + '" "' + Aircon1_Temperature.state.toString + '" "' + Aircon1_Mode.state.toString + '" "' + Aircon1_FanSpeed.state + '" "' + Aircon1_AirSwingHorizontal.state.toString + '" "' + Aircon1_AirSwingVertical.state.toString + '" "' + Aircon1_EcoMode.state.toString + '"')
executeCommandLine("sudo@@python3@@/etc/openhab2/scripts/airconditioner.py@@set@@" + Aircon1_Power.state.toString + "@@" + Aircon1_Temperature.state.toString + "@@" + Aircon1_Mode.state.toString + "@@" + Aircon1_FanSpeed.state + "@@" + Aircon1_AirSwingHorizontal.state.toString + "@@" + Aircon1_AirSwingVertical.state.toString + "@@" + Aircon1_EcoMode.state.toString + "@@0", 2000)
if (Aircon1_Power.state == OFF){
sendCommand(Aircon1_Status, "OFF")
} else {
postUpdate(Aircon1_Status, Aircon1_Mode.state)
}
end
rule "AirCon2 Set"
when
Item Aircon2_Power changed or
Item Aircon2_Mode changed or
Item Aircon2_EcoNavi changed or
Item Aircon2_EcoMode changed or
Item Aircon2_Temperature changed or
Item Aircon2_FanSpeed changed or
Item Aircon2_AirSwingVertical changed or
Item Aircon2_AirSwingHorizontal changed
then
logInfo("AirConditioner Set", '/etc/openhab2/scripts/airconditioner.py "set" "' + Aircon2_Power.state.toString + '" "' + Aircon2_Temperature.state.toString + '" "' + Aircon2_Mode.state.toString + '" "' + Aircon2_FanSpeed.state + '" "' + Aircon2_AirSwingHorizontal.state.toString + '" "' + Aircon2_AirSwingVertical.state.toString + '" "' + Aircon2_EcoMode.state.toString + '"')
executeCommandLine("sudo@@python3@@/etc/openhab2/scripts/airconditioner.py@@set@@" + Aircon2_Power.state.toString + "@@" + Aircon2_Temperature.state.toString + "@@" + Aircon2_Mode.state.toString + "@@" + Aircon2_FanSpeed.state + "@@" + Aircon2_AirSwingHorizontal.state.toString + "@@" + Aircon2_AirSwingVertical.state.toString + "@@" + Aircon2_EcoMode.state.toString + "@@2", 2000)
if (Aircon2_Power.state == OFF){
sendCommand(Aircon2_Status, "OFF")
} else {
postUpdate(Aircon2_Status, Aircon2_Mode.state)
}
end
rule "AirCon3 Set"
when
Item Aircon3_Power changed or
Item Aircon3_Mode changed or
Item Aircon3_EcoNavi changed or
Item Aircon3_EcoMode changed or
Item Aircon3_Temperature changed or
Item Aircon3_FanSpeed changed or
Item Aircon3_AirSwingVertical changed or
Item Aircon3_AirSwingHorizontal changed
then
logInfo("AirConditioner Set", '/etc/openhab2/scripts/airconditioner.py "set" "' + Aircon3_Power.state.toString + '" "' + Aircon3_Temperature.state.toString + '" "' + Aircon3_Mode.state.toString + '" "' + Aircon3_FanSpeed.state + '" "' + Aircon3_AirSwingHorizontal.state.toString + '" "' + Aircon3_AirSwingVertical.state.toString + '" "' + Aircon3_EcoMode.state.toString + '"')
executeCommandLine("sudo@@python3@@/etc/openhab2/scripts/airconditioner.py@@set@@" + Aircon3_Power.state.toString + "@@" + Aircon3_Temperature.state.toString + "@@" + Aircon3_Mode.state.toString + "@@" + Aircon3_FanSpeed.state + "@@" + Aircon3_AirSwingHorizontal.state.toString + "@@" + Aircon3_AirSwingVertical.state.toString + "@@" + Aircon3_EcoMode.state.toString + "@@1", 2000)
if (Aircon3_Power.state == OFF){
sendCommand(Aircon3_Status, "OFF")
} else {
postUpdate(Aircon3_Status, Aircon3_Mode.state)
}
end
sitemaps/your.sitemap
Frame label="Air Conditioners" {
Group item=Aircon1_Status icon="heating" label="Lounge Room [%s]"{
Switch item=Aircon_Update label="Get Update"
Text item=Aircon1_Status label="Status [%s]"
Switch item=Aircon1_Power label="Power [%s]"
Selection item=Aircon1_Mode label="Mode [%s]" mappings=[Auto="Auto", Cool="Cool", Heat="Heat", Dry="Dry", Fan="Fan"]
Setpoint item=Aircon1_Temperature label="Temp Set [%.2f Ā°C]" minValue=16 maxValue=30 step=0.5
Switch item=Aircon1_EcoMode label="Eco Mode" mappings=[Auto="Auto", Quite="Quiet", Powerful="Powerful"]
Switch item=Aircon1_FanSpeed label="Speed [%s]" mappings=[Auto="A", Low="1", LowMid="2", Mid="3", MidHigh="4", High="5"]
Selection item=Aircon1_AirSwingVertical label="Blade Vert [%s]" mappings=[Auto="Auto", Up="Top", UpMid="Mid Top", Mid="Middle", DownMid="Mid Bottom", Down="Bottom"]
Switch item=Aircon1_AirSwingVertical label="Vert" mappings=[Auto="Auto", Up="T", UpMid="MT", Mid="M", DownMid="MB", Down="B"]
Selection item=Aircon1_AirSwingHorizontal label="Blade Horiz [%s]" mappings=[Auto="Auto", Left="Left", LeftMid="Left Center", Mid="Center", RightMid="Right Center", Right="Right"]
Switch item=Aircon1_AirSwingHorizontal label="Horiz" mappings=[Auto="Auto", Left="L", LeftMid="LC", Mid="C", RightMid="RC", Right="R"]
Text item=Aircon1_LastUpdate label="Updated [%1$ta %1$td %1$tb %1$tY %1$tR]"
}
Group item=Aircon2_Status icon="heating" label="Jai's [%s]" {
Switch item=Aircon_Update label="Get Update"
Text item=Aircon2_Status label="Status [%s]"
Switch item=Aircon2_Power label="Power [%s]"
Selection item=Aircon2_Mode label="Mode [%s]" mappings=[Auto="Auto", Cool="Cool", Heat="Heat", Dry="Dry", Fan="Fan"]
Setpoint item=Aircon2_Temperature label="Temp Set [%.2f Ā°C]" minValue=16 maxValue=30 step=0.5
Switch item=Aircon2_EcoMode label="Eco Mode" mappings=[Auto="Auto", Quite="Quiet", Powerful="Powerful"]
Switch item=Aircon2_FanSpeed label="Speed [%s]" mappings=[Auto="A", Low="1", LowMid="2", Mid="3", MidHigh="4", High="5"]
Selection item=Aircon2_AirSwingVertical label="Blade Vert [%s]" mappings=[Auto="Auto", Up="Top", UpMid="Mid Top", Mid="Middle", DownMid="Mid Bottom", Down="Bottom"]
Switch item=Aircon2_AirSwingVertical label="Vert" mappings=[Auto="Auto", Up="T", UpMid="MT", Mid="M", DownMid="MB", Down="B"]
Selection item=Aircon2_AirSwingHorizontal label="Blade Horiz [%s]" mappings=[Auto="Auto", Left="Left", LeftMid="Left Center", Mid="Center", RightMid="Right Center", Right="Right"]
Switch item=Aircon2_AirSwingHorizontal label="Horiz" mappings=[Auto="Auto", Left="L", LeftMid="LC", Mid="C", RightMid="RC", Right="R"]
Text item=Aircon2_LastUpdate label="Updated [%1$ta %1$td %1$tb %1$tY %1$tR]"
}
Group item=Aircon3_Status icon="heating" label="Chantelle's [%s]"{
Switch item=Aircon_Update label="Get Update"
Text item=Aircon3_Status label="Status [%s]"
Switch item=Aircon3_Power label="Power [%s]"
Selection item=Aircon3_Mode label="Mode [%s]" mappings=[Auto="Auto", Cool="Cool", Heat="Heat", Dry="Dry", Fan="Fan"]
Setpoint item=Aircon3_Temperature label="Temp Set [%.2f Ā°C]" minValue=16 maxValue=30 step=0.5
Switch item=Aircon3_EcoMode label="Eco Mode" mappings=[Auto="Auto", Quite="Quiet", Powerful="Powerful"]
Switch item=Aircon3_FanSpeed label="Speed [%s]" mappings=[Auto="A", Low="1", LowMid="2", Mid="3", MidHigh="4", High="5"]
Selection item=Aircon3_AirSwingVertical label="Blade Vert [%s]" mappings=[Auto="Auto", Up="Top", UpMid="Mid Top", Mid="Middle", DownMid="Mid Bottom", Down="Bottom"]
Switch item=Aircon3_AirSwingVertical label="Vert" mappings=[Auto="Auto", Up="T", UpMid="MT", Mid="M", DownMid="MB", Down="B"]
Selection item=Aircon3_AirSwingHorizontal label="Blade Horiz [%s]" mappings=[Auto="Auto", Left="Left", LeftMid="Left Center", Mid="Center", RightMid="Right Center", Right="Right"]
Switch item=Aircon3_AirSwingHorizontal label="Horiz" mappings=[Auto="Auto", Left="L", LeftMid="LC", Mid="C", RightMid="RC", Right="R"]
Text item=Aircon3_LastUpdate label="Updated [%1$ta %1$td %1$tb %1$tY %1$tR]"
}
Switch item=Aircon_Update label="Get Update"
}
Hi before I start fiddling with it,
would this script work with OH3?
I donāt see why not as the script posts values directly so unless thereās been a big change in that area it should be fine.
Iāll run up an install of OH this weekend and see what happens with the script as well in case you get stuck, plus Iāll see whatās new in OH3 as well.
Hello Jai, do you have test the script already with OH3 ? It doesnĀ“t work in my setup. Best regards. Martin
Hi Martin,
Sorry, Iāve been away. I have setup an OH3 instance & will install the Pana setup this weekend to see how it goes & post the results back here.
Hi Martin,
Yes there appears to be some migration issues with the rules themselves. The panasonic script & pcomfortcloud work as expected but when I run the update switch I get the following error.
2021-04-18 10:06:16.927 [WARN ] [persistence.jdbc.internal.JdbcMapper] - JDBC::openConnection: no driver available!
2021-04-18 10:06:16.928 [WARN ] [persistence.jdbc.internal.JdbcMapper] - JDBC::openConnection: no driver available!
2021-04-18 10:06:16.928 [WARN ] [jdbc.internal.JdbcPersistenceService] - JDBC::store: No connection to database. Cannot persist item 'Aircon_Update (Type=SwitchItem, State=ON, Label=Aircon Status, Category=switch)'! Will retry connecting to database when error count:0 equals errReconnectThreshold:0
Iāll keep investigating and let you know what I find.
Hi, yes the script ist working and the āgetā commands fills the items. The executecommandline has changed in OH3.This Version works in my Rule to get the status.
rule āAirCon Manual Status Updateā
when
Item Aircon_Update changed to ON
then
executeCommandLine(Duration.ofSeconds(20),āpython3ā,"/etc/openhab/scripts/airconditioner.py",āStatusā)
end
Only the āsetā commandos doesnĀ“t work in the Rule
Thank you for your support. I hope you find a solution.
Hi! I tried you script using OH3 and it seems to read the values, but I get error logs like āui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item āAircon3_LastUpdateā for widget org.openhab.core.model.sitemap.sitemap.Textā I donāt know what does it mean Thank you for your effort and I hope that you can find how to migrate this great script to OH3.
I see that the error is about the sitemap. Do you get this error when you are viewing a certain page in your sitemap? It might be a that your sitemap wants to display an item that doesnāt exist.
You are right, it comes when i visit the sitemap and view aircon2 or 3. I donāt get this error for aircon1. Iāll have to look deeper.
You say that you read the values. It is possible to control the aircon1 or write the values? When it works can you Show me your OH3 rules? Thank you
Hi! Iāve updated the examples rules for OH3. With this new code reading and controlling the units is working for me, I hope it helps someone.
rule "AirConditioner Status Update"
when
Time cron "0 0/10 * * * ?"
then
executeCommandLine(Duration.ofSeconds(20),"python3","/etc/openhab/scripts/airconditioner.py","Status")
end
rule "AirCon Manual Status Update"
when
Item Aircon_Update changed to ON
then
executeCommandLine(Duration.ofSeconds(20),"python3","/etc/openhab/scripts/airconditioner.py","Status")
end
rule "AirConditioner Status"
when
Item Aircon1_Power received update
then
sendCommand(Aircon_Update, OFF)
end
rule "AirCon1 Set"
when
Item Aircon1_Power changed or
Item Aircon1_Mode changed or
Item Aircon1_EcoNavi changed or
Item Aircon1_EcoMode changed or
Item Aircon1_Temperature changed or
Item Aircon1_FanSpeed changed or
Item Aircon1_AirSwingVertical changed or
Item Aircon1_AirSwingHorizontal changed
then
logInfo("AirConditioner Set", '/etc/openhab/scripts/airconditioner.py "set" "' + Aircon1_Power.state.toString + '" "' + Aircon1_Temperature.state.toString + '" "' + Aircon1_Mode.state.toString + '" "' + Aircon1_FanSpeed.state + '" "' + Aircon1_AirSwingHorizontal.state.toString + '" "' + Aircon1_AirSwingVertical.state.toString + '" "' + Aircon1_EcoMode.state.toString + '"')
executeCommandLine(Duration.ofSeconds(20),"python3","/etc/openhab/scripts/airconditioner.py","set",Aircon1_Power.state.toString,Aircon1_Temperature.state.toString,Aircon1_Mode.state.toString,Aircon1_FanSpeed.state.toString(),Aircon1_AirSwingHorizontal.state.toString, Aircon1_AirSwingVertical.state.toString,Aircon1_EcoMode.state.toString,"0")
if (Aircon1_Power.state == OFF){
sendCommand(Aircon1_Status, "OFF")
} else {
postUpdate(Aircon1_Status, Aircon1_Mode.state)
}
end
rule "AirCon2 Set"
when
Item Aircon2_Power changed or
Item Aircon2_Mode changed or
Item Aircon2_EcoNavi changed or
Item Aircon2_EcoMode changed or
Item Aircon2_Temperature changed or
Item Aircon2_FanSpeed changed or
Item Aircon2_AirSwingVertical changed or
Item Aircon2_AirSwingHorizontal changed
then
logInfo("AirConditioner Set", '/etc/openhab/scripts/airconditioner.py "set" "' + Aircon2_Power.state.toString + '" "' + Aircon2_Temperature.state.toString + '" "' + Aircon2_Mode.state.toString + '" "' + Aircon2_FanSpeed.state + '" "' + Aircon2_AirSwingHorizontal.state.toString + '" "' + Aircon2_AirSwingVertical.state.toString + '" "' + Aircon2_EcoMode.state.toString + '"')
executeCommandLine(Duration.ofSeconds(20),"python3","/etc/openhab/scripts/airconditioner.py","set",Aircon2_Power.state.toString,Aircon2_Temperature.state.toString,Aircon2_Mode.state.toString,Aircon2_FanSpeed.state.toString(),Aircon2_AirSwingHorizontal.state.toString, Aircon2_AirSwingVertical.state.toString,Aircon2_EcoMode.state.toString,"1")
if (Aircon2_Power.state == OFF){
sendCommand(Aircon2_Status, "OFF")
} else {
postUpdate(Aircon2_Status, Aircon2_Mode.state)
}
end
rule "AirCon3 Set"
when
Item Aircon3_Power changed or
Item Aircon3_Mode changed or
Item Aircon3_EcoNavi changed or
Item Aircon3_EcoMode changed or
Item Aircon3_Temperature changed or
Item Aircon3_FanSpeed changed or
Item Aircon3_AirSwingVertical changed or
Item Aircon3_AirSwingHorizontal changed
then
logInfo("AirConditioner Set", '/etc/openhab/scripts/airconditioner.py "set" "' + Aircon3_Power.state.toString + '" "' + Aircon3_Temperature.state.toString + '" "' + Aircon3_Mode.state.toString + '" "' + Aircon3_FanSpeed.state + '" "' + Aircon3_AirSwingHorizontal.state.toString + '" "' + Aircon3_AirSwingVertical.state.toString + '" "' + Aircon3_EcoMode.state.toString + '"')
executeCommandLine(Duration.ofSeconds(20), "python3", "/etc/openhab/scripts/airconditioner.py", "set", Aircon3_Power.state.toString(), Aircon3_Temperature.state.toString(), Aircon3_Mode.state.toString(), Aircon3_FanSpeed.state.toString(), Aircon3_AirSwingHorizontal.state.toString(), Aircon3_AirSwingVertical.state.toString(), Aircon3_EcoMode.state.toString, "2")
if (Aircon3_Power.state == OFF){
sendCommand(Aircon3_Status, "OFF")
} else {
postUpdate(Aircon3_Status, Aircon3_Mode.state)
}
end
Did anyone of you try the C# code? (GitHub - bacobart/aircocontroller: Control panasonic comfort cloud ac's)
I am asking because I also own such an air conditioner and I would rather prefer a real binding instead of some scripts. So I though that I could write a binding. So far, there is no-one writing one, right?
Since bindings are written in Java, it is far easier to transfer existing logic from C# to Java than from Python to Javaā¦
Update: maybe the binding should be based on the python script because itās definitely up-to-date. At least according to this threadā¦
Native binding, still WIP but available for testing here; https://github.com/seime/openhab2-addons/releases/tag/panasonic_wip_1
Please note that I only have a single model to test with, and apparently it is not the most fancy one with all the iAutoX and nanoe whistles. So some channels are missing or read only as I cannot test them.
When you find a bug or a missing feature, please adjust the logging level to DEBUG, mask any sensitive details and post the log along with details describing the problem.