Daikin Onecta (Cloud) Binding [4.0.0.0;5.0.0.0)

This binding allows you to control Daikin Units that are connected to the Daikin Onecta App (server)

Changelog

Its on development and the first steps are working on OH 4.0.0

At this moment it’s possible to get basic unit data into channels. It also drops the RawUnitData into a channel.

First create a Bridge with a Userid and Password. With this the it connects to Daikin Onecta and all the unit data is collected and the inbox will show messages to create the Things.

This pre-release gives the addon basic functionality like getting data from the units and setting basic commands.

  • power
  • settemp
  • settempmin
  • settempmax
  • settempstep
  • indoortemp
  • outdoortemp
  • leavingwatertemp
  • humidity
  • operationmode
  • fanspeed
  • fandirhor
  • fandirver
  • fandir
  • economode
  • streamer
  • powerfulmode
  • holidaymode
  • targettemp (Heatpump)
  • targettempmin (Heatpump)
  • targettempmax (Heatpump)
  • targettempstep (Heatpump)

  • demandcontrol
  • demandcontrolfixedvalue
  • demandcontrolfixedstepvalue
  • demandcontrolfixedminvalue
  • demandcontrolfixedmaxvalue
    ---------------- Energy usage data
  • energycoolingday-0 / energycoolingday-23
  • energycoolingweek-0 / energycoolingweek-13
  • energycoolingmonth-0 / energycoolingmonth-23
  • energyheatingday-0 / energyheatingday-23
  • energyheatingweek-0 / energyheatingweek-13
  • energyheatingmonth-0 / energyheatingmonth-23

First screenshots

Resources

(org.openhab.binding.onecta-4.1.0-SNAPSHOT.jar)

7 Likes

Great. Thank you!
Will sync it and build it as soon as I have some more time. Your work is much appreciated! :slight_smile:

I wonder if you got into an official agreement with Daikin to provide you the API documentation (I had this idea at some point but I didn’t want to sign their NDAs and stuff), or you used the reverse-engineered protocol from the Home Assistant guys and the proxy implementation mentioned a few times?

Cheers,
K.

One thing I noticed when I did a rough look - you may want to fix the typo in the exceptions package. Currently it’s “excetion”. :slight_smile:

1 Like

I used the reverse-engineered methode for personal use at first. But I like to create something for the community, instead of only using it.

After successfully generating the token (With proxy implementation) and receiving a json message with data of the complete installation (with Postman). I started translating this data to Java. It has also been possible to control units with Postman.

I also managed to control units with Postman by sending messages to Onecta.

From the Home Assistant plugin I got the endpoints, but reading and understanding a Python project … pffff :worried:

1 Like

Following and will try as soon I find some time.

Does it need OH4 with the new Java 17 or could it work on OH3.4 with Java 11 too?

Iam developing for OH4 with java 17. On OH3 it will miss some libs.

Done, there is more cleaning and refactoring necessary

1 Like

Great work. Like to be a tester for this new binding.
No issue to get it working in OH4.0.0M3. Could read-out Daikin Prefera unit data.
However after 1 hour, it stops working. Probably due to token expiration, and refresh not working.
See error log.

2023-07-02 09:41:30.314 [INFO ] [org.openhab.core.Activator ] - Starting openHAB 4.0.0.M3 (build Milestone Build)
2023-07-02 09:41:31.456 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Time zone set to ‘Europe/Brussels’.
2023-07-02 09:41:31.485 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Locale set to ‘nl_BE’.
2023-07-02 09:42:12.710 [INFO ] [e.automation.internal.RuleEngineImpl] - Rule engine started.
2023-07-02 09:42:53.794 [INFO ] [ab.ui.habpanel.internal.HABPanelTile] - Started HABPanel at /habpanel
2023-07-02 09:54:41.561 [INFO ] [ecta.internal.api.OnectaSignInClient] - Start logon
2023-07-02 09:54:42.155 [INFO ] [ecta.internal.api.OnectaSignInClient] - Create client Secret
2023-07-02 09:54:42.529 [INFO ] [ecta.internal.api.OnectaSignInClient] - Get csrf-cookies
2023-07-02 09:54:42.532 [INFO ] [ecta.internal.api.OnectaSignInClient] - Call forward-url
2023-07-02 09:54:42.789 [INFO ] [ecta.internal.api.OnectaSignInClient] - Prepare request to get Api-Version
2023-07-02 09:54:43.219 [INFO ] [ecta.internal.api.OnectaSignInClient] - Prepare request to get single-sign-on cookie
2023-07-02 09:54:43.517 [INFO ] [ecta.internal.api.OnectaSignInClient] - User logon to Daikin
2023-07-02 09:54:43.824 [INFO ] [ecta.internal.api.OnectaSignInClient] - Extract login-token
2023-07-02 09:54:43.842 [INFO ] [ecta.internal.api.OnectaSignInClient] - Expand single-sign-on cookies with login-token
2023-07-02 09:54:44.074 [INFO ] [ecta.internal.api.OnectaSignInClient] - Get DaikinUnified
2023-07-02 09:54:44.342 [INFO ] [ecta.internal.api.OnectaSignInClient] - Get Tokens to perform datatransfer
2023-07-02 09:54:44.508 [INFO ] [ecta.internal.api.OnectaSignInClient] - Refresh token.
2023-07-02 09:54:45.160 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing ‘onecta:device:c06ca88b33:06a20a89-a899-zzzz-yyyy-xxxxxxxxxxxx’ to inbox.
2023-07-02 10:00:14.177 [INFO ] [internal.handler.OnectaBridgeHandler] - asasasasasasas
2023-07-02 10:55:02.665 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception:
java.lang.RuntimeException: java.util.concurrent.ExecutionException: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header
at org.openhab.binding.onecta.internal.api.OnectaConnectionClient.doBearerRequestGet(OnectaConnectionClient.java:68) ~[?:?]
at org.openhab.binding.onecta.internal.api.OnectaConnectionClient.refreshUnitsData(OnectaConnectionClient.java:111) ~[?:?]
at org.openhab.binding.onecta.internal.handler.OnectaBridgeHandler.pollDevices(OnectaBridgeHandler.java:174) ~[?:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.util.concurrent.ExecutionException: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header
at org.eclipse.jetty.client.util.FutureResponseListener.getResult(FutureResponseListener.java:118) ~[?:?]
at org.eclipse.jetty.client.util.FutureResponseListener.get(FutureResponseListener.java:101) ~[?:?]
at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:732) ~[?:?]
at org.openhab.binding.onecta.internal.api.OnectaConnectionClient.doBearerRequestGet(OnectaConnectionClient.java:61) ~[?:?]
… 8 more
Caused by: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header
at org.eclipse.jetty.client.AuthenticationProtocolHandler$AuthenticationListener.onComplete(AuthenticationProtocolHandler.java:164) ~[?:?]
at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:218) ~[?:?]
at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:210) ~[?:?]
at org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:481) ~[?:?]
at org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:461) ~[?:?]
at org.eclipse.jetty.client.HttpReceiver.responseSuccess(HttpReceiver.java:424) ~[?:?]
at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.messageComplete(HttpReceiverOverHTTP.java:374) ~[?:?]
at org.eclipse.jetty.http.HttpParser.handleContentMessage(HttpParser.java:597) ~[bundleFile:9.4.50.v20221201]
at org.eclipse.jetty.http.HttpParser.parseContent(HttpParser.java:1722) ~[bundleFile:9.4.50.v20221201]
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:1551) ~[bundleFile:9.4.50.v20221201]
at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.parse(HttpReceiverOverHTTP.java:208) ~[?:?]
at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.process(HttpReceiverOverHTTP.java:148) ~[?:?]
at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.receive(HttpReceiverOverHTTP.java:80) ~[?:?]
at org.eclipse.jetty.client.http.HttpChannelOverHTTP.receive(HttpChannelOverHTTP.java:131) ~[?:?]
at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.onFillable(HttpConnectionOverHTTP.java:172) ~[?:?]
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) ~[bundleFile:9.4.50.v20221201]
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) ~[bundleFile:9.4.50.v20221201]
at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.onFillable(SslConnection.java:555) ~[bundleFile:9.4.50.v20221201]
at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:410) ~[bundleFile:9.4.50.v20221201]
at org.eclipse.jetty.io.ssl.SslConnection$2.succeeded(SslConnection.java:164) ~[bundleFile:9.4.50.v20221201]
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) ~[bundleFile:9.4.50.v20221201]
at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) ~[bundleFile:9.4.50.v20221201]
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338) ~[bundleFile:9.4.50.v20221201]
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315) ~[bundleFile:9.4.50.v20221201]
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173) ~[bundleFile:9.4.50.v20221201]
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) ~[bundleFile:9.4.50.v20221201]
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409) ~[bundleFile:9.4.50.v20221201]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883) ~[bundleFile:9.4.50.v20221201]
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034) ~[bundleFile:9.4.50.v20221201]

Hi Frans,

Thanks for testing.
Please try the new version. This morning i upload a new Jar and this issue should be solved.

Jar file

2 Likes

Hi Alex
Working fine now for about 20 hours.
Just get every hour following log message:

2023-07-03 12:07:49.540 [INFO ] [ecta.internal.api.OnectaSignInClient] - doBearerRequestGet : Exception status org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-A
uthenticate header
2023-07-03 12:07:49.543 [INFO ] [ecta.internal.api.OnectaSignInClient] - Refresh token.
2023-07-03 13:07:57.182 [INFO ] [ecta.internal.api.OnectaSignInClient] - doBearerRequestGet : Exception status org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-A
uthenticate header
2023-07-03 13:07:57.187 [INFO ] [ecta.internal.api.OnectaSignInClient] - Refresh token.

Somthing to worry about?
During upgrade to OH4.0.0.M4:
[main] WARN org.openhab.core.tools.internal.Upgrader - Daikin_Onecta_Unit_DaikinAP23947_Indoor_Humidity: Could not determine if channel ‘onecta:device:xxxxxxxxx:yyyyyyyyyy:humidity’ sets a state description. Check if you need to set unit metadata.
[main] WARN org.openhab.core.tools.internal.Upgrader - Daikin_Onecta_Unit_DaikinAP23947_Set_Point: Could not determine if channel ‘onecta:device:xxxxxxxxx:yyyyyyyyyy:settemp’ sets a state description. Check if you need to set unit metadata.
[main] WARN org.openhab.core.tools.internal.Upgrader - Daikin_Onecta_Unit_DaikinAP23947_Indoor_Temperature: Could not determine if channel ‘onecta:device:xxxxxxxxx:yyyyyyyyyy:indoortemp’ sets a state description. Check if you need to set unit metadata.
[main] WARN org.openhab.core.tools.internal.Upgrader - Daikin_Onecta_Unit_DaikinAP23947_Outdoor_Temperature: Could not determine if channel ‘onecta:device:xxxxxxxxx:yyyyyyyyyy:outdoortemp’ sets a state description. Check if you need to set unit metadata.

Hello,
a question. What is the name of the binding?
I have the official Daikin binding on my system and would like to test your binding on another Daikin chest unit.
I copied the jar file into the addon directory and when setting up the things I only see the official binding called Daikin Binding. Could it be that your binding has the same name and therefore doesn’t appear in the list?
If so, could you rename your binding?

Addendum:
I see the binding in the Karaf console. It’s not active. Does it only work from OH 4?

308 │ Installed │ 80 │ 4.0.0.202307020929 │ onecta

Hi Andre,

Yes, till now its only writen for 4.0.0

Hi Frans,
The problem is that the token is used until a exception is thrown. In this exception i get a new token with the refreshToken. The Message is a log message I put there.
I’ll will delete this message.

gr Alexander

I don’t know what this is?

Hi Alex,
I guess you need to specify a proper type for the humidity.
See this: Units Of Measurement | openHAB
For example in the XML of a binding I hope soon to be merged, where I explain the channels for example for electric current I use this:
<channel id="inverterCurrent" typeId="system.electric-current"/>
I guess there is a specific typeId for humidity which results in % humidity as a unit of measurement. Probably this should fix these issues…

Cheers,
K.

Yes, thanks,
I know the issue

I would suggest to rather make the severity of the message higher, e.g. DEBUG/TRACE. You will still be able to ask “customers” :slight_smile: for higher fidelity logs for more info troubleshooting. :slight_smile:

Yes, you are right. Building an addon in a community is very new to me. It is a quest for all possibilities. :rofl: