Just slowly migrating things from an almost purely text based OH2 (2.5.10) setup to OH3 (currently M3)
I have been stuck with the http binding for several hours and can’t work out how to apply mappings.
When I create and link the item as a string, I get the desired result but when I set it up as a switch I always get UNDEF (which probably makes sense). Furthermore when I try to apply a MAP transformation, and whenever I add that to the configuration, I get Error
, even for the string item. In the logs, no matter what I try, I get the following:
23:21:10.357 [WARN ] [rofiles.JSonPathTransformationProfile] - Could not transform state 'Error' with function '$.data.last_data.DA.amOn' and format '%s'
In OH2, this is my setup:
http service:
actron.url=http://actron.ninja.is/rest/v0/device/xxx?user_access_token=yyy{Referrer=http://actron.ninja.is/}
actron.updateInterval=10000
Item:
String hvac_webserver_power "The System is: [MAP(actron.map):%s]" {http="<[actron:4000:JSONPATH($.data.last_data.DA.amOn )]"}
Via rules I sent commands to the particular endpoint such as:
sendHttpPutRequest("http://actron.ninja.is/rest/v0/device/xxx?user_access_token=yyy", "application/json", '{"DA":{"amOn":"true"}}',3000)
I thought it would be possible and great to roll everything together using the new GUI and use the opportunity to get rid of a few rules. I was hoping to bundle the on and off commands (true and false) into a switch rather than relying on rules.
My OH3 setup:
Thing:
Base URL: http://actron.ninja.is/rest/v0/device/xxx?user_access_token=yyy
Refresh Time: 30
Timeout: 3000
Authentication Mode: Basic
Command Method: GET
Content Type: application/json
Channel Setup
Item Setup
MAP file (actron.map)
false=Off
true=On
In that last screenshot there are parentheses around the actron.map but I have tried MAP:actron.map and with it removed.
Is it possible to do what I am doing and if so if I could get a bit of guidance on how to make it would I would be very appreciative.