Hey All,
I need some help with my REGEX.
I have the following item:
Switch Mute_Item "Mute_Item" { http=">[ON:GET:http://SPEAKER_IP/UIC?cmd=%3Cname%3ESetMute%3C/name%3E%3Cp%20type=%22str%22%20name=%22mute%22%20val=%22on%22/%3E] >[OFF:GET:http://SPEAKER_IP/UIC?cmd=%3Cname%3ESetMute%3C/name%3E%3Cp%20type=%22str%22%20name=%22mute%22%20val=%22off%22/%3E] <[http://SPEAKER_IP/UIC?cmd=%3Cname%3EGetMute%3C/name%3E:5000:REGEX(<mute>(.*?)<\/mute>)]" }
With this item I can read and write the mute state of my wireless speaker.
The item file will give the following error:
19:10:16.452 [WARN ] [del.core.internal.ModelRepositoryImpl] - Configuration model 'Items.items' has errors, therefore ignoring it: [12,52]: mismatched character '/' expecting set null
[12,413]: mismatched input 'mute' expecting RULE_STRING
[14,1]: mismatched input '<EOF>' expecting '}'
When I remove the REGEX part, the item file is loaded.
Weird, because the regular expression is right and tested with https://regexr.com/
When I don’t escape the ‘/’ before mute (as the example of the http binding says), the item file is loaded but the the HTTP binding gives the following error:
19:09:57.872 [ERROR] [ab.core.service.AbstractActiveService] - Error while executing background thread HTTP Refresh Service
java.util.IllegalFormatConversionException: c != java.util.Date
at java.util.Formatter$FormatSpecifier.failConversion(Formatter.java:4302) [?:?]
at java.util.Formatter$FormatSpecifier.printCharacter(Formatter.java:2869) [?:?]
at java.util.Formatter$FormatSpecifier.print(Formatter.java:2757) [?:?]
at java.util.Formatter.format(Formatter.java:2520) [?:?]
at java.util.Formatter.format(Formatter.java:2455) [?:?]
at java.lang.String.format(String.java:2940) [?:?]
at org.openhab.binding.http.internal.HttpBinding.execute(HttpBinding.java:144) [266:org.openhab.binding.http:1.12.0]
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:144) [209:org.openhab.core.compat1x:2.3.0]
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:166) [209:org.openhab.core.compat1x:2.3.0]
I hope someone has a solution.
- Jordo