[SOLVED] Map Error that Doesn't make Sense - use JSONPATH not MAP

I am running Openhab 2.4 on Ubuntu 16.04.

I installed a Shelly-1 iot device with Tasmota installed. All working fine. I am integrating to Openhab using http commands for communication (not mqtt). To start, I want the item to get status updates. I know the command is working but openhab is having trouble translating the responses via my map. I can’t figure out the problem.

Thanks for the help.

Error:
Could not transform '{"POWER":"ON"}' with the file 'shelly.map' : Target value not found in map for '{"POWER":"ON"}'
Item:
Switch shelly_garage   "Garage Lights"  <switch>  (gAlarm_lights) { http="<[http://myip/cm?user=myuser&password=mypw&cmnd=Power:30000:MAP(shelly.map)]" }
shelly.map
{"POWER":"OFF"}=OFF
{"POWER":"ON"}=ON
Shelly.map 
-rw-r--r-- 1 openhab openhab  38 Jan  4 18:25 shelly.map

Map transform files don’t look like that.

Your shelly.map contents should look something more like:

key=value
1=ON
0=OFF
ON=1
OFF=0

I have that mapping. I just added the opposite mapping and still get the same error.

{"POWER":"OFF"}=OFF
{"POWER":"ON"}=ON
OFF={"POWER":"OFF"}
ON={"POWER":"ON"}

I can’t even.

1 Like

OP - pretty sure you need a JSON transform instead of a map transform.

Try that:
Make sure you have the JSONPATH transformation service installed in the paperUI

Switch shelly_garage   "Garage Lights"  <switch>  (gAlarm_lights) { http="<[http://myip/cm?user=myuser&password=mypw&cmnd=Power:30000:JSONPATH($.POWER)]" }

Would you call that biting your tongue or fingers?:rofl:

Probably both. :wink:

1 Like

Thanks! JSONPATH fixed my problem. Much appreciated.

Glad you got it working and edited the title as solved.:+1:

If you would, please click the square box on the post that provided the solution like in example below.
image

Thanks