How use MAP file in MainUI

  • Platform information:
    • Hardware: Rpi4 4GB
    • OS: Rapbian + Docker
    • Java Runtime Environment: which java platform is used and what version
    • openHAB version: 3.4.1

Some time ago I migrated to OH in docker and I set everything in MainUI (previously in files).
Now I’ve got a problem with sending IR comands by ESP with Tasmota.
Everytime when I try send something I get :

20:47:59.469 MQT: stat/tasmota_IR2_wieza/RESULT = {"IRSend":"Invalid RawData"}

Here is my conf






Where possible (pretty much everywhere except Items) you’ll find a "Code’ tab. Always part the text you find there instead of screenshots. Screenshots:

  • cannot be searched
  • cannot be copied from to provide ready corrections
  • are all but impossible to read on a phone
  • leave out a lot of context

Use code fences just like you did with the log in your post above.

But big thing here that is missing is exactly what is actually being sent. You’ve not payed and logs.

OK
log:

2023-02-11 14:00:14.736 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'ESP8266_Wieza_IR_polecenia' received command MUTE

2023-02-11 14:00:14.737 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'ESP8266_Wieza_IR_polecenia' predicted to become {"IRSend":"Invalid RawData"}

==> /var/log/openhab/openhab.log <==

2023-02-11 14:00:17.231 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '{"IRSend":"Invalid RawData"}' with the file 'ir_wieza.map' : Target value not found in map for '{"IRSend":"Invalid RawData"}'

==> /var/log/openhab/events.log <==

2023-02-11 14:00:18.436 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'ESP8266_Wieza_IR_polecenia' received command ON

2023-02-11 14:00:18.438 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'ESP8266_Wieza_IR_polecenia' predicted to become {"IRSend":"Invalid RawData"}

MAP file

ON          = {"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA802080A0","DataLSB":"0x435301040105","Repeat":0}
OFF         = {"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA802080A0","DataLSB":"0x435301040105","Repeat":0}
MUTE        = {"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA80209C08","DataLSB":"0x435301043910","Repeat":0}
VOLUP       = {"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA8020CC50","DataLSB":"0x43530104330A","Repeat":0}
VOLDOWN     = {"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA8020DC48","DataLSB":"0x435301043B12","Repeat":0}
CHUP        = {"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA8020C490","DataLSB":"0x435301042309","Repeat":0}
CHDOWN      = {"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA8020D488","DataLSB":"0x435301042B11","Repeat":0}
ENTER       = {"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA8020A090","DataLSB":"0x435301040509","Repeat":0}
EQ          = {"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA80202890","DataLSB":"0x435301041409","Repeat":0}
TIMER_ONOFF = {"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA80204AD0","DataLSB":"0x43530104520B","Repeat":0}
TIMER_CLOCK = {"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA80206AF0","DataLSB":"0x43530104560F","Repeat":0}
SLEEP       = {"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA802084E0","DataLSB":"0x435301042107","Repeat":0}
REPEAT      = {"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA80208E30","DataLSB":"0x43530104710C","Repeat":0}
MONO_STEREO = {"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA8020AC30","DataLSB":"0x43530104350C","Repeat":0}
TUNING_MODE = {"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA8020F488","DataLSB":"0x435301042F11","Repeat":0}
RW          = {"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA80204630","DataLSB":"0x43530104620C","Repeat":0}
FF          = {"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA80200ED0","DataLSB":"0x43530104700B","Repeat":0}
PLAY        = {"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA8020C0E0","DataLSB":"0x435301040307","Repeat":0}
PREV        = {"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA8020D808","DataLSB":"0x435301041B10","Repeat":0}
NEXT        = {"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA8020C810","DataLSB":"0x435301041308","Repeat":0}
STOP        = {"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA8020D0F8","DataLSB":"0x435301040B1F","Repeat":0}
USB_REC     = {"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA80204060","DataLSB":"0x435301040206","Repeat":0}
NEXT_10     = {"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA80201EC8","DataLSB":"0x435301047813","Repeat":0}
FUNCTION    = {"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA802090B8","DataLSB":"0x43530104091D","Repeat":0}

thing

UID: mqtt:topic:8862487c38:aecb111100
label: ESP8266 Wieża IR
thingTypeUID: mqtt:topic
configuration:
  payloadNotAvailable: Offline
  availabilityTopic: tele/tasmota_IR2_wieza/LWT
  payloadAvailable: Online
bridgeUID: mqtt:broker:8862487c38
location: Dori
channels:
  - id: ESP_IR_Wieza_Samsung_Tasmota
    channelTypeUID: mqtt:string
    label: Bramka BLE Online
    description: null
    configuration:
      postCommand: false
      retained: false
      formatBeforePublish: "%s"
      stateTopic: tele/tasmota_IR2_wieza/LWT
  - id: ipaddress
    channelTypeUID: mqtt:string
    label: IPAddress
    description: null
    configuration:
      postCommand: false
      retained: false
      formatBeforePublish: "%s"
      stateTopic: tele/tasmota_IR2_wieza/INFO2
      transformationPattern: JSONPATH:$.IPAddress
  - id: Wieza_Samsung_IR_CMD
    channelTypeUID: mqtt:string
    label: Wieża Samsung IR CMD
    description: null
    configuration:
      commandTopic: cmnd/tasmota_IR2_wieza/IRSend
      postCommand: true
      retained: false
      stateTopic: stat/tasmota_IR2_wieza/RESULT

My first thought was to put this lines directly in state descryption:

{"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA802080A0","DataLSB":"0x435301040105","Repeat":0}=ON
{"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA802080A0","DataLSB":"0x435301040105","Repeat":0}=OFF
{"Protocol":"PANASONIC","Bits":48,"Data":"0xC2CA80209C08","DataLSB":"0x435301043910","Repeat":0}=MUTE

but there is a problem with comma sign - it disappers from state description .

What other binding is involved here? Something is converting the MUTE command to {"IRSend": "Invalid RawData"}. The MQTT binding isn’t going to do that on its own. It’s not in your map file (unless you’ve cut off some lines). And the MUTE is translated to that JSON before MQTT attempts to translate that with the MAP because you get an error later on saying it can’t be found in the map file.

Where are you applying the MAP? It’s not configured in the Thing at all. If you are trying to use a Profile, realize that a Profile only applies to messages coming from the device into OH. You can’t translate a message from OH to the device using a profile. You need to configure that on the Thing (outgoing value transformation). And since you need to do that, you may as well configure the incoming transformation on the Thing too.

Probably no other bindings are used but maybe I didn’t add binding for MAP files.
I think but I’m not 100% sure that this {“IRSend”: “Invalid RawData”} is an answer from Tasmota device.

You can verify that by watching the MQTT messages using something MQTT Explorer. But I wouldn’t expect that to be the case here because it’s Autoupdate that is predicting the state which is OH guessing what the state of the Item will become, not the end device reporting it’s new state.

And this prediction is completely deterministic, not based on learning or past behavior. So if you’ve not configured it as part of the MQTT Channel config, it can only be coming from some other binding linked to this same Item.

But no matter what:

  1. Remove any transform profile
  2. Add the transform to the Channel config. You’ll probably need two MAPS, one for the messages coming from the device and one for the commands sent to the device.
1 Like

It looks that OH doesn’t use MAP file but why ?

cmnd/tasmota_IR2_wieza/IRSend MUTE *here sholud be state from MAP file*
stat/tasmota_IR2_wieza/RESULT {"IRSend":"Invalid RawData"}

Succes !

There was missing transformationPatternOut: MAP:ir_wieza.map

Here is correct thing file

UID: mqtt:topic:8862487c38:aecb111100
label: ESP8266 Wieża IR
thingTypeUID: mqtt:topic
configuration:
  payloadNotAvailable: Offline
  availabilityTopic: tele/tasmota_IR2_wieza/LWT
  payloadAvailable: Online
bridgeUID: mqtt:broker:8862487c38
location: Dori
channels:
  - id: ESP_IR_Wieza_Samsung_Tasmota
    channelTypeUID: mqtt:string
    label: Bramka BLE Online
    description: null
    configuration:
      postCommand: false
      retained: false
      formatBeforePublish: "%s"
      stateTopic: tele/tasmota_IR2_wieza/LWT
  - id: ipaddress
    channelTypeUID: mqtt:string
    label: IPAddress
    description: null
    configuration:
      postCommand: false
      retained: false
      formatBeforePublish: "%s"
      stateTopic: tele/tasmota_IR2_wieza/INFO2
      transformationPattern: JSONPATH:$.IPAddress
  - id: Wieza_Samsung_IR_CMD
    channelTypeUID: mqtt:string
    label: Wieża Samsung IR CMD
    description: null
    configuration:
      commandTopic: cmnd/tasmota_IR2_wieza/IRSend
      postCommand: false
      retained: false
      transformationPatternOut: MAP:ir_wieza.map
      stateTopic: stat/tasmota_IR2_wieza/RESULT