openhab-addons icon indicating copy to clipboard operation
openhab-addons copied to clipboard

add support for generic command frame (WHO=? WHAT=? WHERE=?)

Open llegovich opened this issue 6 years ago • 8 comments

Expected Behavior

Create a couple of generic things to post generic command frames on the OWN bus and gather the returned information, like for example:

*1*16*77## (turn light 77 on for 15 minutes).

This would allow to benefit of full OWN features while enhancing the binding more and more.

To gather feedback from the system, a specific channel should be added in order to intercept all events filtered by a specified mask. Here below how the things and items may be specified to allow this:

// things
bus_generic_command myOWNCommand [ WHO="1", WHAT="16", WHERE="77" ]
bus_event_capture myOWNEvent [ WHO="1", WHERE="77" ]

// items
Switch mySwitch { channel="openwebnet:bus_generic_command:mybridge:myOWNCommand:genericcmd" }
String myEvent { channel="openwebnet:bus_event_capture:mybridge:myOWNEvent:event" }

// usage (in rules)
mySwitch.sendCommand(ON)   // sends the "*1*16*77##" command on the bus
var s = myEvent.state   // when updated contains the return state or WHAT value

This may be useful also for debugging purposes.

llegovich avatar Jan 28 '19 14:01 llegovich

This function is already expressed in this issue https://github.com/mvalla/openhab2-addons/issues/22

Gozilla01 avatar Jan 31 '19 19:01 Gozilla01

In fact the issue is similar, but I prefer the description and specification here, for example to divide WHO,WHAT,WHERE (to avoid wrong frames are sent on the BUS) and to have two separate channels or Things type for sending commands and receiving generic events.

mvalla avatar Feb 02 '19 14:02 mvalla

sorry, the usage in rules should be something like:

mySwitch.sendCommand("16") // sends the "*1*16*77##" command on the bus

(changed .sendCommand(ON) to .sendCommand("16") in the example. In fact, the sendCommand should be able to send a generic WHAT content).

llegovich avatar Feb 04 '19 08:02 llegovich

Assignee to me

Gozilla01 avatar Mar 23 '19 08:03 Gozilla01

Is possible to have a simple example how to configure properly the "generic device"

im try to get own command to the bus *6*10*4001## to open automatic door but to the bus is no sent anything

i have tryed this code to *.things file: device cancello "cancello" [who="6" , what="10" , where="4001"]

and this code to *.items file: Switch cancello "cancello" ["Switchable"] {channel="openwebnet:bus_command:MH202_0003500224b8:cancello:switch"}

the generic device in things list show "Unknown" state and no linked to relative item.

I have found this "v2.5.0.M3.pre12" in Gozilla01 repository but the bus bridge can't connect to the MH200N because is old relase

this version have a bus_command but i think is not same as device

Thanks Max

nix1986 avatar Oct 09 '19 13:10 nix1986

any progress on this? or should this work already?

admir86 avatar Jun 06 '20 14:06 admir86

Hi, as a workaround you can use this library Make a python script like this:

from OpenWebNet import OpenWebNet

server = OpenWebNet("192.168.1.35","20000","12345")
server.request("*6*10*4000##")

And use the Exec binding to run the script as you want in openhab.

francesco-re-1107 avatar Jun 07 '20 10:06 francesco-re-1107

Hi,

i have a similar problem with my new fresh installation of OH3. No support for the WHO=6. I found your solution @francesco-re-1107 and it's very interesting. The only problem is that i'm not so able with Python.

Can anyone specify all the steps to implement the script in the Exec binding from the beginning (starting from python setup)?

Thank you sooooo much!

mikigp avatar Feb 18 '23 20:02 mikigp