Cross-Binding Events

95 views
Skip to first unread message

teichsta

unread,
Jan 18, 2011, 7:35:22 AM1/18/11
to openhab
Hi,

yesterday i came across the following challange:

I want values from the onewire-binding send to the knx-binding
(Temperature values). But how to accomplish this?

The requirements are:

1) reading values from onewire bus (done, by onewire binding)
2) beeing able to write to the knx bus (done, by knx binding)
3) configure specific items to be posted to another binding (open)

A first attempt could be to enhance the onewire-binding configuration
with the according knx-address:

{ onewire="26.4F1A44000000#temperature#writeTo='5/1/24'" }

but such a configuration presumes a specific binding to be available
which coupples both of them very closely. Another attempt would be to
enhance the configuration syntax like that:

{ onewire="26.4F1A44000000#temperature knx="5/1/24"}

Following that attempt we have to introduce a more complex
configuration semantic (first binding = reading, second binding =
writing), which could be a shortterm solution.

What do you think could be the best solution?

Cheers,

Thomas E.-E.

Kai Kreuzer

unread,
Jan 18, 2011, 8:45:37 AM1/18/11
to ope...@googlegroups.com
Hi,

This should actually work out of the box; the items-files already
support multiple bindings for an item, such as

{ onewire="26.4F1A44000000#temperature", knx="5/1/24" }

(see the items grammar definition at
http://code.google.com/p/openhab/source/browse/bundles/model/org.openhab.model.item/src/org/openhab/model/Items.xtext)

Both bindings will be active for this item. As the KNX binding is
bi-directional, events received from onewire will be automatically
sent to KNX. In more detail:

1. the onewire binding receives a value and sends an "update" event to
the openHAB event bus.
2. the KNX binding sees the "update" event on the openHAB event bus
and sends it out to KNX on the configured group address.

As all communication is done over the openHAB event bus, the two
bindings are completely isolated and decoupled from each other.

Regards,
Kai

Quoting teichsta <teic...@googlemail.com>:

> --
> You received this message because you are subscribed to the Google
> Groups "openhab" group.
> To post to this group, send email to ope...@googlegroups.com.
> To unsubscribe from this group, send email to
> openhab+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/openhab?hl=en.
>
>


teichsta

unread,
Jan 18, 2011, 8:51:44 AM1/18/11
to openhab

> This should actually work out of the box; the items-files already  
> support multiple bindings for an item, such as

great ... topic solved :-)

michae...@gmail.com

unread,
Sep 11, 2014, 5:39:19 AM9/11/14
to ope...@googlegroups.com
Hi!


Am Dienstag, 18. Januar 2011 14:45:37 UTC+1 schrieb Kai Kreuzer:
Hi,

This should actually work out of the box; the items-files already  
support multiple bindings for an item, such as

{ onewire="26.4F1A44000000#temperature", knx="5/1/24" }

I recently installed openHAB and tested this setup. I have several 1-wire sensors in my items file. The sensors work find and I get temperature readings on the web interface. Then I added a group address to one sensor, which led to a curious problem:

11:22:47.185 INFO  runtime.busevents[:26] - tWC state updated to 25.875
11:22:47.190 INFO  tuwien.auto.calimero[:43] - [EventAdmin Async Event Dispatcher Thread] link 127.0.0.1:3671: send message to 4/2/10, wait for confirmation
11:22:47.197 INFO  tuwien.auto.calimero[:43] - [KNXnet/IP receiver] link 127.0.0.1:3671: confirmation of 4/2/10
11:22:47.202 DEBUG o.o.b.k.i.bus.KNXBinding[:144] - Wrote value '25.875' to datapoint 'command DP 4/2/10 tWC, DPT main 0 id 9.001, low priority'
11:22:47.231 INFO  tuwien.auto.calimero[:43] - [KNXnet/IP receiver] link 127.0.0.1:3671: indication from 0.0.0
11:22:47.237 INFO  runtime.busevents[:22] - tWC received command 25.88
11:22:47.275 WARN  o.o.b.o.i.OneWireBinding[:265] - couldn't write to path 28.E14DCE040000

The way I understand of what is happening here is that we get an update for the tmperature from 1-wire and send it to the group address 4/2/10. Then we receive our own knx message and try to update the 1-wire sensor with the temperature that was just received from the knx bus. This is of cause impossible.
This wouldn't be much of a problem, but with more than one 1-wire temperature sensor, the update of the other sensors fails:

11:29:28.382 INFO  runtime.busevents[:26] - tWC state updated to 25.875
11:29:28.387 INFO  tuwien.auto.calimero[:43] - [EventAdmin Async Event Dispatcher Thread] link 127.0.0.1:3671: send message to 4
/2/10, wait for confirmation
11:29:28.394 INFO  tuwien.auto.calimero[:43] - [KNXnet/IP receiver] link 127.0.0.1:3671: confirmation of 4/2/10
11:29:28.397 DEBUG o.o.b.k.i.bus.KNXBinding[:144] - Wrote value '25.875' to datapoint 'command DP 4/2/10 tWC, DPT main 0 id 9.00
1, low priority'
11:29:28.424 INFO  tuwien.auto.calimero[:43] - [KNXnet/IP receiver] link 127.0.0.1:3671: indication from 0.0.0
11:29:28.431 INFO  runtime.busevents[:22] - tWC received command 25.88
11:29:28.449 ERROR o.o.b.o.i.OneWireBinding[:176] - couldn't establish network connection while reading '28.503CD1040000'
java.net.SocketException: Socket closed
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:116)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:132)
        at java.io.DataOutputStream.writeInt(DataOutputStream.java:199)
        at org.owfs.jowfsclient.internal.OwfsClientImpl.sendRequest(OwfsClientImpl.java:510)
        at org.owfs.jowfsclient.internal.OwfsClientImpl.read(OwfsClientImpl.java:313)
        at org.openhab.binding.onewire.internal.OneWireBinding.execute(OneWireBinding.java:144)
        at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:156)
        at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:173)
11:29:28.471 WARN  o.o.b.o.i.OneWireBinding[:265] - couldn't write to path 28.E14DCE040000
11:29:28.473 INFO  runtime.busevents[:26] - tFlur state updated to Undefined

I get this behavior with release 1.5.0 and as well with the 1.6.0 snapshot from yesterday. Here is the relevant excerpt from my items file:

Number  tFlur   "Temp. Flur [%.1f °C]"  <temperature>   (gTemperature)  { onewire="28.503CD1040000#temperature", knx="4/2/20" }
Number  tWC     "Temp. WC [%.1f °C]"    <temperature>   (gTemperature)  { onewire="28.E14DCE040000#temperature", knx="4/2/10" }
/*
Number  tKueche "Temp. Kueche [%.1f °C]"        <temperature>   (gTemperature)  { onewire="28.C8F9CD040000#temperature" }
Number  tWzN    "Temp. Wohnzimmer N [%.1f °C]"  <temperature>   (gTemperature)  { onewire="28.CE1113050000#temperature" }
Number  tWzS    "Temp. Wohnzimmer S [%.1f °C]"  <temperature>   (gTemperature)  { onewire="28.3530CE040000#temperature" }
Number  tWigaN  "Temp. Wintergarten N [%.1f °C]"        <temperature>   (gTemperature)  { onewire="28.9D50CE040000#temperature" }
Number  tWigaS  "Temp. Wintergarten S [%.1f °C]"        <temperature>   (gTemperature)  { onewire="28.7F39CD040000#temperature" }
Number  tHkN    "Temp. Heimkino N [%.1f °C]"    <temperature>   (gTemperature)  { onewire="28.8E4414050000#temperature" }
Number  tHkS    "Temp. Heimkino S [%.1f °C]"    <temperature>   (gTemperature)  { onewire="28.9D50CE040000#temperature" }
*/

Is there any error in my setup or is this a bug? I would appreciate any hint in how to fix this.

Regards,
Michael


Reply all
Reply to author
Forward
0 new messages