Combining tcp/udp gpio binding


I am new to openhab and would like to ask the community if it is possible to combine the tcp/udp and gpio bindings:

tcp/udp would receive a command and according to the command a certain gpio pin would be set.
Is it possible to configure this via rules?


I can’t offer you a ready solution for how to do it, but I don’t see why you couldn’t. I’d go as far as to say that that’s what OpenHAB is built to do.
You’ll need an item that links to the tcp/upd binding and that changes according to the received info. Another item for the gpio binding and as you wrote yourself a rule that changes the “gpio-item” when the “tcp-item” changes.


To close this topic, if someone else starts from scratch here my solution:

I defined the items:

String UDP_IN  "%s"  {udp="<[*:'REGEX((.*))']"}  //udp listens for messages from
Switch GPIO_W "GPIO_W" { gpio="pin:26" }                   //gpio pin 26 definition

Here the rule:

//if udp input is equal string "K_ON" then gpio pin 26 is set to high
rule "GPIO_SET"
  Item UDP_IN changed
  if (UDP_IN.state == "K_ON")