# Updating Code ready for openHAB upgrade

**URL:** <https://community.openhab.org/t/updating-code-ready-for-openhab-upgrade/114481>\
**Category:** Items & Sitemaps\
**Created:** [January 17, 2021, 1:10pm UTC](https://community.openhab.org/t/updating-code-ready-for-openhab-upgrade/114481 "2021-01-17T13:10:38Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Taffy](https://community.openhab.org/user_avatar/community.openhab.org/taffy/32/67131_2.png) [@Taffy](https://community.openhab.org/u/Taffy)\
**Post date:** [January 17, 2021, 1:10pm UTC](https://community.openhab.org/t/updating-code-ready-for-openhab-upgrade/114481/1 "2021-01-17T13:10:38Z")

</div>

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?

```yaml
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

---

<div class="post-metadata">

**Author:** ![hafniumzinc](https://community.openhab.org/letter_avatar_proxy/v4/letter/h/b9bd4f/32.png) [@hafniumzinc](https://community.openhab.org/u/hafniumzinc)\
**Post date:** [January 17, 2021, 10:16pm UTC](https://community.openhab.org/t/updating-code-ready-for-openhab-upgrade/114481/2 "2021-01-17T22:16:26Z")

</div>

Does the first topic in this post help?

> [@Control Tasmota flashed devices via MQTT](https://community.openhab.org/t/control-tasmota-flashed-devices-via-mqtt/104099/2):
>
> Slightly more advanced configurations This post assumes that the Things, Items and Sitemap files are already configured as in the previous post. Topics Device online/offline status The STATE message Device Wi-Fi signal quality Status on startup Device online/offline status In order to know whether our Tasmota device is actually reachable we can interrogate the Last Will and Testament (LWT) topic. play_button Click here for a simplified description of how this works a. Things i. mqttdevices.things Add …

---

<div class="post-metadata">

**Author:** ![Taffy](https://community.openhab.org/user_avatar/community.openhab.org/taffy/32/67131_2.png) [@Taffy](https://community.openhab.org/u/Taffy)\
**Post date:** [January 18, 2021, 5:31am UTC](https://community.openhab.org/t/updating-code-ready-for-openhab-upgrade/114481/3 "2021-01-18T05:31:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hafniumzinc](https://community.openhab.org/letter_avatar_proxy/v4/letter/h/b9bd4f/32.png) [@hafniumzinc](https://community.openhab.org/u/hafniumzinc)\
**Post date:** [January 18, 2021, 7:03am UTC](https://community.openhab.org/t/updating-code-ready-for-openhab-upgrade/114481/4 "2021-01-18T07:03:14Z")

</div>

> [@Taffy](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![Taffy](https://community.openhab.org/user_avatar/community.openhab.org/taffy/32/67131_2.png) [@Taffy](https://community.openhab.org/u/Taffy)\
**Post date:** [January 18, 2021, 9:17am UTC](https://community.openhab.org/t/updating-code-ready-for-openhab-upgrade/114481/5 "2021-01-18T09:17:57Z")

</div>

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 😀

---

<div class="post-metadata">

**Author:** ![Taffy](https://community.openhab.org/user_avatar/community.openhab.org/taffy/32/67131_2.png) [@Taffy](https://community.openhab.org/u/Taffy)\
**Post date:** [January 18, 2021, 7:46pm UTC](https://community.openhab.org/t/updating-code-ready-for-openhab-upgrade/114481/6 "2021-01-18T19:46:27Z")

</div>

@hafniumzinc

Ok so this is my item

```auto

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

```auto

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.

---

<div class="post-metadata">

**Author:** ![hafniumzinc](https://community.openhab.org/letter_avatar_proxy/v4/letter/h/b9bd4f/32.png) [@hafniumzinc](https://community.openhab.org/u/hafniumzinc)\
**Post date:** [January 18, 2021, 7:50pm UTC](https://community.openhab.org/t/updating-code-ready-for-openhab-upgrade/114481/7 "2021-01-18T19:50:51Z")

</div>

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:

```auto
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:

```auto
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.

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

```

---

<div class="post-metadata">

**Author:** ![Taffy](https://community.openhab.org/user_avatar/community.openhab.org/taffy/32/67131_2.png) [@Taffy](https://community.openhab.org/u/Taffy)\
**Post date:** [January 18, 2021, 8:27pm UTC](https://community.openhab.org/t/updating-code-ready-for-openhab-upgrade/114481/8 "2021-01-18T20:27:10Z")

</div>

Yes I used this guide

> [@How to add Wifi to a cheap smoke alarm](https://community.openhab.org/t/how-to-add-wifi-to-a-cheap-smoke-alarm/45671):
>
> I thought I’d shared what I’ve done here with a few smoke alarms to integrate them with OpenHAB. For years I’ve had regular battery-operated smoke alarms in some rooms, but it would be nice to also get notified out of home if they were ever to go off. However I didn’t want to spend boatloads of money on funky z-wave or KNX smoke alarms, and there was no wiring or space for putting any in. Adding an ESP8266 and therefore some Wifi was the obvious temptation, but it would have drained the alarm…

Thank you I will give that a go 😀

---

<div class="post-metadata">

**Author:** ![hafniumzinc](https://community.openhab.org/letter_avatar_proxy/v4/letter/h/b9bd4f/32.png) [@hafniumzinc](https://community.openhab.org/u/hafniumzinc)\
**Post date:** [January 18, 2021, 8:38pm UTC](https://community.openhab.org/t/updating-code-ready-for-openhab-upgrade/114481/9 "2021-01-18T20:38:37Z")

</div>

> [@Taffy](#):
>
> Yes I used this guide

Ah, I see! Makes sense now!

---

<div class="post-metadata">

**Author:** ![Taffy](https://community.openhab.org/user_avatar/community.openhab.org/taffy/32/67131_2.png) [@Taffy](https://community.openhab.org/u/Taffy)\
**Post date:** [January 19, 2021, 7:40pm UTC](https://community.openhab.org/t/updating-code-ready-for-openhab-upgrade/114481/10 "2021-01-19T19:40:57Z")

</div>

getting these warnings ?

```auto
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

```

---

<div class="post-metadata">

**Author:** ![hafniumzinc](https://community.openhab.org/letter_avatar_proxy/v4/letter/h/b9bd4f/32.png) [@hafniumzinc](https://community.openhab.org/u/hafniumzinc)\
**Post date:** [January 19, 2021, 7:45pm UTC](https://community.openhab.org/t/updating-code-ready-for-openhab-upgrade/114481/11 "2021-01-19T19:45:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Taffy](https://community.openhab.org/user_avatar/community.openhab.org/taffy/32/67131_2.png) [@Taffy](https://community.openhab.org/u/Taffy)\
**Post date:** [January 19, 2021, 7:48pm UTC](https://community.openhab.org/t/updating-code-ready-for-openhab-upgrade/114481/12 "2021-01-19T19:48:36Z")

</div>

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