error changing settings.

agame
Posts: 514
Joined: Thu Jul 13, 2017 10:29 pm
Location: Melbourne, Australia

error changing settings.

Post by agame »

Hi, I've been using some scripts to control a Daikin but thought i would give the plugin a go, in order to publish a device to HomeKit.

The plugin can correctly read all settings and ambient temperature, however any attempt to alter settings generates an error:

Code: Select all

actionValue : 0.0
configured : True
delayAmount : 900
description : set mode of thermostat to all off
deviceId : 26784696
replaceExisting : True
textToSpeak : 
thermostatAction : SetHvacMode
   Daikin Wifi Controller          0
   Daikin Wifi Controller          off
   Daikin Wifi Controller Debug    action string is off
   Daikin Wifi Controller Debug    http://192.168.1.111/aircon/set_control_info?pow=0&mode=4&stemp=24.0&shum=0&f_rate=5&f_dir=3
   Daikin Wifi Controller Error    Unknown/Other Error setting /aircon/set_control_info?pow=0&mode=4&stemp=24.0&shum=0&f_rate=5&f_dir=3 from Daikin Unit daikin - new plugin
   Daikin Wifi Controller Debug    Error is HTTPConnectionPool(host='192.168.1.111', port=80): Read timed out. (read timeout=2)
   Daikin Wifi Controller Error    send "daikin - new plugin" mode change to off failed
   Daikin Wifi Controller Debug    [['ret', 'OK'], ['pow', '1'], ['mode', '4'], ['adv', ''], ['stemp', '24.0'], ['shum', '0'], ['dt1', '25.0'], ['dt2', 'M'], ['dt3', '27.0'], ['dt4', '24.0'], ['dt5', '24.0'], ['dt7', '25.0'], ['dh1', 'AUTO'], ['dh2', '0'], ['dh3', '0'], ['dh4', '0'], ['dh5', '0'], ['dh7', 'AUTO'], ['dhh', '50'], ['b_mode', '4'], ['b_stemp', '24.0'], ['b_shum', '0'], ['alert', '255'], ['f_rate', '5'], ['f_dir', '3'], ['b_f_rate', '5'], ['b_f_dir', '3'], ['dfr1', '5'], ['dfr2', '5'], ['dfr3', '5'], ['dfr4', '5'], ['dfr5', '5'], ['dfr6', '5'], ['dfr7', '5'], ['dfrh', '5'], ['dfd1', '0'], ['dfd2', '3'], ['dfd3', '3'], ['dfd4', '3'], ['dfd5', '3'], ['dfd6', '0'], ['dfd7', '0'], ['dfdh', '0'], ['ret', 'OK'], ['htemp', '24.0'], ['hhum', '-'], ['otemp', '11.0'], ['err', '0'], ['cmpfreq', '58']]
   Daikin Wifi Controller Debug    [['ret', 'OK'], ['pow', '1'], ['mode', '4'], ['adv', ''], ['stemp', '24.0'], ['shum', '0'], ['dt1', '25.0'], ['dt2', 'M'], ['dt3', '27.0'], ['dt4', '24.0'], ['dt5', '24.0'], ['dt7', '25.0'], ['dh1', 'AUTO'], ['dh2', '0'], ['dh3', '0'], ['dh4', '0'], ['dh5', '0'], ['dh7', 'AUTO'], ['dhh', '50'], ['b_mode', '4'], ['b_stemp', '24.0'], ['b_shum', '0'], ['alert', '255'], ['f_rate', '5'], ['f_dir', '3'], ['b_f_rate', '5'], ['b_f_dir', '3'], ['dfr1', '5'], ['dfr2', '5'], ['dfr3', '5'], ['dfr4', '5'], ['dfr5', '5'], ['dfr6', '5'], ['dfr7', '5'], ['dfrh', '5'], ['dfd1', '0'], ['dfd2', '3'], ['dfd3', '3'], ['dfd4', '3'], ['dfd5', '3'], ['dfd6', '0'], ['dfd7', '0'], ['dfdh', '0'], ['ret', 'OK'], ['htemp', '24.0'], ['hhum', '-'], ['otemp', '11.0'], ['err', '0'], ['cmpfreq', '58'], ['ret', 'OK'], ['curr_day_heat', '0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0'], ['prev_1day_heat', '0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0'], ['curr_day_cool', '0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0'], ['prev_1day_cool', '0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0'], ['ret', 'OK'], ['s_dayw', '3'], ['week_heat', '0/0/0/0/0/0/0/0/0/0/0/0/0/0'], ['week_cool', '0/0/0/0/0/0/0/0/0/0/0/0/0/0'], ['ret', 'OK'], ['curr_year_heat', '0/0/0/0/0/0/0/0/0/0/0/0'], ['prev_year_heat', '0/0/0/0/0/0/0/0/0/0/0/0'], ['curr_year_cool', '0/0/0/0/0/0/0/0/0/0/0/0'], ['prev_year_

The URL the plugin is generating looks identical to what my script uses....and as you can see there is an error reported: any idea what is happening?
neilk
Posts: 727
Joined: Mon Jul 13, 2015 1:51 pm
Location: Reading, UK

Re: error changing settings.

Post by neilk »

So if you post into a browser (or curl it from a script)

Code: Select all

http://192.168.1.111/aircon/set_control_info?pow=0&mode=4&stemp=24.0&shum=0&f_rate=5&f_dir=3
Everything works OK.

The read timeout error is strange as the controller IP must be correct as it is returning data from the updates.

Do you have any other network related issues or latency problems, on my unit it intermittently fails to respond to to a status request but only for one cycle and it self corrects. Do you ever see any errors in the log relating to that ?

If it really is a timeout issue then I can look to make quick and dirty change for you to test, and then make it configurable but this is really not much else to tweak.

If you want to share your scripts as well I can take a look and see if something is subtly different.

Thanks,
Neil
agame
Posts: 514
Joined: Thu Jul 13, 2017 10:29 pm
Location: Melbourne, Australia

Re: error changing settings.

Post by agame »

actually the url returns the the response

Code: Select all

ret=OK,adv=
and doesn't do anything.

here's the script I use to set commands. Much of it is about managing UI elements however you will see the URL generation.

Code: Select all

import requests

pow = indigo.variables[469667786].value # "upstairs_aircon_pow_target"
mode = indigo.variables[1560422268].value # "upstairs_aircon_mode_target"
stemp = indigo.variables[432309815].value # "upstairs_aircon_stemp_target"
f_rate = indigo.variables[1963800654].value # "upstairs_aircon_fanspeed_target"
f_dir = indigo.variables[1974389442].value # "upstairs_aircon_fandir_target"

##pow_actual = indigo.variables[1199721418].value # "upstairs_aircon_pow_actual"


indigo.server.log("mode is " + mode) 

##if pow_actual.value == False:

url = "http://192.168.1.111/aircon/set_control_info?pow=" + pow +"&mode=" + mode + "&stemp=" + stemp + "&shum=0" + "&f_rate=" + f_rate + "&f_dir=" + f_dir
requests.get(url)

indigo.server.log("updated upstairs daikin settings")


coolmodeIcon = indigo.variables[1194462574]. value # "upstairs_aircon_coolmode_state"
drymodeIcon = indigo.variables[1294622760]. value # "upstairs_aircon_drymode_state"
fanmodeIcon = indigo.variables[647775410]. value # "upstairs_aircon_fanmode_state"
heatmodeIcon = indigo.variables[586965895].value # "upstairs_aircon_heatmode_state"


if	mode  == '3':   #cool
	indigo.variable.updateValue(757312318, value='cool') #modetargettext
	indigo.variable.updateValue(1194462574, value='True') #cool icon
	indigo.variable.updateValue(1294622760, value='False') #dry icon
	indigo.variable.updateValue(647775410, value='False') #fan icon
	indigo.variable.updateValue(586965895, value='False') #heat icon
	

elif mode  == '4': #heat
	indigo.variable.updateValue(757312318, value='heat') #modetargettext
	indigo.variable.updateValue(1194462574, value='False') #cool icon
	indigo.variable.updateValue(1294622760, value='False') #dry icon
	indigo.variable.updateValue(647775410, value='False') #fan icon
	indigo.variable.updateValue(586965895, value='True') #heat icon

elif mode  == '2': #dry
	indigo.variable.updateValue(757312318, value='dry') #modetargettext
	indigo.variable.updateValue(1194462574, value='False') #cool icon
	indigo.variable.updateValue(1294622760, value='True') #dry icon
	indigo.variable.updateValue(647775410, value='False') #fan icon
	indigo.variable.updateValue(586965895, value='False') #heat icon

elif mode  == '6':  #fan
	indigo.variable.updateValue(757312318, value='fan') #modetargettext
	indigo.variable.updateValue(1194462574, value='False') #cool icon
	indigo.variable.updateValue(1294622760, value='False') #dry icon
	indigo.variable.updateValue(647775410, value='True') #fan icon
	indigo.variable.updateValue(586965895, value='False') #heat icon



else :
	indigo.server.log( "error setting hvac mode icons")
agame
Posts: 514
Joined: Thu Jul 13, 2017 10:29 pm
Location: Melbourne, Australia

Re: error changing settings.

Post by agame »

i've found what breaks it:. the plugin is passing the temp value with a decimal place. when i round to an integer, it works.


url generated by plugin

Code: Select all

http://192.168.1.111/aircon/set_control_info?pow=0&mode=4&stemp=24.0&shum=0&f_rate=5&f_dir=3
url generated by my script

Code: Select all

http://192.168.1.111/aircon/set_control_info?pow=0&mode=4&stemp=24&shum=0&f_rate=5&f_dir=3
neilk
Posts: 727
Joined: Mon Jul 13, 2015 1:51 pm
Location: Reading, UK

Re: error changing settings.

Post by neilk »

Thanks for the sleuthing. Which controller are you using ?

It looks like something for a specific device type, I am away for a few days but will test and look to a configurable fix for this if it is device specific

I checked the. API documentation and the call I use appear to be valid, but I will double check in testing.
agame
Posts: 514
Joined: Thu Jul 13, 2017 10:29 pm
Location: Melbourne, Australia

Re: error changing settings.

Post by agame »

i think the Daikin APIs are reverse engineered, and vary slightly by region,so the doco may not be reliable.
[Does anyone actually need a fraction-of-degree precision?!]

The interface i'm using is the Daikin BRP072A42.
neilk
Posts: 727
Joined: Mon Jul 13, 2015 1:51 pm
Location: Reading, UK

Re: error changing settings.

Post by neilk »

Indeed it varies both by region and model and is not very consistent on identical features.


I will sort one way or another now we know but it may be next week.

Neil
agame
Posts: 514
Joined: Thu Jul 13, 2017 10:29 pm
Location: Melbourne, Australia

Re: error changing settings.

Post by agame »

no stress, thx!
neilk
Posts: 727
Joined: Mon Jul 13, 2015 1:51 pm
Location: Reading, UK

Re: error changing settings.

Post by neilk »

I created a test release https://github.com/neilkplugins/Daikin- ... 2.0.7alpha

That should address the issue. A new device configuration check box is added that says "Does the unit support decimal points", this is on by default but if you uncheck this all api calls should now be integers only.

It is possible I missed something as multiple different methods to change (as pretty much all actions include the setpoint parameter) but I think I caught them all.

Please do let me know if this works, or I have missed anything. I don't use the HomeKit plugin yet, so if I need to furthe optimise then I will as I also plan to.

If it works for you I will add to the plugin store (with the other fix in this release to make consumption API calls configurable)

Neil
neilk
Posts: 727
Joined: Mon Jul 13, 2015 1:51 pm
Location: Reading, UK

Re: error changing settings.

Post by neilk »

After you upgrade you will need to open and edit the device properties otherwise you will get an error., once you save the configuration changes it should go away

I will fix for the release version.

Neil
neilk
Posts: 727
Joined: Mon Jul 13, 2015 1:51 pm
Location: Reading, UK

Re: error changing settings.

Post by neilk »

https://github.com/neilkplugins/Daikin- ... 2.0.8alpha fixes the issue if you are upgrading from an earlier version and to remove the need to edit/save the device properties

Neil
Post Reply

Return to “Daikin Wifi Controller”