OpenWebNet (BTicino/Legrand) Binding (Beta) [4.1.0;5.0.0)

logo

This is the beta version of the openwebnet / BTicino binding.
Updates will be published here to test new features/bugfixes before submission to the official OH repository.

PLEASE NOTE
When no new features are available for testing, this binding Beta version will be removed from the Marketplace and the links to the jars below will be removed, to avoid confusion.

Installation

Uninstall the official openwebnet binding first if you want to install this beta version.
Installation can be done via Marketplace or manually:

Marketplace installation

Search and install the openwebnet binding from the Marketplace.
When installing from marketplace dependencies are solved automatically.

Manual installation

  1. activate Dependencies from Karaf console:
    * feature:install openhab-transport-serial
    * feature:install openhab-core-io-transport-upnp
  2. copy the JAR file to the openHAB addons folder. On openHABian/RaspberryPi and Linux it’s under /usr/share/openhab/addons/

Debugging and Log Files

To help testing and provide feedbacks set log level to DEBUG:

  • from Karaf console:
    • log:set DEBUG org.openhab.binding.openwebnet
    • log:set DEBUG org.openwebnet4j

Both log:set commands are important to log OWN commands exchanged between the binding and the OpenWebNet gateway.

Log files are written to either userdata/log (manual setup) or /var/log/openhab (Linux and RaspberryPi image setup) and can be accessed using standard text reading software.

The interesting file to provide for feedback is openhab.log (events.log is not so important).

Changelog

changes in OH 4.1.0.beta2

  • Fixed: handling of general/area light update events

changes integrated in OH 4.1.0 (December 2023)

  • Added: Energy: totalizers channels for energy kWh consumed for today and current month

changes integrated in OH 4.0.0 (July 2023)

  • Added: date time synchronization for bus_gateway
  • Changed: improved shutterRun calibration
  • Fixed: switch channel update
  • Fixed: support for Thermo 4-zones CU
  • Fixed: Thermo CU state channels updates
  • Fixed: reset zones’ alarm state when system is armed
  • (plus others: see OH 4 release notes)

changes integrated in OH 3.4.0 (December 2022)

  • Added initial support for Alarm (WHO=5)
  • Fixed: Thermo: zone/CU address set correctly during discovery
  • Added support for basic Scenarios (WHO=0)

changes integrated in OH 3.3.0 (June 2022)

  • Added support for Thermo Central Unit (tested 99-zone thermo central unit BTicino product code: 3550)
  • Added support for sending Auxiliary (AUX) commands/messages to the bus (WHO=9)
  • Fixed: improved Things synchronization at boot / reconnect

changes integrated in OH 3.2.0 (December 2021)

  • Added support for Dry Contact / IR sensors
  • Fixed: USB shutters are not refreshed at boot

Resources

2 Likes

what a great enhancement, thank you!

perhaps i am doing sth wrong, i cannot see the configured things and the items stay “NULL”

i removed the old binding, installed the 3.2.0m5 version from marketplace and configured my things-file with

bus_dry_contact_ir            Hoftor_Kt                   "Hoftor_Kt"                     @ "Kontakte"    [ where="316" ]

but when saving the file it does not appear in the main-ui at things.

this is the corresponding items-file:

Switch iHoftor_Kt "Hoftor" <error> (iG_AlarmKontakte, iG_Hoflicht) { channel="openwebnet:bus_dry_contact_ir:bticino:Hoftor_Kt:sensor" }

and this stays “NULL”

i tried to reboot, all other bticiono things and items work but the contact-items dont come up. i dont see any error message or og entry depending this.

i switched now

discoveryByActivation=true

and then see in the inbox when a contact switches for example:
grafik

this is an indication the new binding from marketplace is not the active one.
I suggest you remove the currently installed openwebnet binding, stop openHAB, start openHAB and then re-install the one from the Marketplace.

All my dry contacts OH2 settings are now working again with OH3. No changes needed . Sitemap and rules all OK.

Great work @massi

I often wondered why it was not requested by more people in the past. With this capability any simple switch or basic relay can communicate with openHAB via the openwebnet BUS. This opens up lots more possibilities. I use it for sensing alarm state, weather sensors, garage door position/movement sensors.

I noticed that the thing stays unknown but the assoicated item is OK. Is this the expected behaviour?

edit… thing changes to online after the sensor state changes


thing

Thing bus_dry_contact_ir 35 "High gust sensor" [ where="35" ]

item

Switch Wind_Sensor "Wind sensor [MAP(WindSensor.map):%s]" <wind> {channel="openwebnet:bus_dry_contact_ir:gateway:35:sensor"}

This enhancement has been just added to the 3.2 branch, amazingly fast!

@bastler are you able to run the binding correctly? you can either install the one from marketplace or from official OH snapshot.

There are 8 days to test it before it gets released in 3.2 official.

i have some difficulties that i try to describe:
first of all, two days ago i accidentally installed the official distribution binding instead of the marketplace version - that was the reason why then dry contacts did not work at all.

now i installed the marketplace binding and it started working. contacts now are found:

2021-12-12 17:25:38.063 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'openwebnet:bus_dry_contact_ir:bticino:Buero_Tuere_Kt' changed from UNINITIALIZED to INITIALIZING

2021-12-12 17:25:38.069 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'openwebnet:bus_dry_contact_ir:bticino:Buero_Tuere_Kt' changed from INITIALIZING to UNKNOWN: Waiting state update...

but as mark already noted they stay unknown as long as they are not switched (it seems the asking of the state at boot is missing, i do that with #25354## for contact 54 for example)

as soon as the contact is switched it comes online:

2021-12-12 17:29:30.225 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'openwebnet:bus_dry_contact_ir:bticino:Buero_Tuere_Kt' changed from UNKNOWN: Waiting state update... to ONLINE

2021-12-12 17:29:30.242 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'iBuero_Tuere_Kt' changed from NULL to ON

but when i reboot the rpi the complete binding does not start again (not one thing from this binding in the things-list, no entry for the binding in the karaf-list, although binding in marketplace is marked as “installed”). then i remove it (from marketplace) and then again click to install it again. now things come up again.

but, as soon as i click “install” i receive this in the log (at each install, even the first install):

java.lang.RuntimeException: Error resolving artifact org.openhab.core.features.karaf:org.openhab.core.features.karaf.openhab-core:xml:features:3.2.0-SNAPSHOT: [Could not find artifact org.openhab.core.features.karaf:org.openhab.core.features.karaf.openhab-core:xml:features:3.2.0-SNAPSHOT] : mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/3.2.0-SNAPSHOT/xml/features

	at org.apache.karaf.features.internal.service.RepositoryImpl.load(RepositoryImpl.java:121) ~[?:?]

	at org.apache.karaf.features.internal.service.RepositoryImpl.<init>(RepositoryImpl.java:51) ~[?:?]

	at org.apache.karaf.features.internal.service.RepositoryCacheImpl.create(RepositoryCacheImpl.java:51) ~[?:?]

	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.getFeatureCache(FeaturesServiceImpl.java:611) ~[?:?]

	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.ensureCacheLoaded(FeaturesServiceImpl.java:582) ~[?:?]

	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.getRepository(FeaturesServiceImpl.java:530) ~[?:?]

	at org.apache.karaf.kar.internal.KarServiceImpl.findMissingDependency(KarServiceImpl.java:165) ~[?:?]

	at org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:116) ~[?:?]

	at org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:95) ~[?:?]

	at org.openhab.core.addon.marketplace.karaf.internal.community.CommunityKarafAddonHandler.installFromCache(CommunityKarafAddonHandler.java:159) ~[?:?]

	at org.openhab.core.addon.marketplace.karaf.internal.community.CommunityKarafAddonHandler.install(CommunityKarafAddonHandler.java:106) ~[?:?]

	at org.openhab.core.addon.marketplace.internal.community.CommunityMarketplaceAddonService.install(CommunityMarketplaceAddonService.java:235) ~[?:?]

	at org.openhab.core.io.rest.core.internal.addons.AddonResource.lambda$1(AddonResource.java:223) ~[?:?]

	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]

	at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]

	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]

	at java.lang.Thread.run(Thread.java:829) [?:?]

Caused by: java.io.IOException: Error resolving artifact org.openhab.core.features.karaf:org.openhab.core.features.karaf.openhab-core:xml:features:3.2.0-SNAPSHOT: [Could not find artifact org.openhab.core.features.karaf:org.openhab.core.features.karaf.openhab-core:xml:features:3.2.0-SNAPSHOT]

	at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.configureIOException(AetherBasedResolver.java:803) ~[?:?]

	at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:774) ~[?:?]

	at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:657) ~[?:?]

	at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:598) ~[?:?]

	at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:565) ~[?:?]

	at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:555) ~[?:?]

	at org.ops4j.pax.url.mvn.internal.Connection.getInputStream(Connection.java:123) ~[?:?]

	at java.net.URL.openStream(URL.java:1165) ~[?:?]

	at org.apache.karaf.features.internal.service.RepositoryImpl.load(RepositoryImpl.java:114) ~[?:?]

	... 17 more

	Suppressed: shaded.org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact org.openhab.core.features.karaf:org.openhab.core.features.karaf.openhab-core:xml:features:3.2.0-SNAPSHOT

		at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:403) ~[?:?]

		at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:215) ~[?:?]

		at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:192) ~[?:?]

		at shaded.org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:247) ~[?:?]

		at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:767) ~[?:?]

		at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:657) ~[?:?]

		at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:598) ~[?:?]

		at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:565) ~[?:?]

		at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:555) ~[?:?]

		at org.ops4j.pax.url.mvn.internal.Connection.getInputStream(Connection.java:123) ~[?:?]

		at java.net.URL.openStream(URL.java:1165) ~[?:?]

		at org.apache.karaf.features.internal.service.RepositoryImpl.load(RepositoryImpl.java:114) ~[?:?]

		at org.apache.karaf.features.internal.service.RepositoryImpl.<init>(RepositoryImpl.java:51) ~[?:?]

		at org.apache.karaf.features.internal.service.RepositoryCacheImpl.create(RepositoryCacheImpl.java:51) ~[?:?]

		at org.apache.karaf.features.internal.service.FeaturesServiceImpl.getFeatureCache(FeaturesServiceImpl.java:611) ~[?:?]

		at org.apache.karaf.features.internal.service.FeaturesServiceImpl.ensureCacheLoaded(FeaturesServiceImpl.java:582) ~[?:?]

		at org.apache.karaf.features.internal.service.FeaturesServiceImpl.getRepository(FeaturesServiceImpl.java:530) ~[?:?]

		at org.apache.karaf.kar.internal.KarServiceImpl.findMissingDependency(KarServiceImpl.java:165) ~[?:?]

		at org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:116) ~[?:?]

		at org.apache.karaf.kar.internal.KarServiceImpl.install(KarServiceImpl.java:95) ~[?:?]

		at org.openhab.core.addon.marketplace.karaf.internal.community.CommunityKarafAddonHandler.installFromCache(CommunityKarafAddonHandler.java:159) ~[?:?]

		at org.openhab.core.addon.marketplace.karaf.internal.community.CommunityKarafAddonHandler.install(CommunityKarafAddonHandler.java:106) ~[?:?]

		at org.openhab.core.addon.marketplace.internal.community.CommunityMarketplaceAddonService.install(CommunityMarketplaceAddonService.java:235) ~[?:?]

		at org.openhab.core.io.rest.core.internal.addons.AddonResource.lambda$1(AddonResource.java:223) ~[?:?]

		at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]

		at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]

		at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]

		at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]

		at java.lang.Thread.run(Thread.java:829) [?:?]

Caused by: shaded.org.eclipse.aether.resolution.ArtifactResolutionException: Error resolving artifact org.openhab.core.features.karaf:org.openhab.core.features.karaf.openhab-core:xml:features:3.2.0-SNAPSHOT

	at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:413) ~[?:?]

	at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:215) ~[?:?]

	at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:192) ~[?:?]

	at shaded.org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:247) ~[?:?]

	at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:767) ~[?:?]

	at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:657) ~[?:?]

	at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:598) ~[?:?]

	at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:565) ~[?:?]

	at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:555) ~[?:?]

	at org.ops4j.pax.url.mvn.internal.Connection.getInputStream(Connection.java:123) ~[?:?]

	at java.net.URL.openStream(URL.java:1165) ~[?:?]

	at org.apache.karaf.features.internal.service.RepositoryImpl.load(RepositoryImpl.java:114) ~[?:?]

	... 17 more

as long as i do not reboot the contacts seem to work as expected when switched.

if you ask state using the OpenWebNet client using this message:
*#25*30##
what is the answer?

this look like more as a OH Marketplace problem.
I suggest you move the RaPi to snapshot for the moment and leave the Marketplace until 3.2 is released.

strange, should work, didnt know this command but seems to ask for all states with one command.

but seems not to work at boot, not just one contact comes online.

sorry i dont understand. do you mean i should download the *.kar file from git and put it in addon-folder? (this i did before, not quite sure but i think i had the same problem then)

side note: i realize that when i send *#25*30## not all contacts answer the state. i receive feedback from 32 contacts, but 7 dont answer, even not when sending the command several times. cannot see the 7 contacts have any common,

Hi @massi, could you please add a link to the according PR for this add-on?

Please note that this is required according to the publishing rules for the marketplace - thanks!

so when OH boots: 32 contacts become online and their item state is updated, only those 7 remain offline and linked items remain “unknown” ?
If this is specific to your system I would not implement any workaround here, as message *#25*30## which is sent at reboot , should be enough to refresh state of all contacts.

Since this enhancement has been already merged for 3.2 release I would remove this alpha version of the binding

actually it is very hard for me to test because this alpha binding does not start at boot. i have to uninstall it and install again. i never bevore realized such problems when i installed a testing binding. problem then is that most rules (jython) do not work because all the items are not present at boot and the rules will not be created.

i am not at home at the moment so cannot test again but i realized before that not one contact comes online when reinstalled the binding from marketplace. so i tried to send the own command manually from own-web-net client. when sending *#25*30## many but not all contacts come online. but when asking this contacts direct, for example *#25*354## then it answeres the state and comes online.

Ok then I suggest you do more tests with the official 3.2.0 due Dec24th (or 3.2.0.RC1 already available if you do not want to wait), and skip for now the Marketplace version that may have some problem at the boot (even if my code is the same)

now i uninstalled the marketplace version and installed the 3.2.0rc1 as suggested.

all contacts work as expected, they are found and all state requests work now.

only on reboot it takes very long until the states are reported (or lets say until they come online), it takes about 6 minutes. all other items are online within the first minute. so meanwhile all rules are loaded and when they need an contact-state they dont work properly.

Yup. On restart openwebnet things dissappear and I have uninstall and reinstall the binding to get them back. And in my case reboot mh202 or some scenarios stop.

As the PR was merged and so is included in official 3.2, I suggest to suppress this version from the marketplace.

ok, is it enough to remove the published tag ?

Reading @ysc announcement this is what I understand.