Updating Code ready for openHAB upgrade

Good afternoon,

Im currently in the process of upgrading my openhab but need to update all my files as the last time i tried an upgrade all my mqtt items wouldn’t respond as they items files were wrong.

Ive managed to create things and items for 95% of my devices ready for the move im just struggling with this last one regarding LWT.

Could anyone point me in the right directection or have an example of how to format the thing for this device?

Switch Hallway_Fire_Alarm  "Hallway Smoke Alarm is [MAP(switchtrigger.map):%s]" <smoke> {mqtt="<[broker:tele/Hallway_Fire_Alarm/LWT:state:MAP(online.map)]"}

Thank you in advance

Does the first topic in this post help?

It does yet but I’m still confused about where I put the switchtrigger.map and the online.map?

Same place as always, in the transform folder.

If you mean where in the configuration, please post the contents of both files to determine the best course of action.

Thank you @hafniumzinc. Yes the files are already in use in the transform folder. I will reply with my configuration once I finish work today :grinning:

@hafniumzinc

Ok so this is my item


Switch Hallway_Fire_Alarm  "Hallway Smoke Alarm is [MAP(switchtrigger.map):%s]" <smoke> {mqtt="<[broker:tele/Hallway_Fire_Alarm/LWT:state:MAP(online.map)]"} 

And this is my sitemap for said item


Text item=Hallway_Fire_Alarm

These are the 2 transform files

online.map
Online=ON
Offline=OFF

switchtrigger.map
OFF=Idle
ON=Triggered!
-=idle
NULL=unknown

Please could you provide info on where I should implement the online.map and switchtrigger.map in the new format.

So just to understand - you are using the ONLINE/OFFLINE status from the MQTT LWT topic to ascertain whether your fire alarm has been triggered? Does that mean when it just sits there un-activated, it is not connected to the MQTT broker, but when it senses fire it connects to the MQTT broker?

Either way, to get it working exactly the same as before:

Thing

Assuming all your MQTT Things are nested inside your MQTT Bridge/Broker Thing:

Thing topic fireAlarm "Fire Alarm" {
    Channels:
        switch : LWT "Fire Alarm LWT" [
            stateTopic = "tele/Hallway_Fire_Alarm/LWT",
            transformationPattern = "MAP:online.map"
        ]
}

or you can get rid of one of your maps:

Thing topic fireAlarm "Fire Alarm" {
    Channels:
        switch : LWT "Fire Alarm LWT" [
            stateTopic = "tele/Hallway_Fire_Alarm/LWT",
            on="Online",
            off="Offline"
        ]
}

Item

Fill in the BROKER in the Channel with your broker name, if required.

Switch Hallway_Fire_Alarm  "Hallway Smoke Alarm is [MAP(switchtrigger.map):%s]" <smoke> {channel="mqtt.topic.BROKER.fireAlarm.LWT"}
1 Like

Yes I used this guide

Thank you I will give that a go :grinning:

Ah, I see! Makes sense now!

getting these warnings ?

2021-01-19 19:39:14.392 [WARN ] [eneric.internal.generic.ChannelState] - Command 'Online' not supported by type 'OnOffValue': No enum constant org.eclipse.smarthome.core.library.types.OnOffType.Online

2021-01-19 19:39:32.818 [WARN ] [rm.AbstractFileTransformationService] - Could not transform 'UNDEF' with the file 'switchtrigger.map' : Target value not found in map for 'UNDEF'

2021-01-19 19:39:32.828 [WARN ] [rm.AbstractFileTransformationService] - Could not transform 'NULL' with the file 'switchtrigger.map' : Target value not found in map for 'NULL'

2021-01-19 19:39:32.835 [WARN ] [rm.AbstractFileTransformationService] - Could not transform 'NULL' with the file 'switchtrigger.map' : Target value not found in map for 'NULL'

2021-01-19 19:39:33.073 [WARN ] [io.openhabcloud.internal.CloudClient] - Jetty request 13038268 failed: null

2021-01-19 19:39:33.078 [WARN ] [io.openhabcloud.internal.CloudClient] - Response Failure: null

2021-01-19 19:39:34.163 [WARN ] [io.openhabcloud.internal.CloudClient] - Jetty request 13038269 failed: null

2021-01-19 19:39:34.165 [WARN ] [io.openhabcloud.internal.CloudClient] - Response Failure: null

2021-01-19 19:39:34.365 [WARN ] [rm.AbstractFileTransformationService] - Could not transform 'UNDEF' with the file 'switchtrigger.map' : Target value not found in map for 'UNDEF'

2021-01-19 19:39:34.372 [WARN ] [rm.AbstractFileTransformationService] - Could not transform 'NULL' with the file 'switchtrigger.map' : Target value not found in map for 'NULL'

2021-01-19 19:39:34.379 [WARN ] [rm.AbstractFileTransformationService] - Could not transform 'NULL' with the file 'switchtrigger.map' : Target value not found in map for 'NULL'

2021-01-19 19:39:48.991 [WARN ] [eneric.internal.generic.ChannelState] - Command 'Offline' not supported by type 'OnOffValue': No enum constant org.eclipse.smarthome.core.library.types.OnOffType.Offline

What’s your configuration now, and have you restarted openHAB since you’ve made the changes?

all sorted i just added
NULL=Idle on my switchtrigger.map and its all working as it should be