cedricboon / openhab-addons

Add-ons for openHAB 2.x
Eclipse Public License 2.0
6 stars 5 forks source link

[velbus] Possible Bug with Velbus Binding IDs #21

Closed smoothquark closed 4 years ago

smoothquark commented 4 years ago

Hi Cedric. Thanks for a great binding, which I have been testing and playing with before committing myself to purchase a Velbus system. I am using 2.5.2.202002151409.

Essentially, I changed my ISP and router and rebooted my RPi running OpenHABian. There were some errors recognising my Velbus modules, and I eventually got it to recognise. However, the IDs had changed, and I had to amend my .items and .rules files. I thought the IDs were fixed and obtained from the modules themselves?

Expected Behaviour

IDs should remain the same after reboot/rescan

Current Behaviour

IDs have changed requiring amendments to .items and .rules files

System

RPi3B+ OpenHABian

smoothquark commented 4 years ago

Hmm... My mistake. The Velbus module IDs are OK. It is the serial bridge ID that changed.

MDAR commented 4 years ago

However, the IDs had changed, and I had to amend my .items and .rules files. I thought the IDs were fixed and obtained from the modules themselves?

The full ID for newly discovered Items is based on the System name for the Thing Bridge.

So if you created a new Bridge in PaperUI, it would give it a new ID.

So lets say that the first time you did this, the Bridge ID was

abcdefg

any resulting Velbus Things (and subsequent channels) would have that in their ID

Say you added a VMBGP1 from HEX address 0F

the ID might then be

velbus:vmbgp1:abcdefg:0F

Which you then used in your .Items files to link to the Thing

So if you wiped everything and started again.

A new Bridge Thing might have the ID of

gfedbca

so new Things would have the ID

velbus:vmbpg1:gfedcba:0F

I've never tried, but I would suggest that the way around this would be to add the Bridge Thing with a text file, so you can define the ID

Just as Cedric has shown in his HowTo page

Bridge velbus:bridge:VelbusSerialBridge [ port="COM1" ]

or

Bridge velbus:bridge:VelbusSerialBridge [ port="/dev/ttyACM0" ]

or

Bridge velbus:bridge:VelbusSerialBridge [ port="/dev/serial/by-id/usb-Velleman_Projects_VMB1USB_Velbus_USB_interface-if00" ]

Let PaperUI add the discovered things (because that is super easy)

Then I guess the ID for new Things would be something like

velbus:vmbgp2:VelbusSerialBridge:0F

MDAR commented 4 years ago

@cedricboon

What would the .Things file look like for a network bridge?

Would this be about right?

`Bridge velbus:networkbridge:VelbusNetworkBridge [ address="127.0.0.1" port="6000" ]

Update

A bit of fiddling about and I have this working

Bridge velbus:networkbridge:VelbusNetworkBridge "Velbus Network Bridge - Loopback" @ "Control" [ address="127.0.0.1", port=6000 ]

I'm going to use this from now on :-)