Map transformation in PaperUI

  • Platform information:
    • Hardware: Corei5 / 8Gb / 18Tb_
    • OS: Windows10
    • Java Runtime Environment: 1.8.0_202-b08
    • openHAB version: 2.4
    • Mosquitto mqqt server

Hi everyone. OpenHAB beginner here

I am trying to use a map transformation to switch a heatpump on and off, but cannot get it to work. I’m using mqqt.fx to monitor mqqt traffic.

i have created a mqqt generic thing named “Test AC” and then a switch channel named “Power” linked to a Switch item.

I have also installed the map transformation addon and, under conf\transform, created the file HPPower.map:
ON={“power”:“ON”}
OFF={“power”:“OFF”}

I can get the heatpump to turn on and off with the following configuration in paperUI:

Outgoing value format: empty
On/Open Value: {“power”:“ON”}
Off/Closed value: {“power”:“OFF”}

MQQT.fx shows that the proper {“power”:“ON”} / {“power”:“OFF”} is published on the appropriate command topic when i set it to on or off respectively and the heatpump responds appropriately

I am however trying to get it to use my defined map transformation instead with the following configuration:

Outgoing value format: MAP:HPPower.map
On/Open Value: empty
Off/Closed value: empty

when using this configuration, MQQT.fx shows that MAP:HPPower.map is published on the command topic, whenever i set the channel to on or off.

Is this a syntax issue? If so, what is the appropriate Outgoing value format syntax?

Thanks for the help

Hi Tenebrus, welcome to OH!

I’m a little out of my depth, but since no one else has commented yet, I’ll do my best to help. I’m not entirely sure what you’ve got going on from your post, so I’m going to speak more generally to map transformation.

As I understand it, map transformation doesn’t work with PaperUI. I could be wrong about this, but PaperUI is really just meant for configuration and item discovery (as far as I’ve read).

Map transformation does work for sitemaps. For example, here’s my map transformation for my motion sensor:

ON=Motion detected
OFF=Idle
undefined=Unknown
-=Unknown
NULL=Unknown

When the sensor reports ON, it displays on my sitemap as “Motion detected”. But in PaperUI, it’s still just “ON”, because it’s a switch item. To get the transformed value to display, I call the map in my item definition:

Switch Sensor_Motion "Motion [MAP(motion.map):%s]" { channel="zwave:device:etc." }

Map transformation can also be used for switches in sitemaps, but in these cases you define the map in the sitemap item. Here’s a switch I use to reboot OH from my sitemap:

Selection item=Flag_System label="Power" mappings=[ Reboot="Reboot", PowerOff="Shut down" ]

This generates a dropdown menu with two options: “Reboot” and “Shut down”. If I click “Shut down”, the command that’s sent to my switch is “PowerOff”.

I think this is along the same lines of what you’re trying to do. If not, please post your actual items so that we can see what you’re working with (to get text to format like code in a post, select it and click the </> button on the menu).