Hello,
Inbound MQTT state messages are not being transformed, and result in an error;
2021-05-27 23:56:20.570 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '0' with the file 'command.map' : Target value not found in map for '0'
2021-05-27 23:56:20.573 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '' not supported by type 'OnOffValue': No enum constant org.openhab.core.library.types.OnOffType.
“command.map” exists in the Transform folder.
I need inbound MQTT state messages to be transformed from “1” to “ON”, and “0” to “OFF”.
To test sending Mqtt state messages to OH3, I use MQTT Explorer
Test setup includes vanilla OH3 Raspian build on Raspberry Pi 4.
- OH version = 3.0.2 - Release Build
- Mosquitto installed
- MQTT Broker configured
- 1 x Thing (a switch)
- 1 x Channel (MQTT channel linked to the switch)
- 1 x Item (linked to the channel)
- 2 x Topics (1 x state, 1 x command)
I use a mac, so i have MQTT Explorer installed to monitor & troubleshoot MQTT messages.
pretty straight forward so far!
Resulting config below
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:pi4MqttBroker
channels:
- id: onofftestchannel
channelTypeUID: mqtt:switch
label: onofftestchannel
description: ""
configuration:
commandTopic: myhome/test/command
postCommand: false
transformationPatternOut: MAP:command.map
stateTopic: myhome/test/state
TransformationPattern: MAP:command.map
The transformation MAP error occurs regardless of what payload I send… of “ON” or “OFF” or “0” or “1” are all not processed. result in error.
Outbound MQTT command topic message are OK and are transformed. (if I edit the mapping file for additional maps). if i turn the switch on, topic with payload of “1” is sent.
I had this working successfully for about an hour. I then started to back stuff up, and add comments to the command.map file… and since then transformation map has stopped working.
Is there a transformation cache or similar I can clear?
I’ll try removing and re-adding the transformation service later this evening.