This is the item i have made, but it do noit seems to work
String MotionTest "Motion Test [%s]" { http="<http://192.168.178.36/api.cgi?cmd=GetMdState&user=admin&password=123456:1000:JSONPATH($.value.state)]" }
What i get is
2019-11-17 15:29:22.805 [ERROR] [el.item.internal.GenericItemProvider] - Binding configuration of type 'http' of item 'MotionTest' could not be parsed correctly.
org.eclipse.smarthome.model.item.BindingConfigParseException: bindingConfig '<http://192.168.X.X/api.cgi?cmd=GetMdState&user=admin&password=123456:1000:JSONPATH($.value)]' doesn't contain a valid binding configuration
I have config in Paper UI, but it seems that i do not need to configure it, defaults looks good Screenshot by Lightshot
And one more thing, i would like to test it first of all without jsonpath, just to get the string of answer. But i also have not found in manual how to get it.
Yes, your results is actually an array of JSON objects with only one array member.
You need to do something like JSONPATH($[0].value.state)
but I’m not at all sure about the syntax
But it is not the last edition. This “0” and “1” must be converted to “ON” and “OFF” and item type must be “switch” i think. Now i am looking for the way how to do it. It must be map transformation, but how to put it insode JSONPATH i can not understand.
Do it the other way around - use a javascript transform instead of JSONPATH transform, that does the JSON parsing and uses that to choose the return string ON/OFF
working great! but i notice that its very fast going from true to false
i am planing on somthing like 12 cameras , and when my DIY alram is on
i am not home and , i will starting querying the the cameras
but still i am worried , will this kind of traffic damge/slow my network ?
what kind of intravel will you set ?
is there any way to make the camera change a litle slower
i assume that the JS script also will send a GET request each time he wants a reply?
or maybe it is listening to changes?
just trying to understand if there is any diffrance between what i am doing and above…
so this approch will also send HTTP request each sec…to every camera
i am by no way a network expert, i am just asking
lets say 12 camers will send 12 requests in a sec time period (thats 1036800 a calls a day)
do you think this a problem ,or this is simaple request and the network can handle this ?
i have a beefy network switch , but maybe its worth looking on other approch