I get updates from Blue Iris (Cameras) each time the profile is changed. I was able use a REST item to display the setting on the HABPanel. However, like a few other devices the OH server gets resarted from time to time and I’d like to have OH request the profile setting on startup.
rule "Startup"
when
// testing assistant - this will be replaced with on start
Time cron "0 0/1 * 1/1 * ? *"
then
biProfileReturn_json.postUpdate(sendHttpGetRequest("http://192.168.1.6:31793/admin?&user=xyw&pw=123"))
val newValue = transform("JSONPATH", "signal.profile", biProfileReturn_json.state.toString)
//post the new value to the Number Item
biProfile.postUpdate( newValue )
logInfo("Bi", "one more minute")
end
The Get returns
signal=green
profile=6
lock=1
I want to pick that 6 or whatever number is returned out and replace biProfile
Thanks - I just read the log literally instead of looking at it. The error specifically say JSONPATH not available. I thought o-yah I recall regex was an add on and sure enough it looks like all transformations are not loaded by defualt.
I had add the “:60000:REGEX((.*))” to the transform for a very long JSON file to pull out the one piece of data that I was looking for. Hope this helps!
Thanks John - I did a little playing around and ended up with val newval = transform(“REGEX”, “.profile=(\d).”, biProfileReturnstr.state.toString). In my case the string was within whatever the standard length that regex cosiders and the profile= made it easy to define. Hopefully I remember that option when I encounter a really long string. That isn’t something I would have expected to need to do but appreciate knowing