Suggestion and help request for Openhab Serial Binding ; General Things integration

Hi Everyone,

  • Platform information:
  version: 3.1.0
  buildString: Release Build
locale: tr-TR
  configFolder: /etc/openhab
  userdataFolder: /var/lib/openhab
  logFolder: /var/log/openhab
  javaVersion: 11.0.12
  javaVendor: Azul Systems, Inc.
  javaVendorVersion: Zulu11.50+19-CA
  osName: Linux
  osVersion: 5.10.60-sunxi
  osArchitecture: arm
  availableProcessors: 4
  freeMemory: 109504424
  totalMemory: 194772992
  - astro
  - icalendar
  - icloud
  - kodi
  - remoteopenhab
  - serial
  - systeminfo
    ios: false
    android: false
    androidChrome: false
    desktop: true
    iphone: false
    ipod: false
    ipad: false
    edge: false
    ie: false
    firefox: false
    macos: false
    windows: true
    cordova: false
    phonegap: false
    electron: false
    nwjs: false
    webView: false
    webview: false
    standalone: false
    os: windows
    pixelRatio: 0.75
    prefersColorScheme: light
  isSecureContext: false
  locationbarVisible: true
  menubarVisible: true
    cookieEnabled: true
    deviceMemory: N/A
    hardwareConcurrency: 4
    language: en-US
      - en-US
      - en
      - tr
    onLine: true
    platform: Win32
    width: 1366
    height: 768
    colorDepth: 24
    touch: false
    pointerEvents: true
    observer: true
    passiveListener: true
    gestures: false
    intersectionObserver: true
    dark: dark
    filled: true
    pageTransitionAnimation: default
    bars: light
    homeNavbar: simple
    homeBackground: standard
    expandableCardAnimation: default
  userAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,
    like Gecko) Chrome/93.0.4577.63 Safari/537.36
timestamp: 2021-09-12T04:16:56.915Z

I’m trying to make a system I designed to work with Openhab. My system communicates with Canbus within itself.
Btw, Openhab <> Canbus Gateway command and communication formats do not have to be like this, I can stretch or change them as I want. We do not have 3rd party dependencies on electronics. We do the software, hardware designs (SCH and PCB design) of Canbus Modules ourselves. We also make our own production.
I am converting Canbus <> Uart(9600/115200) via a Gateway and communicating with Openhab via Serial Binding(@String).
It has a hierarchical structure (Module/Device ID(max 31 Module)) and assigned type identifiers for modules.

Basic features and capabilities of system components,
-Gateway Module:
a. CanBus <> UART communication conversion,
b. Firmware update of modules

-Input Module:
There are 2 different models.
VLI-20: There are 20 dry contact inputs.
VLI-35: There are 35 dry contact inputs.

Both modules have 2 different input trigger support in the form of short and long presses.
Short Press: Presses between 100 ms and 1 sec.
Long Press: >1 sec long presses. A threshold point can be set by limiting the max hold time.

The command format for Input Modules is as follows;

"VID_"                :Header
"11" (First 2 digits) :Type Identifier ("10"=VLI-20, "11"=VLI-35)
"01" (Next  2 digits) :Module ID (1st Input Module in this example)
"001"(Next  3 digits) :Input ID (Can be between 1 and 35 for Short press, 41 to 75 for Long press)
"01" (Last  2 digits) :Status (Can be "0" or "1".)

a. Short Press:
If a wall key is connected to Input Port 1 and a short press is made; The input module sends a command to the Gateway, and the Gateway to Openhab as a result:


If the same button is short pressed again, the last digit toggles and the Input Module sends a command to Openhab like this:


b.Long Press:
If the wall key connected to Gang No. 1 is pressed for a long time, the command sent is:


If the same button is long pressed again, the last digit toggles and sends a command to Openhab like this:


i.e. long press command; It is created by adding decimal “40” to the short press command.

Example for another Input port:
Likewise, short press on Gang 7:


short press again:


Long press:


long press again:


-Output Module:
An actuator module with 10 relays on it.

The command format for Output Modules is as follows;

I use 1 relay as a switch to control ON/OFF equipment such as lamps;

"O1_"                 : Header
"01" (First 2 digits) : Module ID (1st Output Module in this example)
"09" (Next 2 digits)  : Relay ID (9th relay of 1st Output Module)
"01" (Last 2 digits)  : Command (0=OFF or 1=ON.)

Openhab sends a command to the Gateway, and the Gateway to the 1st Output Module as follows:
If we want to turn ON the 3rd Relay of the 1st Output Module;


If we want to turn OFF the 3rd Relay of the 1st Output Module;


I use 2 relays for curtains, shutters (UP, DOWN, STOP ), and Thermal Actuators (OPEN, CLOSE), etc. to control equipment.
For Curtains, Shutters (UP, DOWN, STOP ):

I use 1 relay as STOP switch and a second relay as [NormallyOpen=UP] and [NormallyCLose=DOWN) switches;

"O1_"                 : Header
"02" (First 2 digits) : Module ID (1st Output Module in this example)
"02" (Next  2 digits) : Relay ID (1st Relay STOP RELAY, 2nd Relay UP/DOWN )(The firmware in the module automatically sets and runs synchronously)
"02" (Last  2 digits) : Command (2=UP ; 3=DOWN ; 4=STOP.)

For Thermal Actuators etc. (OPEN, CLOSE):
I use 2 relays to cross-transfer Phase and Notr.
“01” (Last 2 digits) :Command (10=OFF or 11=ON.)

-RGB led module:
It has 6 channel outputs and each channel can run alone or synchronized with other channels.
RGB and/or Dimmer Controller

Command Structure

I want to do;
I ran the system on the Openhab<>Gateway side. I ran Output Modules (Lamp, Roller shutter, and Thermo valves) via the web interface or mobile application.
I tried some methods (Map Transform: to use wall keys with Input Module.

This is the issue I want help/suggestion from you. What method would you suggest I use to control it from the outside world with a wall key?
I know Assembly(advanced), Basic(advanced), and C(intermediate). I know old languages ​​Fortran, Pascal, Delphi, Cobol, etc.
I don’t know Java and JavaScript (I have very basic knowledge). I do not know web-oriented (HTML, XML, etc.) languages ​​(I would appreciate if you have Script, etc. language suggestions for Openhab)
I’ve been learning Regex for 3 days.

The following screenshots are generic Things, Channels and their configurations, and items that I created on openhab.

serial bridge Thing
serial bridge thing

Input_1 Thing

Input_1 Channel_1 Config
Input_1 Channel_1 Config
Input_1 Channels Code

Input_1 Channel_1 Status-On

Input_1 Channel _1 Status-OFF

Ouput_1 Thing

Output_1 Channel_1 Config
Output_1 Channel_1 Config
Output_1 Channels Code

Ouput_1 Channel_1 Stattus-ON

Ouput_1 Channel_1 Status-OFF

Output Item Status
Output 1 Role 1 Status-ON

Output_1 Role_1 Status-OFF

Blinds_1 Thing

Blinds_1 Channel_1 Config

Blinds_1 Code

Blinds_1 Channel_1 Status-0

Blinds_1 Channel_1 Status-100

thank you for your time.