The calls via the browser work as expected.
Now I’m trying to create a switch item with the http binding and e.g. to issue the mute command.
Unfortunately it does not work.
Maybe someone of you sees what is wrong with my item. Switch WAM350_1_Mute "Mute ist [%s]" {http=">[ON:GET:http://192.168.1.60:55001/UIC?cmd=%3Cpwron%3Eon%3C/pwron%3E%3Cname%3ESetMute%3C/name%3E%3Cp%20type=%22str%22%20name=%22mute%22%20val=%22on%22/%3E] >[OFF:GET:http://192.168.1.60:55001/UIC?cmd=%3Cpwron%3Eon%3C/pwron%3E%3Cname%3ESetMute%3C/name%3E%3Cp%20type=%22str%22%20name=%22mute%22%20val=%22off%22/%3E] <[http://192.168.1.60:55001/UIC?cmd=%3Cname%3EGetMute%3C/namePreformatted%3E:30000:XPATH(/UIC/response/mute)]"}
The Xpath transformation is also installed.
Here is the log file.
Somthing is wrong with java? java.util.IllegalFormatConversionException: c != java.util.Date???
2020-05-29 07:40:39.101 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'samsung-wam.items'
2020-05-29 07:45:00.750 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'samsung-wam.items'
2020-05-29 07:45:01.542 [ERROR] [b.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) ~[?:1.8.0_252]
at java.util.Formatter$FormatSpecifier.printCharacter(Formatter.java:2869) ~[?:1.8.0_252]
at java.util.Formatter$FormatSpecifier.print(Formatter.java:2757) ~[?:1.8.0_252]
at java.util.Formatter.format(Formatter.java:2520) ~[?:1.8.0_252]
at java.util.Formatter.format(Formatter.java:2455) ~[?:1.8.0_252]
at java.lang.String.format(String.java:2940) ~[?:1.8.0_252]
at org.openhab.binding.http.internal.HttpBinding.execute(HttpBinding.java:168) ~[?:?]
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:146) ~[bundleFile:?]
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:169) [bundleFile:?]
2020-05-29 07:45:02.546 [ERROR] [b.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) ~[?:1.8.0_252]
at java.util.Formatter$FormatSpecifier.printCharacter(Formatter.java:2869) ~[?:1.8.0_252]
at java.util.Formatter$FormatSpecifier.print(Formatter.java:2757) ~[?:1.8.0_252]
at java.util.Formatter.format(Formatter.java:2520) ~[?:1.8.0_252]
at java.util.Formatter.format(Formatter.java:2455) ~[?:1.8.0_252]
at java.lang.String.format(String.java:2940) ~[?:1.8.0_252]
at org.openhab.binding.http.internal.HttpBinding.execute(HttpBinding.java:168) ~[?:?]
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:146) ~[bundleFile:?]
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:169) [bundleFile:?]
2020-05-29 07:45:03.550 [ERROR] [b.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) ~[?:1.8.0_252]
at java.util.Formatter$FormatSpecifier.printCharacter(Formatter.java:2869) ~[?:1.8.0_252]
at java.util.Formatter$FormatSpecifier.print(Formatter.java:2757) ~[?:1.8.0_252]
at java.util.Formatter.format(Formatter.java:2520) ~[?:1.8.0_252]
at java.util.Formatter.format(Formatter.java:2455) ~[?:1.8.0_252]
at java.lang.String.format(String.java:2940) ~[?:1.8.0_252]
at org.openhab.binding.http.internal.HttpBinding.execute(HttpBinding.java:168) ~[?:?]
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:146) ~[bundleFile:?]
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:169) [bundleFile:?]
2020-05-29 07:45:04.554 [ERROR] [b.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) ~[?:1.8.0_252]
at java.util.Formatter$FormatSpecifier.printCharacter(Formatter.java:2869) ~[?:1.8.0_252]
at java.util.Formatter$FormatSpecifier.print(Formatter.java:2757) ~[?:1.8.0_252]
at java.util.Formatter.format(Formatter.java:2520) ~[?:1.8.0_252]
at java.util.Formatter.format(Formatter.java:2455) ~[?:1.8.0_252]
at java.lang.String.format(String.java:2940) ~[?:1.8.0_252]
at org.openhab.binding.http.internal.HttpBinding.execute(HttpBinding.java:168) ~[?:?]
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:146) ~[bundleFile:?]
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:169) [bundleFile:?]
2020-05-29 07:45:05.557 [ERROR] [b.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) ~[?:1.8.0_252]
at java.util.Formatter$FormatSpecifier.printCharacter(Formatter.java:2869) ~[?:1.8.0_252]
at java.util.Formatter$FormatSpecifier.print(Formatter.java:2757) ~[?:1.8.0_252]
at java.util.Formatter.format(Formatter.java:2520) ~[?:1.8.0_252]
at java.util.Formatter.format(Formatter.java:2455) ~[?:1.8.0_252]
at java.lang.String.format(String.java:2940) ~[?:1.8.0_252]
at org.openhab.binding.http.internal.HttpBinding.execute(HttpBinding.java:168) ~[?:?]
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:146) ~[bundleFile:?]
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:169) [bundleFile:?]
2020-05-29 07:45:06.561 [ERROR] [b.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) ~[?:1.8.0_252]
at java.util.Formatter$FormatSpecifier.printCharacter(Formatter.java:2869) ~[?:1.8.0_252]
at java.util.Formatter$FormatSpecifier.print(Formatter.java:2757) ~[?:1.8.0_252]
at java.util.Formatter.format(Formatter.java:2520) ~[?:1.8.0_252]
at java.util.Formatter.format(Formatter.java:2455) ~[?:1.8.0_252]
at java.lang.String.format(String.java:2940) ~[?:1.8.0_252]
at org.openhab.binding.http.internal.HttpBinding.execute(HttpBinding.java:168) ~[?:?]
at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:146) ~[bundleFile:?]
at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:169) [bundleFile:?] `84 - SetMute
Description: Mute ON
Example:
curl 'http://ip_speaker:55001/UIC?cmd=%3Cpwron%3Eon%3C/pwron%3E%3Cname%3ESetMute%3C/name%3E%3Cp%20type=%22str%22%20name=%22mute%22%20val=%22on%22/%3E'
Xml string decoded:
<pwron>on</pwron><name>SetMute</name><p type="str" name="mute" val="on"/>`
Maybe someone can help me, would like to integrate the speakers into Openhab.
It must be a small but stupid mistake …
First simplify. Just include one of the http endpoints on the Item. The most likely cause of the problem is the < config so let’s leave that one for last. First just include the >[ON config. Does that one alone work? If so add the >[OFF config. If not post the error. Don’t forget to sendCommand(ON) to the Item to test whether it works or not.
I’ve never seen this error before and it frankly doesn’t make much sense in context.
Viele dank für deine Antwort.
Habe folgendes Item definiert und im HabPanel mit einem Switch-Widget verbunden.
Beim schalten pasiert nichts…
Das selbe Verhalten habe ich für das OFF.
The Item right now. Switch WAM350_1_Mute "Mute" {http=">[ON:GET:http://192.168.1.60:55001/UIC?cmd=%3Cpwron%3Eon%3C/pwron%3E%3Cname%3ESetMute%3C/name%3E%3Cp%20type=%22str%22%20name=%22mute%22%20val=%22on%22/%3E]"}
the log-file 2020-05-29 19:18:55.938 [ERROR] [b.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) ~[?:1.8.0_252] at java.util.Formatter$FormatSpecifier.printCharacter(Formatter.java:2869) ~[?:1.8.0_252] at java.util.Formatter$FormatSpecifier.print(Formatter.java:2757) ~[?:1.8.0_252] at java.util.Formatter.format(Formatter.java:2520) ~[?:1.8.0_252] at java.util.Formatter.format(Formatter.java:2455) ~[?:1.8.0_252] at java.lang.String.format(String.java:2940) ~[?:1.8.0_252] at org.openhab.binding.http.internal.HttpBinding.execute(HttpBinding.java:168) ~[?:?] at org.openhab.core.binding.AbstractActiveBinding$BindingActiveService.execute(AbstractActiveBinding.java:146) ~[bundleFile:?] at org.openhab.core.service.AbstractActiveService$RefreshThread.run(AbstractActiveService.java:169) [bundleFile:?]
I also created a string item to possibly see the change via the interface.
Unfortunately, this never changes the value.
However, this call works without any problems in the browser String WAM350_2_Mute "Mute [%s]" {http="<[http://192.168.1.60:55001/UIC?cmd=%3Cname%3EGetMute%3C/name%3E:30000:REGEX((.*))]"}
Unfortunately I have no idea what else I could try.
Does that error occur periodically or just when you send command ON to the Switch? Do you have any other HTTP binding Items or anything in http.cfg?
Now that I look at the error more closely, it looks like it’s complaining about a String formatter. Do you have any Item labels or Rules that use String::Formatter on a DateTime Item?
I included the Open-weather widget. a lot of items have been generated. otherwise I have no other items with a date.
I don’t have any rules running.
The Error occur just when i send the cmd
Now there are no Items left, just the Item to sende the Mute Command.
This are the Logs
`2020-05-30 07:51:01.755 [ome.event.ItemCommandEvent] - Item ‘WAM350_1_Mute’ received command ON
==> /var/log/openhab2/openhab.log <==
2020-05-30 07:51:01.755 [WARN ] [org.apache.karaf.services.eventadmin] - EventAdmin: Exception during event dispatch [org.osgi.service.event.Event [topic=openhab/command/WAM350_1_Mute] {item=WAM350_1_Mute, bridgemarker=true, command=ON, timestamp=1590817861755} | {org.osgi.service.cm.ManagedService, org.osgi.service.event.EventHandler}={service.id=349, service.bundleid=249, service.scope=bundle, event.topics=openhab/*, service.pid=org.openhab.http, component.name=org.openhab.binding.http, component.id=13} | Bundle(org.openhab.binding.http_1.14.0 [249])]
java.util.UnknownFormatConversionException: Conversion = ‘m’
at java.util.Formatter$FormatSpecifier.conversion(Formatter.java:2691) ~[?:1.8.0_252]
at java.util.Formatter$FormatSpecifier.(Formatter.java:2720) ~[?:1.8.0_252]
at java.util.Formatter.parse(Formatter.java:2560) ~[?:1.8.0_252]
at java.util.Formatter.format(Formatter.java:2501) ~[?:1.8.0_252]
at java.util.Formatter.format(Formatter.java:2455) ~[?:1.8.0_252]
at java.lang.String.format(String.java:2940) ~[?:1.8.0_252]
at org.openhab.binding.http.internal.HttpBinding.formatAndExecute(HttpBinding.java:294) ~[?:?]
at org.openhab.binding.http.internal.HttpBinding.internalReceiveCommand(HttpBinding.java:147) ~[?:?]
at org.openhab.core.binding.AbstractBinding.receiveCommand(AbstractBinding.java:97) ~[?:?]
at org.openhab.core.events.AbstractEventSubscriber.handleEvent(AbstractEventSubscriber.java:49) ~[?:?]
at org.apache.felix.eventadmin.impl.handler.EventHandlerProxy.sendEvent(EventHandlerProxy.java:415) [bundleFile:?]
at org.apache.felix.eventadmin.impl.tasks.HandlerTask.runWithoutBlacklistTiming(HandlerTask.java:82) [bundleFile:?]
at org.apache.felix.eventadmin.impl.tasks.SyncDeliverTasks.execute(SyncDeliverTasks.java:104) [bundleFile:?]
at org.apache.felix.eventadmin.impl.tasks.AsyncDeliverTasks$TaskExecuter.run(AsyncDeliverTasks.java:166) [bundleFile:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_252]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_252]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_252]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_252]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]`
What is wrong with this request?
EDIT:
New Install Http-Binding didn’t help as well.
Is there a other way, that alows me to send this cmd?
Try getting rid of the URL encoding in the address. They really are not needed as the HTTP binding will URL encode those characters that need it for you anyway. It’s probably seeing the % characters and thinking they are String Formatter commands instead of URL encoding.
You can use the sendHttpGetRequest Action from a Rule. Or the Exec binding or executeCommandLine Action to call curl.
I tried to dubling all the % and just the one you said. Didn’t work.
May i missunderstand you…
Could you please give me the hole exmple for this Item: Switch WAM350_1_Mute "Mute ist [%s]" { http="> [ON:GET:http://ip_speaker:55001/UIC?cmd=%3Cpwron%3Eon%3C/pwron%3E%3Cname%3ESetMute%3C/name%3E%3Cp%20type=%22str%22%20name=%22mute%22%20val=%22on%22/%3E] > [OFF:GET:http://ip_speaker:55001/UIC?cmd=%3Cpwron%3Eon%3C/pwron%3E%3Cname%3ESetMute%3C/name%3E%3Cp%20type=%22str%22%20name=%22mute%22%20val=%22off%22/%3E] <[http://ip_speaker:55001/UIC?cmd=%3Cname%3EGetMute%3C/name%3E:30000:XPATH(/UIC/response/mute)]" }
Var VOLUME = itemValue.(DimmerXY) http://$SPEAKER:$PORT/UIC?cmd=%3Cname%3ESetVolume%3C/name%3E%3Cp%20type=%22dec%22%20name=%22volume%22%20val=%22$VOLUME%22/%3E"
My idea is to set a Item Dimmer with the Value in HABPanel and use it directly in the Rules.
But my Syntax is that bad, as my english
No. You’ll have to be careful, it is easy to get wrong where you have a lot of url encoded characters http://ip_speaker:55001/UIC?cmd=%%3Cpwron%%3Eon%%3C/...
Then do so
val results = sendHttpGetRequest(“[http://192...
logInfo("test", "return " + results)
I would advise adding a timeout as well.
No. But as you have already found, it’s just a string and you can make it up from parts.
Thank you for your contribution.
How i know witch one is right and witch is worng? Some Dok? oder Try and Error
Can I use the result to update the item or something similar?
So that I can see the updated value in HABPanel?
Or assign using MAP according to the switch?
It’s just a string. I don’t know what it is going to contain. You can do anything you like with it. If you want to use it in HABpanel, you’ll have to post it to some Item.
So I mean is there a way to assign the string to the switch as a state so that it is always “uptodate”? or is tracked?
I don’t have an idea how to do that
Just had a dropout … but thanks for the patience and the answer to my stupid question.
Now I think I have everything together to get a smart integration of my speakers.
But I only want to have the part “on” or only have something from the entire answer.
I’m unfortunately not familiar with Xpath.
I think it should look like tsomething like that?