New binding for BSB-LAN device

Tags: #<Tag:0x00007f5c8f08dca0>

Hi all,

I recently implemented a binding to retrieve data from my BSB-LAN device via the JSON API provided by the device.
Initially I just wanted to get in touch with binding development in openHAB and have a simple and flexible way of retrieving data.
That’s why I started coding with the result of a new binding that can be used to communicate with the BSB-LAN device. The binding is now running for several days in my system in a first version. As I didn’t notice major issues I decided to share the outcome.

So If someone stumbles across this post and wants to give the binding a try I would appreciate your feedback. Due to my limited spare time I will not be able to respond at present.

Documentation can be found here.

The current version is based on a 2.5.0 snapshot and available here. Copying the jar to the “addons” directory should be all that has to be done - of course apart from configuring the binding :slight_smile:

Note: Retrieving parameter 8982 is currently not possible (see https://github.com/fredlcore/bsb_lan/issues/40)

regards Peter

2 Likes

Will definetly try this the next couple of days. :+1:

I did a very quick setup as I am short on time, but: amazing, works right out of the box, thanks for that :+1:

Will do some more tests during the next days.

Finally I had some more time to test in detail: reading and setting parameters for my heating system from Brötje works without any problems.
Great Job!
Are there any plans to add this binding to the official repo?

Nice to hear and many thanks for your feedback and testing.

Haven’t yet thought of contributing it back to the official repository. In case of doing so it might be worth contacting the owner of the BSB repo regarding his plans of the JSON API, just to be sure there are no breaking changes planned in the near future which would require reworking the communication with the device when using newer firmware versions.

But basically - why not :slight_smile:

Have an nice evening!

That definitely makes sense as this is a pretty new feature for the BSB LAN adapter.

This would be really great, thx again for your hard work.

I try to use your binding.
Unfortunately, I don’t get the binding to work.
I loaded the .jar into the “addons” folder and configured the things, items and sitemap like your specification here. But I don’t get an issue. The items have no values.


Maybe there is some additional Config? Or an required add-on?
If I make a http query with the browser i receive the data (also the parameter 8982).
Any help and tips are very welcome.
Thank you for your work

Hi,

as far as I know there shouldn’t be anything else to do - at least I hadn’t to do other Things :slight_smile:
Some things you might want to check:

  • Could it be the same issue as here
    Have you done the configuration via files or via paper ui?
  • I am currently running on a 2.5 snapshot (2.5.0~S1630-1)
    Which version do you use?
  • What status do the bridge and parameter things show in paper-ui?
    You should be able to see it via URLs similar to
    http://[ip]/paperui/index.html#/configuration/things/view/bsblan:bridge:heating
    http://[ip]/paperui/index.html#/configuration/things/view/bsblan:parameter:heating:p8730
    Here is how it looks in my system:
    image
  • You could also check the openhab logfile. Maybe you can see something there. Possibly you have to increase the log level like documented here

regards Peter

I have done the configuration via files.
My openHAB version is: 2.4.0 Stable
And now here was the problem: In PaperUI i saw no BSB-LAN Bridge Thing.
In the log-file i saw (after a restart):

2019-10-09 22:31:58.012 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/share/MD0_DATA/.qpkg/OpenHab/addons/org.openhab.binding.bsblan-2.5.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.bsblan [215]
  Unresolved requirement: Import-Package: com.google.gson; version="[2.8.0,3.0.0)"

After downloading the gson.jar to the addons Folder nothing happens.
So i installed the dependency manually on the karaf console:

bundle:install http://central.maven.org/maven2/com/google/code/gson/gson/2.8.6/gson-2.8.6.jar

And now it works.
Thank you very much.

p.s. I am pretty new to openHAB and I do not know exactly what I did. Maybe someone can enlighten me?

Thanks, nice to hear.

1 Like

Hey Peter,

nice binding. I also own a adapter and now try to using it with your binding. I can read almost everything i want , but if try to set a value then my log output the following.

2020-03-05 07:42:13.787 [ome.event.ItemCommandEvent] - Item 'BsbParameter710NumberValue' received command 22

2020-03-05 07:42:13.821 [nt.ItemStatePredictedEvent] - BsbParameter710NumberValue predicted to become 22

2020-03-05 07:42:13.841 [vent.ItemStateChangedEvent] - BsbParameter710NumberValue changed from 21.0 to 22

2020-03-05 07:42:13.890 [INFO ] [.bsblan.internal.api.BsbLanApiCaller] - Failed to set parameter 710 to '22': status = READ_ONLY

2020-03-05 07:42:13.896 [WARN ] [ernal.handler.BsbLanParameterHandler] - Failed to set parameter 710 to '22' for channel 'number-value'

2020-03-05 07:42:17.323 [vent.ItemStateChangedEvent] - BsbParameter710NumberValue changed from 22 to 21.0

And now the big question, why is it read only? Did i miss something ?
Item and Thins and sitemap are copy paste from the Example on github.

Regards

Sebastian

Hi,

can you check whether you have flashed the adapter as read only?
See your BSB_lan_config.h

kind regards
Peter

Hi Peter,

yes i did flashed it in readonly… :rofl:

I thought there is a flag like this but did not find it. It is working now! Thank you very much!

But one more question. Will there be an update of your addon or will it stay on snapshot 2.5.0???

Hi,

Nice to hear - will update the docs.

I can update the binding if I find some time :slight_smile:
Currently a PR is waiting for review to be integrated as official binding.

2 Likes

Hi Peter,

sounds great! Hurry up with the PR :slight_smile:

Now it looks like this.

Thank you

Hello Peter
it’s me again. First of all thank you for your binding.
I noticed a small problem: In order to be able to analyze my heating, I logged some key data in a database.
For example, I wanted to Log the status of the solar system on every change so that I can see when it is loading or not. Now I noticed that “phantom data” are delivered quite often via your binding.
I assume that this is a problem of binding, because after I found out, I reactivated the “old items” (queried with http) and logged them. And these entries are correct.
I also found that this phantom data “only” arises from Channels of type Description.
For Channels of Type Number-Value, it fits me.
Can you confirm that or is it a local problem?
However, I still use your 2.5.0-Snapshot.
Here is an excerpt of the corresponding items and the associated database entries:

Item:
String	BsbLanParameter8007StatusSolarDescription	"Status Solar [%s]"		<solarplant>	(BSBLan)	{channel="bsblan:parameter:heating:p8007:description"}
DB-Entrys:
2020-04-03 08:39:32.035	Ladung Pufferspeicher
2020-04-03 08:40:07.954	1970-01-01T00:00:59
2020-04-03 08:40:07.962	Ladung Pufferspeicher
2020-04-03 08:40:44.557	1970-01-01T00:00:59
2020-04-03 08:40:44.565	Ladung Pufferspeicher
.
.
2020-04-03 09:13:28.094	Ladung Pufferspeicher
2020-04-03 09:14:05.889	1970-01-01T00:00:59
2020-04-03 09:14:05.894	Ladung Pufferspeicher
2020-04-03 09:14:41.908	1970-01-01T00:01:03
2020-04-03 09:14:41.915	Einstrahlung ungenügend
2020-04-03 09:15:18.570	1970-01-01T00:01:03
2020-04-03 09:15:18.576	Einstrahlung ungenügend
.
.
2020-04-03 09:24:36.410	Einstrahlung ungenügend
2020-04-03 09:25:13.720	Einstrahlung ungenügend
2020-04-03 09:25:13.818	Einstrahlung ungenügend
2020-04-03 09:25:49.693	1970-01-01T00:01:03
2020-04-03 09:25:49.702	Einstrahlung ungenügend
2020-04-03 09:26:25.939	1970-01-01T00:01:03
2020-04-03 09:26:25.947	Einstrahlung ungenügend
2020-04-03 09:27:02.956	1970-01-01T00:01:03
2020-04-03 09:27:02.961	Einstrahlung ungenügend
2020-04-03 09:27:40.140	1970-01-01T00:00:59
2020-04-03 09:27:40.144	Ladung Pufferspeicher
2020-04-03 09:28:16.525	1970-01-01T00:00:59
2020-04-03 09:28:16.527	Ladung Pufferspeicher
2020-04-03 09:28:53.820	1970-01-01T00:00:59
.
.

Item:
String	hz_status_solar		"OLD Status Solar [%s]"		<solarplant>	(BSBLan)	{http="<[http://192.168.0.90/8007:25000:JS(bsbinput_string.js)]"}
DB-Entrys:
2020-04-03 08:40:17.012	Ladung Pufferspeicher
2020-04-03 09:14:34.593	Einstrahlung ungenügend
2020-04-03 09:27:28.369	Ladung Pufferspeicher


----------------


Item:
Number	BsbLanParameter8323DiagnoseErzeugerGeblasedrehzahlNumberValue	"Gebläsedrehzahl [%s]"	  <fan>		(BSBLan)	{channel="bsblan:parameter:heating:p8323:number-value"}
DB-Entrys:
2020-04-03 09:30:06.738	2721
2020-04-03 09:30:43.840	2715
2020-04-03 09:33:57.882	2671
2020-04-03 09:34:35.249	2658

Item:
Number	hz_fan_speed		"OLD Gebläsedrehzahl [%s]"	<fan>	(BSBLan)	{http="<[http://192.168.0.90/8323:30000:JS(bsbinput.js)]"}
DB-Entrys:
2020-04-03 09:29:59.821	2721
2020-04-03 09:30:31.269	2715
2020-04-03 09:34:23.761	2658

Hi,

the binding itself does not handle the cannels differently. Maybe openhab itself is handling StringType updates differently than updates of DecimalTypes (e.g. because of a different value comparison – sadly I don’t know the logic in behind). I will have to analyze this more deeply.

Just a question: I assume you are using a persistence add-on to write the values to the database. Which strategy are you using? everyChange or everyUpdate?

https://www.openhab.org/docs/configuration/persistence.html

Regards

Peter

I use the persistence-jdbc-mariadb - 1.14.0 add-aon and in all cases i use everyChange.
Thank you for your support.

Hi,

I have just tried to reproduce the issue but everything worked as expected - no duplicate entries were created in the database.
The only issue I had, was that creating the table for the string item failed with
java.sql.SQLException: Column length too big for column 'value' (max = 21844); use BLOB or TEXT instead Query: CREATE TABLE IF NOT EXISTS item0001 (time TIMESTAMP(3) NOT NULL, value VARCHAR(65500), PRIMARY KEY(time)) Parameters: []
After creating the table manually with a value column as TEXT everything worked smoothly.

I tried it on an openhab 2.5.1 with

  • bsblan.items

    Number BsbParameter710NumberValue  { channel="bsblan:parameter:heating:p710:number-value" } 
    String BsbParameter8000Description { channel="bsblan:parameter:heating:p8000:description" }
    
  • jdbc.persist

    Strategies {
       default = everyChange
    }
    
    Items {
       BsbParameter710NumberValue : strategy = everyChange
       BsbParameter8000Description : strategy = everyChange
    }
    

Do you have any issued in the openhab.log file?

Hello Peter,
sorry about the late reply.
My openhab runs on a QNAP. Unfortunately, with this setup I always come across problems that are not easy to solve or very strange behavior that I don’t really see through.
Now, to make a long story short:
After Deinstalling openHAB and all bindings, clear the Cache and Reinstalling it seems that it works as expected.
Sorry to bother you with this and thank you for your help and work