Could someone please point me in the right direction, I would like to get some data from a local (Enphase Envoy) device into items in openhab.
I have installed the HTTP binding and JSON transformation.
When I put, JSONPATH$.wattHoursToday in the Channel I get an error message in the log of,
2021-02-27 12:08:06.527 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.thingUpdated()' on 'org.openhab.binding.http.internal.HttpThingHandler@189d672': The transformation pattern must consist of the type and the pattern separated by a colon
When I put the JSONPATH$.wattHoursToday in the Link to Item, I get this in the logs, 2021-02-27 12:10:54.519 [WARN ] [ofiles.JSonPathTransformationProfile] - Could not transform state 'UNDEF' with function 'JSONPATH$.wattHoursToday' and format '%s'
When put directly into the channel (which is usually the best choice when available), just do as it says.
You might have any transformation here - like MAP - so you must tell it which one. Then supply the parameter/pattern for it.
JSONPATH:$.wattHoursToday
When selecting a profile from the UI, you’ve already selected JSONPATH and so you only need the parameter/pattern in the text box $.wattHoursToday
But use the channel method here, set your profile back to default.
You’ll see the colon after JSONPATH. I thought that the UI would show the correct syntax, but it seems like the HTTP Binding doesn’t. Here’s what a similar field for the MQTT Binding shows:
Not directly related to the specific problem here but when using HTTP APIs and JSON, I have found it helpful to use a jsonpath parser to test my path definition first: http://jsonpath.com/
You can alter and test the parameter definition quickly and easily so you know it’s right when you code it into OpenHAB