MQTT Items - Convert?

Hello,

i received data from mqtt, this look like this:

OK
2.2
2.1
OK
1.7
4.0
-0.2
20;19;Cresta;ID=8201;WINDIR=0015;WINSP=0028;WINGS=002c;WINTMP=0011;WINCHL=8002;BAT=OK;

its a sensor of my anemometer. how can i add this to a item with clean values?

regard

Is that one message or is each line its own message?

Two methods…

  1. Add items that use the MQTT binding with a transformation to pull out the individual values
  2. Pull in the raw data into an item, and then use a rule to parse it out and update the individual items.

@rlkoshak
its from one message, here a example

mosquitto_sub -t "rflink/#"
aa
20;17;Cresta;ID=3D01;TEMP=0456;HUM=aa;BAT=OK;

OK
111.0
86
20;18;Cresta;ID=AB04;TEMP=0016;HUM=86;BAT=OK;

OK
2.2
2.1
OK
1.7
4.0
-0.2
20;19;Cresta;ID=8201;WINDIR=0015;WINSP=0028;WINGS=002c;WINTMP=0011;WINCHL=8002;BAT=OK;

4.4
93
20;1A;Cresta;ID=6703;TEMP=0015;HUM=93;BAT=OK;

OK
2.1
aa
20;1B;Cresta;ID=3D01;TEMP=0456;HUM=aa;BAT=OK;

OK
111.0
0.0
OK
1.8
4.0
-0.2
20;1C;Cresta;ID=8201;WINDIR=0000;WINSP=0028;WINGS=002c;WINTMP=0012;WINCHL=8002;BAT=OK;

4.4
86
20;1D;Cresta;ID=AB04;TEMP=0017;HUM=86;BAT=OK;

OK
2.3
93
20;1E;Cresta;ID=6703;TEMP=0015;HUM=93;BAT=OK;

Unfortunately OH2 have no good support for RFLINK www.rflink.nl like
other Tools (eg. HomeAssistant, Pimatic, ioBroker,…)

So, i must try it with python.
unfortunately only with bad readable data.

You just didn’t output everything, it is well formed and easy readable.

Use the -v flag to enable topic output as well

example for a mqtt rflink item:

Number garden_temp "Garden [%.1f °C]" (gTemp)
        { mqtt="<[mosquitto:rflink/LaCrosse/0007/R/TEMP:state:default]" }

thx. it works :slight_smile:

 mosquitto_sub -v -t "rflink/#"
rflink/Cresta/3D01/R/HUM aa
rflink/Cresta/3D01/R/message 20;08;Cresta;ID=3D01;TEMP=0456;HUM=aa;BAT=OK;

rflink/Cresta/3D01/R/BAT OK
rflink/Cresta/3D01/R/TEMP 111.0
rflink/Cresta/8201/R/WINDIR 1.6
rflink/Cresta/8201/R/BAT OK
rflink/Cresta/8201/R/WINTMP 1.4
rflink/Cresta/8201/R/WINSP 0.0
rflink/Cresta/8201/R/WINCHL 1.4
rflink/Cresta/8201/R/message 20;09;Cresta;ID=8201;WINDIR=0010;WINSP=0000;WINGS=0000;WINTMP=000e;WINCHL=000e;BAT=OK;

i can now receice via python script

but it is possible to send data?

openhabian@openHABianPi:~$ mosquitto_sub -v -t "rflink/#"
rflink/NewKaku/010af15e/R/message 20;A5;NewKaku;ID=010af15e;SWITCH=1;CMD=OFF;

rflink/NewKaku/010af15e/R/CMD OFF
rflink/NewKaku/010af15e/R/SWITCH 1
rflink/NewKaku/010af15e/R/message 20;A6;NewKaku;ID=010af15e;SWITCH=1;CMD=ON;

rflink/NewKaku/010af15e/R/CMD ON
rflink/NewKaku/010af15e/R/SWITCH 1

this item will not work:

Switch Inter_ON "Inter_ON" {mqtt=">[mosquitto:rflink/NewKaku/010af15e/R/CMD:command:ON:1],>[mosquitto:rflink/NewKaku/010af15e/R/CMD:command:OFF:0]" }