OpenHAB version: 4.1 / Openahabian / RPI4
It is a more question wat is in your opninion the best approach for this issue.
I have a serial device where the pressbuttons in house are connected to.
So I receive 2 commands from that device.
There are a little similar. The idea was in the past that it should also stay working without the special things (past my pc , now openhab).
Command like:
B0202 as soon when that processor can determine which button it is.
followed by B02005.
B is for the several loops (wires) in house. (From A to L possible)
02 - Button 02 (01 -12 possible)
02 (first) Or 00-Off 01On 02-Switch
Or 005 (second) the time the button is pressed
So there are a lot of possibilities. Even short and long pressed.
How would be a nice way to process these several possibilities (A01 A02 … short / long)?
I can put all in the routine that is triggered after the serial device is changed.
I can make for all pushbutton were you can put also a trigger.
It is a bit and also not.
Has someone a good advise?
How are you getting these into OH? Though a binding? Which binding? How is the Thing configured?
Ideally I would set this up as an event Channel which just passes the string through. A rule triggered by the events will parse the string to determine which button it represents and which command and issue the right command to the right Item in OH in response.
But that depends on whether the binding supports an event Channel in the first place.
I use the Serial binding with a serial device, so that I can make trough the pattern a difference between the first and second string.
Then with a trigger on the update of that channel of that serialdevice.
At this moment, I’m thinking of 2 switch command to handle those.
Then it is a long routine all in code (no gui) but I know what I’m starting.
Ok thank you for the feedback
I gone play in that direction with a few possible button and compare the 2 approaches.
In function of what is the easiest to maintain and to adapt to new needs of the house.
Thanks