Daikin integration

All kinds of 'OS' scripts

Moderator: leecollings

robhuls
Posts: 29
Joined: Monday 23 March 2015 19:20
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Zwolle
Contact:

Re: Daikin integration

Post by robhuls »

I think the problem is in the first part of the script. If otherdevices['DaikinMode'] == 'Off' then the parameter mode is not set. The mode is irrelevant when it is off, but in the curl command I concatenate mode to the command. I think the solution is to add the following two lines between 'mode = 2' and 'end'

elseif (otherdevices['DaikinMode'] == 'Off') then
mode = 0

Strangely enough, it has always and still works without problems here.
videodrome
Posts: 64
Joined: Wednesday 11 May 2016 16:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Daikin integration

Post by videodrome »

robhuls wrote:I think the problem is in the first part of the script. If otherdevices['DaikinMode'] == 'Off' then the parameter mode is not set. The mode is irrelevant when it is off, but in the curl command I concatenate mode to the command. I think the solution is to add the following two lines between 'mode = 2' and 'end'

elseif (otherdevices['DaikinMode'] == 'Off') then
mode = 0

Strangely enough, it has always and still works without problems here.
The script works fine now, thanx.
I need also to check if daikinmode changed status (eg. if it's switched on/off by the app), is it possibile to update every minutes the status?
robhuls
Posts: 29
Joined: Monday 23 March 2015 19:20
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Zwolle
Contact:

Re: Daikin integration

Post by robhuls »

I used to have a cronjob that updated the status but I no longer have it. I think that it sometimes led to unpredictable behavior, the cronjob switching the unit off when I just put it on.
User avatar
tcviper
Posts: 89
Joined: Monday 30 June 2014 13:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Daikin integration

Post by tcviper »

As pointed here: https://www.domoticz.com/wiki/Daikin_wi ... in_support

I installed Daikin with the right iP and the hardware add which works. However, I then try to add the LUA script to control the daikin but I keep getting this, any idea (Synology):?

2017-09-02 13:41:03.970 Error: EventSystem: in /usr/local/domoticz/var/scripts/dzVents/runtime/dzVents.lua: cannot open /usr/local/domoticz/var/scripts/dzVents/runtime/dzVents.lua: No such file or directory

and
2017-09-02 13:46:00.070 Error: EventSystem: in Daikin: [string "commandArray = {}..."]:2: attempt to index global 'devicechanged' (a nil value)
2017-09-02 13:46:00.090 Error: EventSystem: in Daikin2: [string "commandArray = {}..."]:18: attempt to concatenate field '?' (a nil value)

Running Domoticz 3.8153 on Synology NAS from http://www.jadahl.com/domoticz_stable_6.1/
mircodf84
Posts: 2
Joined: Monday 02 October 2017 21:06
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Daikin integration

Post by mircodf84 »

Hi,

I have a Raspberry PI 3 with Domoticz 3.8153 installed. I tried to control a unit Daikin FTXM-35M with BRP069A41 by Domoticz. I used the LUA scrips as shown in this post "https://www.domoticz.com/wiki/Daikin_wi ... in_support"

My Domoticz seem read properly the status of unit (mode, fan e temperture set) but it don't control. If i try to set the unit, Domoticz goes offline and i need to restart the raspberry.

Can someone help me please?
mattia81
Posts: 8
Joined: Friday 01 September 2017 11:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Daikin integration

Post by mattia81 »

@mircodf84 I have the same problem. Read OK but not control...
darkogorgievski
Posts: 7
Joined: Sunday 08 October 2017 10:17
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Daikin integration

Post by darkogorgievski »

Guys,

One question, what is the best approach if I have more than one unit (I have 9 Daikin units mounted with Wifi controllers).
Do I create script for each device or combine everything in one script?

Additionally did anyone implement the setpoint update if the settings are modified from the app/remote controller?

Thanks
darkogorgievski
Posts: 7
Joined: Sunday 08 October 2017 10:17
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Daikin integration

Post by darkogorgievski »

Hi
Happy new year

I am struggling with this one a bit
I was busy with setting up the python script as described in the wiki, but it doesnt work for me. As I understand, the script was made for using python 2.7 so I tried to modify the code for use with python 3 but I cant get it right. Can somebody have look and point me what am I doing wrong?

I have 9 Daikin Wifi modules but I was testing with one. I created the dummy variables as required in the Daikin Wifi Wiki:

55 DaikinDummy 00014087 1 DaikinHeatLena Light/Switch Switch
56 DaikinDummy 00014088 1 DaikinModeLena Light/Switch Selector Switch Off
57 DaikinDummy 00014089 1 DaikinFrateLena Light/Switch Selector Switch Off
59 DaikinDummy 0001408B 1 DaikinQuietLena Light/Switch Switch Off
84 DaikinDummy 00140A4 1 DaikinSetTargetLena Thermostat SetPoint

I have created LUA script and saved it in /home/pi/domoticz/scripts/lua with code as follows:

Code: Select all

commandArray = {}
if(devicechanged['DaikinCoolLena']) or (devicechanged['DaikinTempLena']) or (devicechanged['DaikinHeatLena']) or (devicechanged['DaikinQuietLena']) then
    os.execute('python2.7 /home/pi/domoticz/scripts/daikinLena.py&')
    print(printPrefix .. 'DaikinLena: ' .. 'DaikinCoolLena'   .. DaikinCoolLena .. 'DaikinTempLena' .. DaikinTempLena .. 'DaikinHeatLena' .. DaikinHeatLena .. 'DaikinQuietLena' .. DaikinQuietLena)
    print('Lena')
    else
    print('Else Lena')
end
return commandArray
So when I modify the setpoint I can see that the code doesn't enter the If -then line but goes directly in the else part of the code. My Domoticsz log has the following line:

LUA: Else Lena

Somehow the devicechanged doesn't trigger correctly.

Additionally I played with the python script including changing the os.execute('python ... to os.execute('python2.7 but still no effect ( I read that there were some changes in urllib2 in python3°

My python script code is as follows:

Code: Select all

import json
#import urllib2
from urllib.request import urlopen

daikin_ip = '192.168.1.244'  # IP address of the Daikin
dom_ip =  '192.168.1.223' # IP address of Domoticz
dom_names = {'heat': 55, 'cool': 77, 'quiet': 59, 'setpoint': 84}

print(dom_settings)

# Retrieve the domoticz state
dom_settings = {}
for dom_name, dom_idx in dom_names.items():
    #data = urllib2.urlopen("http://{0}:8080/json.htm?type=devices&rid={1}".format(dom_ip, dom_idx)).read()
    data = urlopen("http://{0}:8080/json.htm?type=devices&rid={1}".format(dom_ip, dom_idx)).read()
    data_dict = json.loads(data)  # Convert json string to python dictionary
    dom_settings[dom_name] = data_dict['result'][0]['Data']

# Create the correct settings for Daikin
print(dom_settings)
daikin_power = 1
daikin_mode = 0
if 'On' in dom_settings['cool'] and 'Off' in dom_settings['heat']:
    daikin_mode = 3 # Cool
elif 'Off' in dom_settings['cool'] and 'On' in dom_settings['heat']:
    daikin_mode = 4 # Heat
elif 'On' in dom_settings['cool'] and 'On' in dom_settings['heat']:
    daikin_mode = 0 # Auto
else:
    daikin_power = 0
daikin_setpoint = dom_settings['setpoint']
daikin_f_rate = 'B' if 'On' in dom_settings['quiet'] else 'A' # B=quiet mode, A=auto mode

# Provide the setings to the Daikin
urlopen("http://{0}/aircon/set_control_info?pow={1}&mode={2}&stemp={3}&shum=0&f_rate={4}&f_dir=0".format(daikin_ip, daikin_power, daikin_mode, daikin_setpoint, daikin_f_rate))
#urllib2.urlopen("http://{0}/aircon/set_control_info?pow={1}&mode={2}&stemp={3}&shum=0&f_rate={4}&f_dir=0".format(daikin_ip, daikin_power, daikin_mode, daikin_setpoint, daikin_f_rate))
print('Set Daikin to {0} and temperature {1} and mode to {2} and f_rate to {3}'.format(daikin_power, daikin_setpoint, daikin_mode, daikin_f_rate))
When I run the above script in Thonny debugger, the code halts on line 14 with the following message:
(data_dict = json.loads(data) # Convert json string to python dictionary)
the JSON object must be str, not 'bytes'
>>>
spiderjn
Posts: 22
Joined: Wednesday 27 December 2017 13:37
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8834
Contact:

Re: Daikin integration

Post by spiderjn »

hi all, happy new year !!

i made change on hardware "daikin controler", now i can set target temperature, but i search documentation or help to inprove/finalize this module.
i post on an other threads : https://www.domoticz.com/forum/viewtopi ... 09b2dccaf5

for updated parameter you need to call with atleast 6 mandatory parameters( https://github.com/ael-code/daikin-control)

http://X.X.X.X/aircon/set_control_info? ... 8.0&shum=0

Best regards
darkogorgievski
Posts: 7
Joined: Sunday 08 October 2017 10:17
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Daikin integration

Post by darkogorgievski »

Hi spiderjn,

If I understand you correctly, I should discard the python scripts mentioned int he daikin Wifi Wiki and only send http command directly to the airco.
Can you please post the example on how do you call the command from domoticz?

As I mentioned in my previous message if I use devicechanged, it is somehow not triggering the action:


if(devicechanged['DaikinCoolLena']) or (devicechanged['DaikinTempLena']) or (devicechanged['DaikinHeatLena']) or (devicechanged['DaikinQuietLena']) then
os.execute('python2.7 /home/pi/domoticz/scripts/daikinLena.py&')
print('Lena')
else
print('Else Lena')
end

So when I modify the setpoint I can see that the code doesn't enter the If -then line but goes directly in the else part of the code. My Domoticsz log has the following line:

LUA: Else Lena
spiderjn
Posts: 22
Joined: Wednesday 27 December 2017 13:37
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8834
Contact:

Re: Daikin integration

Post by spiderjn »

Hi

yes i "just" implement function WriteToHardware in Daikin.cpp, in the original source this part of code is in "comment".

And now i search more information to improve this hardware module, cause i've 4 Daikin wifi contoler and i prefer to manage them with "standard" componment.


Best Regards
User avatar
remb0
Posts: 499
Joined: Thursday 11 July 2013 22:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Daikin integration

Post by remb0 »

are you pushing it to github??
that would be great!
spiderjn
Posts: 22
Joined: Wednesday 27 December 2017 13:37
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8834
Contact:

Re: Daikin integration

Post by spiderjn »

Hi remb0,

before push it, i want continue a little to implement somes functions, i search how to add new device for this hardware ..

Best regards
darkogorgievski
Posts: 7
Joined: Sunday 08 October 2017 10:17
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Daikin integration

Post by darkogorgievski »

Hi
I checked my domoticz installation, but I dont have any cpp files in it.
Where do I find (or can I download) the Daikin C++ file?
Do I need to install some other dependances?

I have more/less the standard latest released version of Domoticz for raspbian

Greetings
spiderjn
Posts: 22
Joined: Wednesday 27 December 2017 13:37
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8834
Contact:

Re: Daikin integration

Post by spiderjn »

Hi,

Daikin.Cpp is only in source (C++ file) , you can see ti in GitHub :

https://github.com/domoticz/domoticz/bl ... Daikin.cpp

i want share with this forum the device list and type, we need for integrate Daikin Wifi inside Domoticz installation ?

Best regards
darkogorgievski
Posts: 7
Joined: Sunday 08 October 2017 10:17
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Daikin integration

Post by darkogorgievski »

Thanks,

I googled yesterday but it didn't return the github

I will give it a try this evening.
I have very basic programming skills but I am prepared to do some testing if needed.
I have 9 indoor units with wifi at home so I am quite interested in integrating it with Domotics or Smartthings. Currently I run some IFTTT rules but they are bit limited in what I want to do

Greetings
spiderjn
Posts: 22
Joined: Wednesday 27 December 2017 13:37
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8834
Contact:

Re: Daikin integration

Post by spiderjn »

hi
i just finish an update to daikin hardware module, next step is to check on unix compiler and have help to publish my contribution (and code review cause it my first c++ code, lol)
mircodf84
Posts: 2
Joined: Monday 02 October 2017 21:06
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Daikin integration

Post by mircodf84 »

Hi spiderjn, i have seen your post https://github.com/domoticz/domoticz/pull/2044. How can i update my domoticz v3.8153?
spiderjn
Posts: 22
Joined: Wednesday 27 December 2017 13:37
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8834
Contact:

Re: Daikin integration

Post by spiderjn »

HI,
i think you can get source from GIT, apply my pull, then complie, and test !!
Best regards
spiderjn
Posts: 22
Joined: Wednesday 27 December 2017 13:37
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8834
Contact:

Re: Daikin integration

Post by spiderjn »

Hi,

my pull request has been approved and commit in developpement branch.

in next beta you can see new device and new command.

Have fun.
Attachments
Image20180107282.png
Image20180107282.png (61.14 KiB) Viewed 4675 times
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest