Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tcpudp] Integration with openHAB3 #89

Closed
sercasyr opened this issue May 1, 2021 · 21 comments
Closed

[tcpudp] Integration with openHAB3 #89

sercasyr opened this issue May 1, 2021 · 21 comments
Labels
question Further information is requested

Comments

@sercasyr
Copy link

sercasyr commented May 1, 2021

Hi, thanks for the contribution.
I haven't tried but I would like to use the TCP binding in OH3.
Can it be integrated in OH3 soon?
It looks the coding is finished.

@J-N-K
Copy link
Member

J-N-K commented May 1, 2021

SmartHome/J is compatible with openHAB 3. Just install the Repomanager and you can install the TCP binding in your openHAB installation.

If you need assistance, please ask.

@sercasyr
Copy link
Author

sercasyr commented May 1, 2021

Great!
It seems really easy to install. Thank you.
However, my question is about whether it will be included in the next official release of OH3.

Is it possible to get a .jar file (without having to compile it) instead of using the repomanager ? I like to keep my OH installation in "manual" mode (with the .jar files and the config files) so I can move it and update/change the addons manually.

Thanks again for the project.

@J-N-K
Copy link
Member

J-N-K commented May 1, 2021

You can download the .jar for the binding and it’s dependency from maven central

https://mvnrepository.com/artifact/org.smarthomej.addons.bundles/org.smarthomej.binding.tcpudp/3.1.1

https://mvnrepository.com/artifact/org.smarthomej.addons.bundles/org.smarthomej.commons/3.1.1

and drop them into your addons folder.

And no, they will not be part of the next openHAB release and most probably not of any future „official“ release. There is a reason why this is published here.

@J-N-K J-N-K changed the title Integration with openHAB3 [tcpudp] Integration with openHAB3 May 2, 2021
@J-N-K J-N-K added the question Further information is requested label May 2, 2021
@WiredLife
Copy link

@J-N-K
Wieso wird es nie in die offiziellen Addons mit einfließen?
Gibt es irgendwo eine Anleitung wie ich die .things und items für das TCP UDP Binding anlegen muss?

@J-N-K
Copy link
Member

J-N-K commented May 2, 2021

The cofiguration is very similar to that of the http binding. You can have a look here.

The main difference is, that the thing is names client instead of url. All parameters are described here: https://github.com/smarthomej/addons/tree/main/bundles/org.smarthomej.binding.tcpudp The required parameters are host, portandprotocol`.

The main difference for channels is that there is no stateExtension and commandExtension because that does make no sense for this binding. You must configure stateContent which is what the binding sends to request the state from the remote system.

I do recommend configuring via UI though, it's much less error prone than textal configuration. It also makes sure that all required parameters are set.

@WiredLife
Copy link

uh, i come from openhab 2 and was forced to upgrade to oh3 because of missing addons because of offline bintray
i dont know much about these gui stuff, i did all the configuration with files
the jar installation was successful but can you help me to add the thing?
i need something like this in oh2
String Fenster_Schlafzimmer_R {udp="<[192.168.179.31:*:]"}
the port is 17236

@J-N-K
Copy link
Member

J-N-K commented May 2, 2021

I don‘t know much about the „old binding“ and it‘s configuration. Please explain what you want to do, then I can probably help you.

@WiredLife
Copy link

i have an esp8266 which sends a string (1 or 0) via udp port 17236 to openhab and a rule which looks if its value is 1 or 0 and then do something
i need a receiver thing which listen on udp port 17236 and give the send string to the "String Fenster_Schlafzimmer_R" item

@J-N-K
Copy link
Member

J-N-K commented May 2, 2021

Receiving is not yet implemented, only sending and requesting. It‘s on my list though. You could open an issue for that as feature request, so you‘ll be notified when everything is ready.

@sercasyr
Copy link
Author

sercasyr commented May 2, 2021

You can download the .jar for the binding and it’s dependency from maven central

https://mvnrepository.com/artifact/org.smarthomej.addons.bundles/org.smarthomej.binding.tcpudp/3.1.1

https://mvnrepository.com/artifact/org.smarthomej.addons.bundles/org.smarthomej.commons/3.1.1

and drop them into your addons folder.

I have successfully installed and configure the binding in OH3. It's fairly easy.
Unfortunately my device acts as a client, so it needs openHAB to be the server.
I will have to wait until the receiving feature is implemented.

And no, they will not be part of the next openHAB release and most probably not of any future „official“ release. There is a >reason why this is published here.

I guess there is a reason for that, but it is not published (at least that I can see).

Thanks again!

@ianjenn
Copy link

ianjenn commented May 8, 2021

I am really struggling with this and it is frustrating as it is the last part that I need to move from OH2.5
I need to replicate this item which turns a IP relay on and off
Switch Solar_switch "wall plug" (All) { udp=">[ON:192.168.1.100:6723:12] >[OFF:192.168.1.100:6723:22]" }

I have added the jar files, created thing from the binding and added a channel. but it doesn't initialize and just doesnt work. Ideally I want to link to my items file in some way
this is what I have so far. Any thoughts would be greatly appreciated
`UID: tcpudp:client:91607768db
label: TCP/UDP Client
thingTypeUID: tcpudp:client
configuration:
protocol: UDP
delay: 0
port: 6723
host: 192.168.1.101
refresh: 30
timeout: 3000
bufferSize: 2048
channels:

  • id: thisrelay
    channelTypeUID: tcpudp:switch
    label: thisrelay
    description:
    configuration:
    onValue: "21"
    offValue: "22"`

@J-N-K
Copy link
Member

J-N-K commented May 9, 2021

Looks good. But in your "original" configuration the "ON"-value is 12, in your "new" configuration it is 21. Is that correct?

Which version are you using? And you should select "WRITE ONLY" as mode (under advanced). Otherwise the channel will be ignored because of the missing stateContent.

@ianjenn
Copy link

ianjenn commented May 9, 2021

the relay is dual relay and so 11 and 12 is on off for one and 21 and 22 for the other so yes, was playing with both.
The thing doesnt move to online. It stays at initializing, so something is wrong somewhere

@J-N-K
Copy link
Member

J-N-K commented May 9, 2021

UID: tcpudp:client:02856999bd
label: TCP/UDP Client
thingTypeUID: tcpudp:client
configuration:
  protocol: UDP
  delay: 0
  port: 4402
  host: localhost
  refresh: 30
  timeout: 3000
  bufferSize: 2048
channels:
  - id: switch
    channelTypeUID: tcpudp:switch
    label: Switch Test Channel
    description: ""
    configuration:
      mode: WRITEONLY
      onValue: "12"
      offValue: "22"

Works for me and sends 12 if the linked item receives an ON and 22 if the linked item receives an OFF. The thing goes to UNKNOWN immediately after I click on "Save" and turns ONLINE once the first command is send. If it stays in INITIALIZING there is something wrong. Please check the log.

Which version of openHAB are you suing and which version if the addon?

@ianjenn
Copy link

ianjenn commented May 9, 2021

thanks for replying, really appreciate that.
will have a look at the logs. I am on OH 3.1.0 and JAR 3.1.1
is that my proble, do I need oh 3.1.1 too

@J-N-K
Copy link
Member

J-N-K commented May 9, 2021

Which OH 3.1.0? M1, M2, M3, M4 or SNAPSHOT? There is no release of OH 3.1 at the moment.

@ianjenn
Copy link

ianjenn commented May 9, 2021

snapshot Build #2366 but I tried a few different through versions through openhabian and no difference

@J-N-K
Copy link
Member

J-N-K commented May 9, 2021

You need the addon-version 3.2.0-SNAPSHOT. Addon Version 3.1.x is only compatible for openHAB 3.0.x, 3.1.0 Milestones 1-3 and snapshort <2305 (see matrix here: https://github.com/smarthomej/addons).

You could download 3.2.0-SNAPSHOT here:

org.smarthomej.commons-3.2.0-SNAPSHOT.jar
org.smarthomej.binding.tcpudp-3.2.0-SNAPSHOT.jar

I would recommend to wait until tomorrow though, because I merged a bugfix in tcpudp today.

@ianjenn
Copy link

ianjenn commented May 9, 2021

whooop whoop. thanks J-N-K the updated jar worked perfectly. you are a star!

@J-N-K J-N-K closed this as completed May 9, 2021
@Krobar
Copy link

Krobar commented Dec 28, 2021

Receiving is not yet implemented, only sending and requesting. It‘s on my list though. You could open an issue for that as feature request, so you‘ll be notified when everything is ready.

Is receiving supported yet? Also is there any support for different character sets per connection with this new version?

@J-N-K
Copy link
Member

J-N-K commented Dec 28, 2021

Receiving is supported since version 3.2.3, see https://docs.smarthomej.org/3.2.8/org.smarthomej.binding.tcpudp.html

What do you mean by "character set"? Please open a new issue if this is independent from the receiver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants