Lots of edits as tired, but hope this helps....(shout if I've not explained it too well as had about 3 hours sleep.
Not sure if this is any help (and its apple-script) but i use this with my dakin. Just create 4 variables, and run the following applescript when any of the variables changes - you can then control the variables from a control page - This is one of two outstanding plugins I need to write, but its been 18 months so far and not enough time.
Copy the following, or use your python in an action group. call it say "change AC settings".
Then set up four triggers for your 4 variables - trigger on a variable change, and your "action" is to run the action group "change AC settings"
Set up a control page so that you can set the four variables separately. ie press button "cool mode" and the variable "mode" is changed to integer "3". The trigger will then run either your python or my applescript and will set the ac.
Repeat for the other 4 modes, 3 fan direction and temperature you want, each time running the same action group.
You can do the same script to switch it off with "pow" in the url = 0
Any other changes to the variables will switch the unit on.
- Code: Select all
set mode to value of variable "Gymaircon_mode"
set temp to value of variable "Gymaircon_temp"
set fan to value of variable "Gymaircon_fandir"
set fanspeed to value of variable "Gymaircon_fan"
set theURL to "http://xxx.xxx.xxx.xxx/aircon/set_control_info?pow=1&mode=" & mode & "&stemp=" & temp & "&shum=0&f_rate=" & fanspeed & "&f_dir=" & fan
do shell script "curl " & quoted form of theURL
Mode 2 is dehumidify
Mode 3 is cool
Mode 4 is heat
Mode 6 is fan
Mode 0-1-7 is auto
Fan speed is 3 to 7 (there may be lower but I don't use them
Fan direction is
1 = horizontal
2= vertical
3= both directions
pow in the url is 0 for off and 1 for on
The following gets the states (python). I have this in a schedule that runs every minute and updates a variable to tell me if the AC is on or off. You will need to create a variable referenced at the end of the script and change the id:
- Code: Select all
#get data in HTMl Response from Daikin HVAC
import urllib2
urlReturned = urllib2.urlopen('http://xxx.xxx.xxx.xxx/aircon/get_control_info')
data_getStatus = urlReturned.read()
#transform HTMl Response in JSON format
# Split the result into bits
split_response = data_getStatus.split(',')
# Split the bits into variable/value pairs
new_list = []
for element in split_response:
new_list.append(element.split('='))
# Convert the variable/value pairs into something json-y
new_dict = {}
for element in new_list:
new_dict[element[0]] = element[1]
#get new json string variables to python variables
pow=str(new_dict['pow'])
#update indigo variables
indigo.variable.updateValue(493056778, ((pow)))
This is probably very similar to the above, but gets the current inside and outside temps(python. Put this in a schedule and run it every few minutes). You will need to create two variables referenced at the bottom of the script to hold the two temperatures, and amend the variable id's at the bottom of the script:
- Code: Select all
#get data in HTMl Response from Daikin HVAC
import urllib2
urlReturned = urllib2.urlopen('http://xxx.xxx.xxx.xxx/aircon/get_sensor_info')
data_getStatus = urlReturned.read()
#transform HTMl Response in JSON format
# Split the result into bits
split_response = data_getStatus.split(',')
# Split the bits into variable/value pairs
new_list = []
for element in split_response:
new_list.append(element.split('='))
# Convert the variable/value pairs into something json-y
new_dict = {}
for element in new_list:
new_dict[element[0]] = element[1]
#get new json string variables to python variables
htemp=str(new_dict['htemp'])
otemp=str(new_dict['otemp'])
#update indigo variables
indigo.variable.updateValue(75127650, ((htemp)))
indigo.variable.updateValue(194583233, ((otemp)))