openHAB restart changes MQTT switch type from ON/OFF to 0/1

  • Platform information:
    • Hardware: aarch64 with 32 bit kernel/4gb/30GB
    • OS: Debian 10.8
    • Java Runtime Environment: openjdk 2020-11-04
    • openHAB version: 3.0.2

I have configured an outgoing MQTT channel of type switch using the test.things file and connected it to a Switch item in the main UI. I specified transformationPatternOut to convert the item state to a complex json message using the MAP transformation with the file According to the documentation the transformation should map the values ON and OFF, this works until I restart openHAB. Sometimes after a restart of openHAB the values change to 1 and 0. After a restart of the raspberry pi the values are ON and OFF again.

Currently I use 1 and 0 in the map file, which works until I restart the raspberry pi, then I get the following log message Could not transform 'OFF' with the file ''.... However changing the map file to ON and OFF does not work because then after a restart of openHAB I get Could not transform '0' with the file ''...


Thing topic MySwitches "MySwitches " {
        Type switch : Unit1 "Unit 1" [ commandTopic="foo", transformationPatternOut="" ]


I can switch between ON/OFF and 0/1 by restarting openHAB and the raspberry pi respectively.

Dirty workaround


Yes I know, but I think there is a bug in openHAB which causes this behavior, which should be fixed.

1 Like

I discovered that the SD card of the raspberry pi is corrupted and resets after reboot. I ordered a new one and will test if the problem persists.