I am new here to the community and I am on the way to setup an OpenHAB testenvironment.
Beside some other things, I want to read some data from an Arduino which is connected via Ethernet.
I can receive a string via HTTP like this:
Runtime: 07:01:05
Pin2: 0
Analog0: 4.009 V
This is just a test example, Pin22 is digital 0/1, to be extended.
I trie to read this with the following item configuration:
I tried now for several hours to understand how Regex really works and tried several examples. Noting really worked.
Either ending with Nullpointer assignment Error, or just with no output.
Also the examples in the documentation did not really enlight me.
Multiple markers at this line
- mismatched input '[' expecting RULE_STRING
- mismatched character '.' expecting set null
- mismatched input ']' expecting RULE_ID
- missing '}' at '0-9'
glad you found it. Actually the backtick should mask the dot. Obviously the regex engine in Openhab does not handle this.
With your current solution, it will also match every other character after the 4.
I guess it does not matter.
Got this on logs:
2018-12-30 23:42:52.971 [WARN ] [.core.transform.TransformationHelper] - Cannot get service reference for transformation service of type REGEX
2018-12-30 23:42:52.974 [WARN ] [ab.binding.http.internal.HttpBinding] - Couldn’t transform response because transformationService of type ‘REGEX’ is unavailable
maybe someone can help me out. I’m trying to retrieve the hours of sun for the next days. I tested the regex with Regex101 and it works ok, but I can’t get it in home.items. For now I only need to get a string displayed in any form like “|2|10.1|6.6|5.4|2.6|2.6|6.2|” (or any form) to know the link is working.
Regex101 tester:
home.items:
String vSonne "Test Sun [%s]" <sun-clouds>
{ http="<[http://api.thingspeak.com/apps/thinghttp/send_request?api_key=XYZUNGELOEST/:60000:REGEX(sunamount.*?>\\s*(\\d*\\.?\\d+))]" }
home.sitemap:
Text item=vSonne
in http.cfg it does not make any difference, I suppose because I embedded the link in the items.