TCP Binding : "Could not find a mapping for..." / "Can not parse input..."


I want to communicate with my weather station Davis Vantage PRO2 with the TCP Binding.

Here is my configuration file for “.items”:
Switch MeteoDavisStation “Station météo Davis” (gRDC) {tcp=">[ON:‘MAP(’], >[OFF:‘MAP(’]"}

Here is my configuration file for “” (with communication reference manual:

But I don’t understand why I have: "Could not find a mapping for ’ ’ in the file ‘MeteoDavisStation’’ and “Can not parse input to match command ON on item MeteoDavisStation” (see attached doc)?

Thank you in advance for your help.


Your Item is being set to what looks like a newline or carriage feed character and there is no mapping for that character nor can the TCP binding parse it to something meaningful and convert it to ON or OFF.

I don’t know if it is possible to put this sort of character into a MAP so you might need to move to a REGEX or JavaScript transform to deal with these odd messages.

According to the linked document, there is neither such command LAMP 1 nor LAMP 0 nor inconnu:slight_smile:


Thank you for your reply and I’ll try to look in that direction.



I can communicate with my DAVIS console. I can for example turn on the light with these configurations:

> Switch MeteoDavisStationLamp "Station météo Davis Lamp" <sun> (gRDC) {tcp=">[ON:'MAP('], >[OFF:'MAP(']"} String Str1 "Str1 [%s]" (gRDC) {tcp="<[:*:'REGEX((.*\n)*)']"}
ON = LAMPS 1\n OFF = LAMPS 0\n

But my goal is to retrieve weather data of course. However I do not know how to display this data in openHAB.

As a beginner, I tried several configurations with regex but nothing conclusive.

Therefore, how can I retrieve and display every minute for example my weather data please? (with script? rules?)


PS: when I send my order to turn on the light of my DAVIS console, it returns me a \ nOK \ n as shown in the manual on page 21 ( :
Example (turn the lamps off):
>"LAMPS 0"<LF> <<LF><CR>"OK"<LF><CR> )

The regular expression that should cut out the newlines should look something like this: (NOTE: according to the manual it isn’t using just \n but \r\n)


which means give me everything between a “\r\n” and a “\r\n”.
or perhaps something a bit more inclusive:


which means ignore everything at the start and end of the string and give me what is between "\r\n"s

You can match the “OK” exactly with:


which means give me the String OK if you see it between anything and quotes (returns nothing otherwise).

You can match numbers with:


which means ignore everything until you see one or more digits or a “.”. It is actually a little sloppy because you can have just a “.” or lots of "."s so this would probably be better:


which means ignore everything until you see a one or more digits followed but zero or one “.” followed by zero or more digits.


Thank you very much for you answer @rlkoshak.

I tried all your suggestions and even this:
String Str1 "Str1 [%s]" (gRDC) {tcp="<[:*:'REGEX([\n|\r|\n\r|\r\n]\"(OK)\"[\n|\r|\n\r|\r\n])']"}

But I have still the same problem and I encountered an error with this formulation:
String Str1 "Str1 [%s]" (gRDC) {tcp="<[:*:'REGEX(\r\n(.*)\r\n)']"}

I really don’t understand the problem, even if the solution may be simple. Maybe the error comes from the configuration of my “.map”…

Thank you again for your support.


As long as you have carriage returns and line feeds (i.e. \r\n) in the string that gets assigned to your Item the mapping will fail.

Beyond that, the “could not be parsed correctly” indicates a syntax error in your binding string (i.e. the stuff between the { }) and I don’t think it is the REGEX that is the problem in this case.

Upon the review of the TCP wiki page, you should not have that leading “:” in front of the IP address. As it says in the wiki:

For String Items : can be omitted

Also, I think you must supply a port number so the “*” after the IP address should be the actual port number. It doesn’t really make sense to use a wild card in this context.

Finally, if you are more comfortable with JavaScript, try using a JavaScript transform to strip the \r\n out of the returned value.


Thank you for the additional information.

I’m also not an expert in JavaScript but I’m here to learn.


Is it possible to chain REGEX() and MAP()?

In a rule.


I’m sorry to bother you again.

I learned JavaScript and I wanted to test a simple example to run my js file. I managed to do an addition !! :+1: :weary:

rules file:
rule "REGEX Test" when Time cron "0/10 * * * * ?" then logInfo("TestJS","JS : " + transform("JS", "MeteoVantage.js", "1")) end

// Wrap everything in a function (function(i) { return parseInt(i)+2; })(input) // input variable contains data passed by openhab

[INFO ] [rg.openhab.model.script.TestJS] - JS : 3.0

Now I will wish to recover my famous “OK” of course.
I send my order in my items file.

Switch MeteoDavisStationLamp "Station météo Davis Lamp" <sun> (gRDC) {tcp=">[ON:'MAP('], >[OFF:'MAP(']"}

And so I want to get my OK in my variable:
String MeteoJS "Test [%s]" (gRDC) {tcp="<[:]"}

But I get nothing. Indeed, I do not know how to configure my file. I am lost after trying several things…

My ultimate goal is to automatically receive and decode the chain received with weather data after sending the command “Loop 1” (cf. LOOP command p12 and 21 :
If I replace LAMPS 1\n by LOOP 1\n in my map file, I receive:
[WARN ] [t.i.s.MapTransformationService] - Could not find a mapping for '♠LOO¶' in the file ''. [WARN ] [t.protocol.internal.TCPBinding] - Can not parse input ♠LOO¶ to match command ON on item MeteoDavisStationLamp


This makes me think there might be a character encoding issue going on. I’m not sure how to help with that.


Is it possible to set up a TCP connection in a rule? Indeed, I will wish to create a rule that every 10 seconds for example, the command “LOOP 1 \ n” is sent to my Davis station by the TCP binding.
Then I have to retrieve weather data, I have to analyse this data (probably with JavaScript), and display this data in my items file (number by number).
I think this is possible after watching this:
But being beginner, I lack some basics to properly do this project.

Good evening,


I think you have to set up the connection itself as an item. But you can send data out on that Item in a row using sendCommand. For incoming data you can also receive the value and parse out the parts into separate items in a row.


Thank you for your answer, but I don’t know how to receive the data for analysis. Do you have an example please?


Examples are on the wiki page. Look at the incoming sections.

Yes, but I tried again several parameters (as:
Number MeteoJS "Test MeteoJS [MAP(]" (gRDC) {tcp="<[]"}
, without success. Therefore, I can’t put a parameter in my JavaScript file for later analysis. Yet I get this message at initialization:
09:40:55.505 [DEBUG] [t.AbstractSocketChannelBinding:1238 ] - Setting up the inbound channel Channel [item=MeteoJS, command=0, direction=IN, remote=/, buffer=, isBlocking=false, isReconnecting=false, host=, port=22222] 09:40:55.507 [INFO ] [t.AbstractSocketChannelBinding:1240 ] - We will accept data coming from the remote end /

Thanks for your help

I’m not in a place where I can fully analyze and answer.

The way it works is you set up an item to receive the data according to the wiki page. Create a rule that triggers when the item updates or changes. Parse out the data and send to other items in that rule.

The transforms are only if you want to extract one value from the incoming data to assign to this one item.