openhab / openhab1-addons

Add-ons for openHAB 1.x
Eclipse Public License 2.0
3.43k stars 1.7k forks source link

Daikin binding error with wireless BRP072A42 unit (ref#2724) #3032

Open glenm-nz opened 9 years ago

glenm-nz commented 9 years ago

@JosSchering1 has requested for this issue to be assigned to him.

I have had a bit of a further play with the 1.8.0 snapshot binding (with the BRP072A42) have found one minor issue, but it doesn't stop the binding from mostly working...

Short version is that this error occurs when the heatpump is turned off (any of the heatpumps, be it the multi, or standalone systems).

However the set command works just fine, and you can turn the heatpump back-on via openhab, and all values update ok while turned on.

So hopefully the following information will help find a solution:

Firstly if I browse to the BRP072A42 module from my browser, the following are the returns we see:

STATE: Heatpump Off URL: /aircon/get_sensor_info RETURN: ret=OK,htemp=21.0,hhum=-,otemp=-,err=0,cmpfreq=0

URL: /aircon/get_control_info RETURN: ret=OK,pow=0,mode=4,adv=,stemp=18.0,shum=0,dt1=25.0,dt2=M,dt3=25.0,dt4=18.0,dt5=18.0,dt7=25.0,dh1=AUTO,dh2=50,dh3=0,dh4=0,dh5=0,dh7=AUTO,dhh=50,b_mode=4,b_stemp=18.0,b_shum=0,alert=255

STATE: Heatpump On URL: /aircon/get_sensor_info RETURN: ret=OK,htemp=20.0,hhum=-,otemp=11.0,err=0,cmpfreq=34

URL: /aircon/get_control_info RETURN: ret=OK,pow=1,mode=4,adv=,stemp=18.0,shum=0,dt1=25.0,dt2=M,dt3=25.0,dt4=18.0,dt5=18.0,dt7=25.0,dh1=AUTO,dh2=50,dh3=0,dh4=0,dh5=0,dh7=AUTO,dhh=50,b_mode=4,b_stemp=18.0,b_shum=0,alert=255

So I am perhaps guessing that the "otemp=-" may be the culprit for the error, and it is trying to parse it as a numeric value? I assume "hhum" may be similar, but I don't have any items for that, and I note that this does not cause errors when the heatpump is on, even though the value remains at "-" (But could be worth having a similar 'catch' for this value too, to prevent errors).

Let me know if I can provide any further information/assistance.... Cheers,

Glen

Error from openhab.log:

2015-08-06 18:26:01.000 [ERROR] [.service.AbstractActiveService] - Error while executing background thread Daikin Refresh Service java.lang.NumberFormatException: For input string: "-" at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1250) ~[na:1.7.0_60] at java.lang.Float.parseFloat(Float.java:452) ~[na:1.7.0_60] at net.jonathangiles.daikin.wireless.WirelessDaikin.parseFloat(WirelessDaikin.java:235) ~[na:na] at net.jonathangiles.daikin.wireless.WirelessDaikin.readDaikinState(WirelessDaikin.java:139) ~[na:na] at org.openhab.binding.daikin.internal.DaikinBinding.execute(DaikinBinding.java:111) ~[na:na] at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:156) ~[na:na] at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:173) ~[na:na]

welbymcroberts commented 8 years ago

@guitarglen / @JosSchering1 : I've also got some of the wireless modules (BRP069A42 is the wireless modules part number but the units are in a single package as the BRP069A43 as this contains the '42 and a board for the AC unit) on a multi-split.

I've got a similar situation where I'm able to set values, but not read them from the unit.

I've enabled only the daikin binding (which i've just got from cloudbees) in openhab with the following configuration

openhab.cfg

daikin:refresh=60000
daikin:livingroom.host=WIRELESS@http://1.2.3.4

items/livingroom.items

Number LivingRoomACTempIn      "Temp Inside [%.1f C]"      { daikin="livingroom:tempin" }
Number LivingRoomACHumidityIn  "Humidity Inside [%.1f %%]"  { daikin="livingroom:humidityin" }
Number LivingRoomACTempOut     "Temp Outside [%.1f C]"     { daikin="livingroom:tempout" }

When running openhab via start_debug.sh I get the following logs

02:08:05.325 [DEBUG] [o.b.d.internal.DaikinActivator:34   ] - Daikin binding has been started.
02:08:05.451 [DEBUG] [i.internal.GenericItemProvider:341  ] - Start processing binding configuration of Item 'LivingRoomACTempIn (Type=NumberItem, State=Uninitialized)' with 'DaikinGenericBindingProvider' reader.
02:08:05.452 [DEBUG] [i.internal.GenericItemProvider:341  ] - Start processing binding configuration of Item 'LivingRoomACHumidityIn (Type=NumberItem, State=Uninitialized)' with 'DaikinGenericBindingProvider' reader.
02:08:05.455 [DEBUG] [i.internal.GenericItemProvider:341  ] - Start processing binding configuration of Item 'LivingRoomACTempOut (Type=NumberItem, State=Uninitialized)' with 'DaikinGenericBindingProvider' reader.

When starting I've had TCPDump running and can see the following requests

From OpenHAB to AC

GET /aircon/get_control_info HTTP/1.1
User-Agent: Java/1.8.0_51
Host: 1.2.3.4
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive

Response

HTTP/1.0 200 OK
Content-Length: 334
Content-Type: text/plain
    ret=OK,pow=0,mode=3,adv=,stemp=18.0,shum=0,dt1=25.0,dt2=M,dt3=18.0,dt4=25.0,dt5=25.0,dt7=25.0,dh1=AUTO,dh2=50,dh3=0,dh4=0,dh5=0,dh7=AUTO,dhh=50,b_mode=3,b_stemp=18.0,b_shum=0,alert=255,f_rate=7,f_dir=0,b_f_rate=7,b_f_dir=0,dfr1=5,dfr2=5,dfr3=7,dfr4=5,dfr5=5,dfr6=5,dfr7=5,dfrh=5,dfd1=0,dfd2=0,dfd3=0,dfd4=0,dfd5=0,dfd6=0,dfd7=0,dfdh=0

Second Request from OpenHAB to AC Unit

GET /aircon/get_sensor_info HTTP/1.1
User-Agent: Java/1.8.0_51
Host: 1.2.3.4
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive

Second Response

HTTP/1.0 200 OK
Content-Length: 48
Content-Type: text/plain

ret=OK,htemp=22.0,hhum=-,otemp=-,err=0,cmpfreq=0

At this point there is no further actions performed either the main configuration file is reloaded, or until openhab is restarted.

If I define multiple host entries in the openhab.cfg it is only processing the first one (when alphabetically sorted). If i set a host of a to an ip that is not responding, it does not attempt to continue onto the next host. If the host does respond, two requests are made (as above) and then it does not progress onto the next host.

It's also worth noting that I do not see the null error on my install

watou commented 8 years ago

See also https://github.com/openhab/openhab/issues/2723#issuecomment-190863788

glenm-nz commented 8 years ago

@watou - Just want to double check the format you were expecting. I certainly was receiving comma-delimited responses, with the dot just used in the floating point temp values. I have posted responses I was receiving from the controller in #3032.

If my memory serves me correctly, I was getting readings ok, when the Heatpump was turned on (but not off), it just failed when it was turned off and the outside temp went to "-".... But I will need to play with this a bit more, as I haven't touched this since last winter...

Cheers

On Wed, Mar 2, 2016 at 12:31 PM, John Cocula notifications@github.com wrote:

@welbymcroberts https://github.com/welbymcroberts I noticed your data has , and . used differently in numbers than how JDaikin works https://bitbucket.org/JonathanGiles/jdaikin/src/dc50bed602b89161e65a0199c82e3086f5c788ab/src/main/java/net/jonathangiles/daikin/wired/WiredDaikin.java?at=default&fileviewer=file-view-default#WiredDaikin.java-29 .

JDaikin, and therefore the Daikin binding, expect your data to be returned as:

HTTP/1.0 200 OK Content-Length: 48 Content-Type: text/plain

ret=OK.htemp=22,0.hhum=NONE.otemp=NONE.err=0.cmpfreq=0

— Reply to this email directly or view it on GitHub https://github.com/openhab/openhab/issues/3032#issuecomment-190965198.

welbymcroberts commented 8 years ago

I can confirm that when i do a proxy of the connection and change the - to a 0 everything works well. Currently doing this with mod_substitute on apache.

There are really two issues here. The first is a parsing one where the - is causing it to fail

The second one is that if the unit doesnt respond or indeed responds with a non 200 response or a non parseable response the binding stops polling. Not just for that one device but for all devices. On 2 Mar 2016 06:45, "Glen" notifications@github.com wrote:

@watou - Just want to double check the format you were expecting. I certainly was receiving comma-delimited responses, with the dot just used in the floating point temp values. I have posted responses I was receiving from the controller in #3032.

If my memory serves me correctly, I was getting readings ok, when the Heatpump was turned on (but not off), it just failed when it was turned off and the outside temp went to "-".... But I will need to play with this a bit more, as I haven't touched this since last winter...

Cheers

On Wed, Mar 2, 2016 at 12:31 PM, John Cocula notifications@github.com wrote:

@welbymcroberts https://github.com/welbymcroberts I noticed your data has , and . used differently in numbers than how JDaikin works < https://bitbucket.org/JonathanGiles/jdaikin/src/dc50bed602b89161e65a0199c82e3086f5c788ab/src/main/java/net/jonathangiles/daikin/wired/WiredDaikin.java?at=default&fileviewer=file-view-default#WiredDaikin.java-29

.

JDaikin, and therefore the Daikin binding, expect your data to be returned as:

HTTP/1.0 200 OK Content-Length: 48 Content-Type: text/plain

ret=OK.htemp=22,0.hhum=NONE.otemp=NONE.err=0.cmpfreq=0

— Reply to this email directly or view it on GitHub https://github.com/openhab/openhab/issues/3032#issuecomment-190965198.

— Reply to this email directly or view it on GitHub https://github.com/openhab/openhab/issues/3032#issuecomment-191094386.

watou commented 8 years ago

Hi @welbymcroberts, I submitted this pull request a few hours ago to catch number format exceptions in the Wireless connection, similar to what is done in the Wired connection. It closely matches your observed error. Here is a new Daikin binding JAR that incorporates this protection against number format exceptions.

The second one is that if the unit doesnt respond or indeed responds with a non 200 response or a non parseable response the binding stops polling. Not just for that one device but for all devices.

Hopefully this is related to the parsing bug. I will soon own a Daikin split system, and intend to bulletproof the binding (at least in the ways I will test and use it, but also more than that.)

welbymcroberts commented 8 years ago

Sorry for only just getting back to you now, I've only just been able to test this today. This seems to have solved the parsing issue, however the timeout still exists as a problem it seems. Obviously most of the time this shouldn't be an issue, but it would be nice not to have to restart Openhab (or unload and reload the binding) every time the power is cut to the AC (or wireless drops)

java.net.ConnectException: Connection timed out
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:589)
        at java.net.Socket.connect(Socket.java:538)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
        at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
        at sun.net.www.http.HttpClient.New(HttpClient.java:308)
        at sun.net.www.http.HttpClient.New(HttpClient.java:326)
        at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1168)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1104)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:998)
        at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:932)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1512)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1440)
        at net.jonathangiles.daikin.util.RestConnector.submitGet(RestConnector.java:26)
        at net.jonathangiles.daikin.wireless.WirelessDaikin.readDaikinState(WirelessDaikin.java:52)
        at net.jonathangiles.daikin.DaikinBase.<init>(DaikinBase.java:42)
        at net.jonathangiles.daikin.wireless.WirelessDaikin.<init>(WirelessDaikin.java:18)
        at net.jonathangiles.daikin.DaikinFactory.createWirelessDaikin(DaikinFactory.java:30)
        at org.openhab.binding.daikin.internal.DaikinBinding.updated(DaikinBinding.java:284)
        at org.eclipse.equinox.internal.cm.ManagedServiceTracker$1.run(ManagedServiceTracker.java:183)
        at org.eclipse.equinox.internal.cm.SerializedTaskQueue$1.run(SerializedTaskQueue.java:36)
watou commented 8 years ago

The stack trace appears to show that when the binding is loaded or the config is changed, the JDaikin library is attempting to query the device, and being unreachable, throws an unhandled runtime exception which leaves the binding in a non-working state (as you see).

While one could change the binding or JDaikin library to work around this, my personal preference is to wait until my Daikin split system is running, I will revamp the binding to eliminate this and other issues, and ask you to test the reworked binding. If you can't wait for me, I would recommend that the updated() method in the binding is changed to not attempt to createWirelessDaikin(), but instead that would be done as needed during each poll. There is probably more to it than that, but I don't think I can take a pass at it until I actually have real Daikin equipment in place to test against.

olemr commented 6 years ago

@watou The link to your 1.9.0 binding is no longer working. Could you provide a copy for me please?