bspiegel
(Bob Spiegel)
January 5, 2019, 2:55am
1
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
namraccr
(namraccr)
January 5, 2019, 3:06am
2
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
bspiegel
(Bob Spiegel)
January 5, 2019, 3:49am
3
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"}
crxporter
(Garrett Porter)
January 5, 2019, 6:52am
5
OP - pretty sure you need a JSON transform instead of a map transform.
vzorglub
(Vincent Regaud)
January 5, 2019, 11:05am
6
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)]" }
H102
(CM6.5 H102)
January 5, 2019, 2:35pm
7
namraccr:
I can’t even.
Would you call that biting your tongue or fingers?
bspiegel
(Bob Spiegel)
January 5, 2019, 4:16pm
9
Thanks! JSONPATH fixed my problem. Much appreciated.
H102
(CM6.5 H102)
January 5, 2019, 4:21pm
10
Glad you got it working and edited the title as solved.
If you would, please click the square box on the post that provided the solution like in example below.
Thanks