I have Device, it constantly transmits information by serial port 9 parameters (will call them ABCDEFGHI). Each parameter has length of 2 byte.
Parameter A is the Header ($4444), other parameters are unsigned integer.
The task is to get parameters B, C, D, E, G every 40 seconds.
But not understand how do it once every 40 seconds (not constantly!) and how to get B, C, D, E, G (using of REGEX in my situation is not clear to me too).
To get the info posted every 40 seconds you can try using a rule with a cron job.
Example:
rule "Info"
when
Time Cron "40 * * * * ? *" // at 40 seconds of every minuet
then
val infoRex = transform("REGEX", ".*=(\\w*.\\d*).*", Youritem.state.toString) // random example
Test_Item.postUpdate(infoRex)
end
As for the Regex transformation I can try and help but I’m not the greatest with regex.
If you can post exactly what’s transmitted I’ll take a stab at trying to figure it out.
Yes, data is streaming continuously.
No needs to register data often then 40 s. The second problem is the long (infinitely long!) string to parsing if we read data continuously.
You may want to consider a python script instead
Get the script to capture the stream continuously
Count the frames and every 10000 frames (for example or whatever number of frames is 40 seconds)
send the data to openhab via the rest api or mqtt