This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Daikin AC control via WiFi online controller
#15
(11.07.2016, 08:21)jetsetter Wrote: Thank you Edgars so much for your help!

Following your example with some modifications, I am now capable to read full info from the AC controller (mode, compressor frequency, outdoor temp, indoor temp, fan speed, wings mode, power consumption etc) as well as control it to power on/off and change it's temperature setpoint! 

This has open my appetite for more things to do.... Next I will try to create a complete AC widget so I can monitor and control all other parameters as well, like fan speed, fan direction, operation mode etc. (I will need relative icons though as it seems there aren't any). Talking about widgets, what happen to the Mosaic visualization? Will it continue its development (there isn't any similar widget to control AC for example)? Has it been upgraded in the upcoming release? And talking about firmware Shy , where can I find the latest beta and when the final release will be ready? 

I am quoting below the rest of the code I used (function parse(txt) from previous post has been created as a user library) if anyone else want to use it.

Resident script to read sensors and operational status:
Code:
ip = '192.168.1.1' -- Daikin WiFi controller IP
http = require('socket.http')
ACON = grp.getvalue('ACON/OFF')
ACpow, ACmode, ACstemp, ACshum, ACfdir = 0
ACfrate=''

----------------------------------------------------------
url = 'http://' .. ip .. '/aircon/get_sensor_info?'
result, err = http.request(url)
if result then
data = parse(result)
grp.update('outtemp', tonumber(data.otemp), dt.float16, 1)
grp.update('intemp', tonumber(data.htemp), dt.float16, 1)
grp.update('compressorfreq', tonumber(data.cmpfreq))
else
 alert('HTTP request failed: ' .. tostring(err))
end
----------------------------------------------------------
url = 'http://' .. ip .. '/aircon/get_control_info?'  
result, err = http.request(url)
if result then
 data = parse(result)
 ACpow = tonumber(data.pow)
 ACmode = tonumber(data.mode)
 ACstemp = tonumber(data.stemp)
 ACfrate = data.f_rate
 ACfdir = tonumber(data.f_dir)
 grp.update('ACpower', ACpow)
 grp.update('ACsetpoint', ACstemp, dt.float16, 1)
 grp.update('ACopmode', ACmode)
 grp.update('ACfandir', ACfdir)
 grp.update('ACfanrate', ACfrate)
else
 alert('HTTP request failed: ' .. tostring(err))
end

Event-based script to power on/off:

Code:
ACIO = event.getvalue()
ip = '192.168.1.1'
http = require('socket.http')
ACpow = tostring(grp.getvalue('ACpower'))
ACmode = tostring(grp.getvalue('ACopmode'))
ACstemp = grp.getvalue('ACsetpoint')
ACfdir = tostring(grp.getvalue('ACfandir'))
ACfrate = grp.getvalue('ACfanrate')

if ACIO then ACpow = 1 else ACpow = 0 end

 url = 'http://' .. ip .. '/aircon/set_control_info?pow=' .. ACpow ..'&mode=' .. ACmode .. '&stemp=' .. ACstemp ..'&shum=0&frate=' .. ACfrate .. '&fdir=' .. ACfdir
 result, err = http.request(url)
  if result then
   log(url)
  else
   alert('HTTP request failed: ' .. tostring(err))
  end
 
Event-based script to change temperature:

Code:
setpoint = event.getvalue()
ip = '192.168.1.1'
http = require('socket.http')
ACpow = tostring(grp.getvalue('ACpower'))
ACmode = tostring(grp.getvalue('ACopmode'))
ACstemp = grp.getvalue('ACsetpoint')
ACstempNEW = tostring(setpoint)
ACfdir = tostring(grp.getvalue('ACfandir'))
ACfrate = grp.getvalue('ACfanrate')

url = 'http://' .. ip .. '/aircon/set_control_info?pow=' .. ACpow ..'&mode=' .. ACmode .. '&stemp=' .. ACstempNEW ..'&shum=0&frate=' .. ACfrate .. '&fdir=' .. ACfdir
result, err = http.request(url)
if result then
 log(url)
 else
   alert('HTTP request failed: ' .. tostring(err))
 end
Scheduled script (every 15 mins) for gathering hourly consumption:
Code:
local chunks, i, value
ip = '192.168.1.1'
http = require('socket.http')
url = 'http://' .. ip .. '/aircon/get_day_power_ex?'

result, err = http.request(url)
if result then
 data = parse(result)
 chunks = data.curr_day_cool:split('/')
 i = os.date("*t").hour
 value = tonumber(chunks[i])
 grp.update('ACkWh', value/10 , dt.float16, 1)
else
  alert('HTTP request failed: ' .. tostring(err))
end

I will use these scripts to control en read my airco.
i can control my airco on multiple ways like IR remote or app or LM.
My question is.
Is it possible to just sent one of the value's (the value i will change)?
like just turn on/off, or change temperature?
I tried but the ways i tried didnt work.


or do i need to look at another way for doing this?
Like read the values (except the value i will change) and sent a new comment with all the value's?
Reply


Messages In This Thread
RE: Daikin AC control via WiFi online controller - by Dré - 01.02.2022, 18:27

Forum Jump: