Channel MAP not working

First time I’ve used a MAP on a channel value and it doesn’t work.

I couldn’t seem to find i docs how you set it, but it seemed like this?

      transformationPatternOut: MAP:weather.map

This is the setup;

UID: mqtt:topic:mqtt_broker:nspanel
label: NS Panel
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:mqtt_broker
location: Lower Hall
channels:
  - id: ns_temperature
    channelTypeUID: mqtt:string
    label: NS Temperature
    description: ""
    configuration:
      formatBeforePublish: '{"temperature":%s,"humidity":0,"tempUnit":0}'
      commandTopic: cmnd/nspanel/nspsend
  - id: ns_outdoor_temp
    channelTypeUID: mqtt:string
    label: NS Outdoor Temperature
    description: ""
    configuration: {}
  - id: ns_weather
    channelTypeUID: mqtt:string
    label: NS Weather
    description: ""
    configuration:
      transformationPatternOut: MAP:weather.map
      formatBeforePublish: '{"HMI_weather":%s}'
      commandTopic: cmnd/nspanel/nspsend
  - id: ns_switch_2
    channelTypeUID: mqtt:switch
    label: NS Panel Switch 2
    description: ""
    configuration:
      stateTopic: stat/nspanel/POWER2

the one in question is ns_weather I’m trying to use the map file for it. In conf/transform I’ve a file called weather.map, set up like this…

741=11
751=11
761=11
762=11
771=11
781=11
800=1
801=2
802=2
803=2
804=7

When I set it to 803, I was hoping to see “2” in the mqtt event, but it has “803”

23:17:36.109 NSP: Sent = {"HMI_weather":803}

How does the map work?

Did you install the Map transformation binding?

I do notice you are using the transformation as well as a formatBeforePublish which I’m not sure works as expected. In fact I think if you have an outgoing format you can’t have a transformation, or maybe the other way around. My memory is hazy on that.

But it’s not an issue with how MAP works as it is an issue with how the MQTT binding works.

But you can include the outgoing format in your map itself.

741={"HMI_weather":11}
751={"HMI_weather":11}
...

Yes, I installed it. I wasn’t aware you could have both. I’ll remove the transformation and put it in the map. see how i get on. thanks.

Remove the outgoing format, not the transformation

Failed transformation do generally pass through the original input string - you will see this behaviour when using transformations in other places within openHAB.

sorted. thanks!