Home Connect binding

Nevermind got it working!

Hi,

@Saracen @Adrian_Rinnus: I will add dryer support next. Thanks for willing to test the thing once done.

@H311m4n: What was the problem? Should I extend the documentation?

@curlyel

Is it based on it or a complete rewrite?

It is a complete new binding. I first tried on a fork of @FanFan’s binding, but realized that it is better to create a new binding.
Reasons:

  • polling approach won’t work because of rate limits (https://developer.home-connect.com/docs/general/ratelimiting) 1000 requests per day is not enough to fetch the data frequently
  • I don’t like configuration files - now you just have to setup a api bridge
  • Server Sent Events wasn’t impl.
  • oAuth device flow was missing

How about local connection from openHAB to the BSH appliances ?

Haven’t done any research on this one. I’ve decompiled the original Home Connect app and had a brief look at the source code. Seems like the app is communicating with a different API. If I remember right it was using gRPC/Protobuffer (but I’m not sure).

Hi Jonas,

do you have any plans to merge the binding into master so that it will be available in the snapshot builds?

I was getting confused with the usernames/passwords. It wasn’t immediately obvious to me that I needed to use the username/password combination I use on my homeconnect app on my phone, and not the one I used on the dev portal. Maybe this was in the documentation and I missed it though.

That said, all works fine with the binding and my washer so thanks for your work!

Yes, I will create a PR once I have implemented all device types.

4 Likes

Hi Jonas,

just letting you know that I just tested with my oven. Setting up the binding works like a charm on the first try.

I can get the state from the home appliance instantaneously into OpenHAB! Like!!1!

I can’t change things like power on/off within OpenHAB, it seems to be read-only. Is this expected behavior?

Thanks a lot for implementing this!!

best,
Bernhard

PS: I also have a Home Connect coffee machine and would be willing to beta test as soon as you implemented this device type!

Hi,

@bbock

I can’t change things like power on/off within OpenHAB, it seems to be read-only. Is this expected behavior?

Yes it is. You can find a good overview of all channels and read-only status at https://github.com/bruestel/org.openhab.binding.homeconnect/tree/master/addons/binding/org.openhab.binding.homeconnect#channels

PS: I also have a Home Connect coffee machine and would be willing to beta test as soon as you implemented this device type!

Great. Next I will implement dryer and afterwards coffee machine support. Than I have covered all types :slight_smile: Thanks for willing to test.

@mstehle

I have one more suggestion should you still plan to change something:
Maybe it would be more convenient to have the remaining_program_time_state channel reports in minutes instead of seconds.

I’m working on support for Units of Measurement (Units Of Measurement | openHAB). Then you can decide which output unit you would like to use. I’ve tested it in a sitemap config and it worked.

sitemap demo label="Main Menu"
{
    Default item=homeconnect_Dishwasher_SIEMENS_HCS02DWH1_6F2FC400C1EA4A_remaining_program_time_state label="Remaining Time [%d min]"
    Default item=homeconnect_Dishwasher_SIEMENS_HCS02DWH1_6F2FC400C1EA4A_remaining_program_time_state label="Remaining Time [%d s]"
    Default item=homeconnect_Dishwasher_SIEMENS_HCS02DWH1_6F2FC400C1EA4A_remaining_program_time_state label="Remaining Time [%d ms]"
}

Thanks,
Jonas

I’m working on support for Units of Measurement

good news, even better :slight_smile:
Please let me know when an updated binding is available.

Thank you,
Matt

@bbock and @mstehle new version is available

1 Like

Hi Jonas,

UoM is working for the Dishwasher time. Thanks.

Basic operation with the oven (reading state) still works as expected. Did just a short smoke test, though.

Hi @jb4711 ,

I am currently on openhab snapshot 2.4.0 #1370. When I restart I get the following in the log:

2018-09-25 00:32:38.237 [ERROR] [ome.core.thing.internal.ThingManager] - Exception occurred while calling thing handler factory 'org.openhab.binding.homeconnect.internal.factory.HomeConnectHandlerFactory@4cfc90f6': Base thing handler factory has not been properly initialized. Did you forget to call super.activate()?
java.lang.IllegalStateException: Base thing handler factory has not been properly initialized. Did you forget to call super.activate()?
        at org.eclipse.smarthome.core.thing.binding.BaseThingHandlerFactory.setHandlerContext(BaseThingHandlerFactory.java:145) ~[107:org.eclipse.smarthome.core.thing:0.10.0.201809210646]
        at org.eclipse.smarthome.core.thing.binding.BaseThingHandlerFactory.registerHandler(BaseThingHandlerFactory.java:128) ~[107:org.eclipse.smarthome.core.thing:0.10.0.201809210646]
        at org.eclipse.smarthome.core.thing.internal.ThingManager.doRegisterHandler(ThingManager.java:594) [107:org.eclipse.smarthome.core.thing:0.10.0.201809210646]
        at org.eclipse.smarthome.core.thing.internal.ThingManager.registerHandler(ThingManager.java:575) [107:org.eclipse.smarthome.core.thing:0.10.0.201809210646]
        at org.eclipse.smarthome.core.thing.internal.ThingManager.registerAndInitializeHandler(ThingManager.java:1045) [107:org.eclipse.smarthome.core.thing:0.10.0.201809210646]
        at org.eclipse.smarthome.core.thing.internal.ThingManager.access$24(ThingManager.java:1041) [107:org.eclipse.smarthome.core.thing:0.10.0.201809210646]
        at org.eclipse.smarthome.core.thing.internal.ThingManager$3.run(ThingManager.java:616) [107:org.eclipse.smarthome.core.thing:0.10.0.201809210646]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
        at java.lang.Thread.run(Thread.java:748) [?:?]

Any idea why? The binding works without problems though…

Hi @mstehle,

thanks for your log.

Really strange problem. I don’t understand the error message since I do not overwrite any method which requires me to call super.activate().

     * Initializes the {@link BaseThingHandlerFactory}. If this method is overridden by a sub class, the implementing
     * method must call <code>super.activate(componentContext)</code> first.

Will check if I can reproduce it.

Thank you so much for writing this binding. I have two ovens and a dishwasher and got both of them running right away.

Two questions from my side:

  1. I am a friend of textual configs. Is there an option to save the bridge and appliances in a thing file, like with the other bindings?
  2. Is the restriction that an oven can not be turned on or off imposed by the API itself? The strange thing is, that the HomeConnect app has no issue turning on and off the oven…

Thanks,
Jochen

Hi,

Thank you very much for the binding. I have tried to create a things file but while the bridge is connected and online the washer and dryer do not seem to be recognized. Any directions are utmost welcome:

Bridge homeconnect:api_bridge:home “Homeconnect API” @ “Cloud” [ clientSecret=“secret”, clientId=“id”, simulator=false, refreshToken=“refresh” ] {
Thing Dryer BDRGC “BDRGC” @ “Cellar” [ haId=“BOSCH-WAYH2840CH-XXXXXXXXXXX” ]
Thing Washer BWAGC “BWAGC” @ “Cellar” [ haId=“BOSCH-WTYH7740CH-XXXXXXXXXXX”]
}

Hi @thaScheich, @jotpehenn,

I’ve added some configuration file examples to the documentation (https://github.com/bruestel/org.openhab.binding.homeconnect/tree/master/addons/binding/org.openhab.binding.homeconnect#examples-file-based-configuration). Hope it helps.

@jotpehenn

Is the restriction that an oven can not be turned on or off imposed by the API itself? The strange thing is, that the HomeConnect app has no issue turning on and off the oven…

Currently the majority of the implemented channels is read-only, so you can only see the current status of the appliance. I will focus on actions like “starting program” etc. after I’m finished with coffee machine support. Unfortunately I cannot start ovens or get camera images from a fridge. To do this, a “Additional Partner
Agreement” is required by BSG (https://developer.home-connect.com/docs/authorization/scope).

Thanks for testing,
Jonas

Thanks @jb4711 !

Actually the Text config you added to the description appear to lead to

2018-09-30 13:15:05.368 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'homeconnect.things', using it anyway:
Provide a thing type ID and a thing ID in this format:
 <thingTypeId> <thingId>

Apparently this has to do with a new thing definition format, I tried to apply the new format which would then look like:

Bridge homeconnect:api_bridge:mybridge "Home Connect API" [ clientId="xyz", clientSecret="xyz", refreshToken="xyz", simulator=false] {
    // Thing configurations
    Thing dishwasher siemensdishwasher "Siemens Dishwasher"  [ haId="SIEMENS-SN658X06TE-12340E1539BF" ]
}

which seems to work, with the only difference, that the item definition also needs the bridge in the item definition:

Switch                 DishwasherPowerState                  "Power State"                       {channel="homeconnect:dishwasher:mybridge:siemensdishwasher:power_state"}

This is probably the same as @thaScheich was trying. (except the appliance type is written in all lower case, mybe this was why it did not work for him) Any reason why this method of thing definition would make problems with this binding?

Interesting, any idea what actually is required for this partner agreement?

Regards,
Jochen

Hi @jotpehenn,

thanks for the reply. I wondered why the bridge name was in the channel name of the thing:

which seems to work, with the only difference, that the item definition also needs the bridge in the item definition:

I will change it to the correct way.

Thanks,
Jonas

Indeed the appliance type has to be in lower case, it work for me now. Thank you @jotpehenn. I was taking the information from the JSON storage where the first letter was written in capital.

Regards Raphael

Continuing the discussion from Home Connect addon: Looking for beta testers:

Hi,

@bbock I’ve added coffee machine. Thanks for willing to test.