Viessmann API binding for 3.3.x [3.3.0;3.4.0)

@hman
After setup the bridge you have restart openhab, this was the same by me.

Raised https://github.com/rtuck99/openhab-binding/issues/5

I use our binding with w-100 vitodens and found that heating.circuits.0.temperature.levels/setMax setpoint is missing in boiler channels but I’m sure for 100% that exists in api for my boiler (because I earlier make php2mqqt gateway for that).
That would be very helpfull channel because it can get/set max temperature in boiler circuit for heating.

Hi,

I have the B1KF and that feature isn’t present on my boiler, and I cannot find it in the Json. Can you please install the latest version of the binding and do the following:

You should be able to find the new “Response Capture Debug” option on your Viessman API Bridge thing (enable advanced options).

Enable it, save the settings, then go and find the responseCapture.json file it will create.

It should be somewhere in your OpenHAB install, in a folder named something like
userdata/cache/org.eclipse.osgi/282/data

but the number will be different, so you will probably need to search for it as there are many numbered folders (I think it’s the bundle number which you can get from your apache karaf-console, but it’s probably quicker just to do “find . -name responseCapture.json” or something similar)

If you can send me that json file, that will be all the feature data that comes back from your boiler, and should be enough for me to add support for the feature.

Here is api response (codebeautify.org)

Thank you. I have added a github issue and will be working on this for the next release

2 Likes

Awesome, working now. Thank you

1 Like

Thank you for your work, @rtuck99,

sorry to bother you, but I’m a beginner and running into issues setting up the add-on:

  • add-on installed
  • binding is authorized
  • setup the bridge with the client-id
  • one device is automatically found (inbox)
  • when I add the device (should be a Vitodens 300W gas heater) as “Vitodens 300W”, the thing is successfully created
  • a following “create equipment from thing” fails with “bad request”


when I look into things => Vitodens 300W => Channels, all channels are available, but no channel has a point. From what I understand from other things and the screenshots above, at least some channels should have a valid point (“blue ribbon with number”) providing measured data from the Viessmann API.
And I noticed that - other than on your screenshots above - the thing properties only contain the deviceUniqueId, but no device.serial, no heating.boiler.serial, etc.
Where did I go wrong? Do I have to add the points manually? Or has the Vitodens 300W a currently unsupported scheme?

Thank you very much in advance for you help!

Hi there,

| Wolfpack Wolfgang
October 17 |

  • | - |

Thank you for your work, @rtuck99,

sorry to bother you, but I’m a beginner and running into issues setting up the add-on:

  • add-on installed
  • binding is authorized
  • setup the bridge with the client-id
  • one device is automatically found (inbox)
  • when I add the device (should be a Vitodens 300W gas heater) as “Vitodens 300W”, the thing is successfully created
  • a following “create equipment from thing” fails with “bad request”

I can reproduce this - it seems there is a problem when it tries to create links for the channels. Creating the individual items manually and the channel links works for me, so you should be able to work around this. I will have a look into it, but it might be that it expects the binding to create sub-items for all the channels. I’m not sure if this is a good idea, as I’m not sure I want to go into the complexity of creating a comprehensive item model for all channels that might be present, especially given that every heating installation is going to be unique, and people might want to put items into different rooms etc.


when I look into things => Vitodens 300W => Channels, all channels are available, but no channel has a point. From what I understand from other things and the screenshots above, at least some channels should have a valid point (“blue ribbon with number”) providing measured data from the Viessmann API.

The binding doesn’t create Items, only Things and Channels. You will need to manually create Items and link them to the Channels, it’s up to you how you decide to arrange the various heating circuits, sensors etc. in your Model. You don’t have to create Items for all the Channels, you can leave some unlinked. For the writable channels, you may have to add Metadata to the Item to ensure a clickable UI control is created.

The Thing can have an

And I noticed that - other than on your screenshots above - the thing properties only contain the deviceUniqueId, but no device.serial, no heating.boiler.serial, etc.

That might be a bug - I will look into it. It is probably trying to create them as channels now, but I suspect it may be failing because there is no ChannelType for them.

Where did I go wrong? Do I have to add the points manually? Or has the Vitodens 300W a currently unsupported scheme?

I intend to support as many devices as I can, but I will need people to report bugs and feature requests as I only have my own boiler to test against. The API supports heat pumps and other strange things like fuel cell heaters, ventilation and floor heating, if people have such devices and are willing to help out I am happy to extend support.

Thank you for taking the time to get into my topics.
I think for now, with my limited experience on OpenHAB and missing programming capabilities, I can’t continue on this topic - but I will follow your development.
Is there any way I can support your work by providing any (api) output or - if you are interested - make a remote session to give you access to my system and gather information for yourself?

Looks like I found another problem.
Today my house got several power loss for several hours and now when power is restored I have 429 error for thing and does not work.
I think that, in some corner cases, bonding just spams API or something like that

Raised a bug for this:

It shouldn’t require any additional programming - but instead of creating all items at once, create them individually in the GUI when browsing the Channels in the heating Thing, and select “Add Link to Item
” from there

This works for me and should be a workaround until I get a chance to investigate the item creation issue. Unfortunately it will be a bit repetitive as there are a lot of channels.

If you have features you would like supported , then follow instructions in this post:

1 Like

Oh my god
 finally I got it.
My assumption was, that all available items are generated automatically (as I feared myself not be able to create a totally new item). After playing around, I just created items into the blind and: it returned values! :partying_face:

I think I also made some advancements in unterstanding openHAB.
I had the idea that the items hold the actual value I want to have, so I need to connect the item to a value.
But the value is already set and given within the channel, right?
So for example, the channel “burner hours” already holds the value of burning hours transmitted by the API (let’s say for example 1000 (hours)).
Creating an item is just a way (or multiple ways) to make the data of the channel visible and usable. So I could choose to create it as new number item (for calculating), but I could also parallely create it as a string item for integrating it into a text (I know, it makes no sense, as I think I clould also use the number item for this).

1 Like

Anyone else have issues with the API Bridge?
Always getting [WARN ] [care.internal.VicareDiscoveryService] - Authentication problem scanning Viessmann API:Unable to authenticate: No valid access token and no refresh token.

Created the client at the developer portal and configured the openhab instance as redirect url
https://%IP address% /vicare/setup

Added the client ID in the binding config

Thank you

I’m having the same issue!

I found this log entry after trying to authenticate the binding:

2022-10-23 17:45:38.640 [WARN ] [ernal.tokenstore.PersistedTokenStore] - Unable to store refresh token
java.security.InvalidKeyException: Illegal key size
	at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1076) ~[?:?]
	at javax.crypto.Cipher.implInit(Cipher.java:842) ~[?:?]
	at javax.crypto.Cipher.chooseProvider(Cipher.java:901) ~[?:?]
	at javax.crypto.Cipher.init(Cipher.java:1433) ~[?:?]
	at javax.crypto.Cipher.init(Cipher.java:1364) ~[?:?]
	at com.qubular.openhab.binding.vicare.internal.CryptUtil.initCipher(CryptUtil.java:61) ~[?:?]
	at com.qubular.openhab.binding.vicare.internal.CryptUtil.encrypt(CryptUtil.java:41) ~[?:?]
	at com.qubular.openhab.binding.vicare.internal.tokenstore.PersistedTokenStore.storeRefreshToken(PersistedTokenStore.java:119) ~[?:?]
	at com.qubular.vicare.internal.servlet.VicareServlet.lambda$extractAuthCodeAndFetchAccessToken$1(VicareServlet.java:146) ~[bundleFile:?]
	at java.util.Optional.ifPresentOrElse(Optional.java:201) ~[?:?]
	at com.qubular.vicare.internal.servlet.VicareServlet.extractAuthCodeAndFetchAccessToken(VicareServlet.java:114) ~[bundleFile:?]
	at com.qubular.vicare.internal.servlet.VicareServlet.doGet(VicareServlet.java:76) ~[bundleFile:?]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) ~[bundleFile:3.1.0]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) ~[bundleFile:3.1.0]
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:550) ~[bundleFile:9.4.46.v20220331]
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:74) ~[bundleFile:?]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440) ~[bundleFile:9.4.46.v20220331]
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:294) ~[bundleFile:?]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[bundleFile:9.4.46.v20220331]
	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:90) ~[bundleFile:?]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.Server.handle(Server.java:516) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732) [bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479) [bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277) [bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) [bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) [bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338) [bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315) [bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173) [bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) [bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409) [bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883) [bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034) [bundleFile:9.4.46.v20220331]
	at java.lang.Thread.run(Thread.java:829) [?:?]

Hi there,

the redirect URL needs to be configured as
https://%IP address%/vicare/authCode
not
https://%IP address%/vicare/setup

Yes the items are effectively what “stores the value in OpenHAB” that are exposed as controls in the UI etc. and the channels are how connected devices read and write those values.

Hi there,

this relates to encrypting the OAuth token while it is stored and has been already reported as an issue. I am hoping to get a “fix” (i.e. a warning and an option to configure weaker AES-128 encryption for all people in sad countries that don’t have AES256, can’t believe this is still a thing) for it soon, but preferably it is better to set CRYPTO_POLICY to unlimited to enable full-beans encryption strength. (see GitHub - openhab/openhab-docker: Repository for building Docker containers for openHAB).

Part of me thinks maybe I should just set the default to AES-128 as the decryption key is necessarily easily readable, so this is really just a layer of obfuscation, but on the other hand why should some people end up with less secure default behaviour? Thoughts please.

1 Like

Thank you!

I found the solution for me in the issue you mentioned.

I had to set the “CRYPTO_POLICY” environment variable for my docker container to “unlimited” and it worked!

1 Like