Multiple variable on a single item (store to mysql separately)

Hi! I am a new user of OH2 and there is something that I’ve been wondering about. I have this items file

Number RPi2 "TEST [%.1f]" {tcp="<[*:'REGEX((.*))']"}

There is no problem with the tcp binding, and the values received are being shown in a chart (used jdbc mysql persistence). The thing is, my rpi actually sends two different variables (A & B). First, it sends A, waits for a second then it sends B. Now, these two variables are being stored on the same column on the same table in mysql. My question is, is there any way that I can store A and B separately? Probably in different columns or different tables?

Thank you very much!

If you want OH to persist them individually, you’ll have to separate them out into two Items.
How would you distinguish which is A, and which is B ?
You’d need to implement that logic into a rule to separate them. Perhaps A is always the next one after a ‘silent’ period of two seconds or something like? Perhaps A and B have different possible ranges?
Perhaps the RPi could send JSON to identify what it does?

Thank you for this! I have tried making two items.

Number RPi3 "TEST [%.1f]" {tcp="<[*:'REGEX((.*))']"}
Number RPi4 "TEST [%.1f]" {tcp="<[*:'REGEX((.*))']"}

However, only RPi3 is receiving the data. Is it possible that the TCP binding does not work for multiple items? Thank you!

I would have expected that to result in two Items with identical contents.

My approach would be to bring TCP into one Item, and have a rule split the desired data into two other Items.

sorry for coming back this late but i was able to solve my problem, with what you have suggested. Thank you very much! I really appreciate it. :slight_smile: