Issues after update to OH 3


since updating to OH3 I am facing some issues which I cannot get rid of on my own:

  1. Script execution of rule with UID 'humidity-1' failed: Unknown variable or command '!==';
    This is caused by:
val lastNotificationTime = lastNotifications.get(timerKey);
if (lastNotificationTime !== null) {
  1. MapDB doesn’t seem to work anymore. I already re-installed the extension but that didn’t fix the issue. The same configuration did work properly with OH 2.5 and I did not find any breaking changes for the MapDB.
    3.Rule file doesn’t load on startup. It is not listed on startup within the “Loading model…” logs but does load once I use touch. Here are the contents of the file if relevant:
import java.util.Map

val Map<String, Timer> turnOffLightTimers = newHashMap

rule "Motion Light: Turn on light on motion"
  Member of Group_Motion_Presence_Indoor changed
    val SwitchItem motionItem = triggeringItem as SwitchItem;

    logInfo("motion.light.rules", + ", " + State_Dark_Outside.state);
    if (
        State_Dark_Outside.state != ON
        || ("Bathroom") == -1 && Light_Scene_Comfortable_Trigger.state == ON)
    ) { 
        // Do nothing if the comfortable light is still on or it is not dark yet
    val String linkedLightsString = transform("MAP", "",;
    val String[] linkedLights = linkedLightsString.split(",");
    if (linkedLights.length == 0) {
      logInfo("motion.light.rules", "No entry in map for " + + ".");

    logInfo("motion.light.rules", "Linked lights are " + linkedLights.join(", ") + ".");
    logInfo("motion.light.rules", "Received " + triggeringItem.state);

    for (var i = 0; i < linkedLights.length; i++) {
      val String linkedLightItemName = linkedLights.get(i);
      val linkedLightItem = Group_Lights_Color.members.findFirst[name.equals(linkedLightItemName)] as GenericItem;
      if (linkedLightItem === null) {
          logError("motion.light.rules", "No linked light found for " + linkedLightItemName + ".");
      logInfo("motion.light.rules", "Handling light " + + ".");
      val timerKey =;

      val int timerDelayInSeconds = 120;

      if (motionItem.state == ON) {
        logInfo("motion.light.rules", "Motion detected by " + + ", turning on " + + ".");
        val colorValue = "13,100,5"; // Color,Saturation,Brightness
        val existingTimer = turnOffLightTimers.get(timerKey);
        if (existingTimer !== null) {
          turnOffLightTimers.put(timerKey, null);
      } else { // No more motion
        logInfo("motion.light.rules", "No more motion detected by " + + ", turning off " + + " in " + timerDelayInSeconds + " seconds.");
        val existingTimer = turnOffLightTimers.get(timerKey);
        if (existingTimer === null) {
          turnOffLightTimers.put(timerKey, createTimer(now.plusSeconds(timerDelayInSeconds), [|
            logInfo("motion.light.rules", "No more motion detected by " + + ", turning off now.");
            turnOffLightTimers.put(timerKey, null);
            val colorValue = "0,0,0"; // Color,Saturation,Brightness
        } else { // Timer already exists, reschedule
          logInfo("motion.light.rules", "No more motion detected by " + + ", rescheduling timer.");

I would like to sort these issues out on my own, but I failed to find a working solution online.

  1. What is lastNotifications? How is it defined? How is it populated? Is this still in a .rules file or in the UI?

  2. Did you do an in place upgrade? You might need to delete the $OPENHAB_USERDATA/persitence/mapdb files and let OH recreate them. I vaguely remember reports that the old mapdb files from 2.5 won’t work in 3.0.

  3. I can’t help with that one.

  1. Its a Map consisting of Timers that are created when the humidity reaches a certain point.
import java.util.Map

val Map<String, Number> lastLevels = newHashMap
val Map<String, DateTime> lastNotifications = newHashMap
val Map<String, Timer> humidityCheckTimers = newHashMap
/// <....>
    humidityCheckTimers.put(timerKey, createTimer(now.plusSeconds(1), [|
            if (triggeringItem.state as Number * 100 > threshold) {
                logInfo("humidity.rules", "Humidity in  " + roomName + " is at " + level + " (via timer).");

                val String translatedRoomName = transform("MAP", "", roomName);
                val output = "Die Luftfeuchtigkeit in " + translatedRoomName + " ist zu hoch. Bitte lüften!";
                if (State_High_Humidity_Reminder_Active.state != OFF) { // Only emit voice warnin if condition is met
                    // Notification_VoiceText_Notifications.sendCommand(output);
                lastNotifications.put(timerKey, now);

                lastNotifications.put(timerKey, now);

                // Set global warning for item
            } else { // Humidity level has dropped
                if (humidityCheckTimers.get(timerKey) !== null) {
                    // If timer has not yet fired, cancel it
                    logInfo("humidity.rules", "Humidity has dropped below threshold, removing reminder timer.");

                    // Remove global warning for item

Worked before the update.

  1. Just updated using openhabian-config. One thing i noticed was that the SSH welcome message still shows version 2.5.11.
    I will try to delete the files and see what happens.

Because my installation of openHAB sometimes is quite slow (about 5 seconds between click on button in HABpanel and lights turning off/on) I am thinking about making a fresh install on my Raspi 4 (currently using Raspi 3) - so that might help with the 3. issue…

You didn’t answer whether this is still in a .rules file or defined in the UI. If it’s defined in the UI, have you tried keeping it in the .rules file? Frankly, even without the error you are seeing this won’t work in the UI because you can’t define your maps as globals (i.e. outside of the rule itself). So you’ll probably need to keep this in a .rules file anyway, or move to JavaScript as the language.

If you move to JavaScript, you could use timerMgr to handle the timers instead.

Sorry, didn’t read that part. This is and always was a .rules file.
Currently trying to switch over to JS but this is going slowly as I did not find any tutorial that fits my needs. I know there are several, but I am having issues on getting it started (which would be nice because I would love to use JS instead of DSL).

Since it is not in the UI, I don’t really have any ideas. Nothing really changed that would impact a rule like this except for the move from Joda DateTime to ZonedDateTime but that change I would have expected to cause a different error.

Though now that I look at it, you need to change your Map<String, DateTime> to Map<String,ZonedDateTime>.

Yep, I think that was the reason. Thanks.

@rikoshak Unfortunately this didn’t work.

Unfortunately I don’t have anything more to offer for the MapDB problem. Those who reported problems were able to fix them by deleting the MapDB files. Maybe if there were errors in the logs.

Hi @rlkoshak
I performed a fresh installation of openHABian with OH 3.0.1 (Release Build) on my Raspi 4 (instead of Raspi 3).
This solved the Map DB issue for me, persisting states works now.

However, the issue with my rule file not loading without it being touched after the service start remains.
Could it be the case that I have named it motion.lights.rules and thus created a conflict in namespaces? My VSCode sometimes marks the whole file as an error with a text like “Package motion has already been declared in motion.rules”. Maybe this is related?

This cropped up recently, and I’m sure it was a problem in some circumstances at least. The documentation does not forbid it - but neither does it say it is a good idea.

Ah, found it -

I’ll guess you have motion.somethingelse.rules as well?

Yes, I have my files organized that was, as it has been proposed in How do you structure your openhab files?.
I indeed do have a file called motion.rules.

My question would be: is there any chance this is being fixed (aka switched back to what it was before (I came from 2.5.9, there it still worked) - or am I better off changing my naming convention?

Be careful here. The important part in rossko57’s post is the somethingelse. motion.rules should be fine. mostion.somethingelse.rules would cause problems. More than one . in the file name is what causes problems.

I mentioned an issue should be filed on this in that thread. I don’t know if that happened.

I’m not so sure, it looks like
will have problems because of common motion used as namespace or something.

Now I cleaned the cache and this caused openHAB to not start properly anymore.
I am gettings this error every minute:

2021-02-09 18:40:10.286 [ERROR] [core.karaf.internal.FeatureInstaller] - 
Failed installing 'openhab-binding-networkupstools, openhab-persistence-mapdb, 
openhab-voice-voicerss, openhab-binding-deconz, openhab-binding-mail, 
openhab-transformation-javascript, openhab-binding-network, 
openhab-persistence-influxdb, openhab-binding-sonos, openhab-ui-habpanel, 
openhab-persistence-rrd4j, openhab-binding-netatmo, openhab-transformation-map, 
openhab-ui-basic, openhab-binding-openweathermap, openhab-binding-http, 
openhab-binding-astro, openhab-binding-telegram, openhab-binding-homematic, 
openhab-binding-systeminfo': Error occurred installing a bundle.

The UI tells me:

No bindings installed yet
Add-ons fügen Ihrem openHAB-System Funktionalität hinzu.
Installiere diese mit der Schaltfläche unten.

While I don’t think that this is related, I would greatly appreciate any help with that.

Edit: After several reboots I now do not even receive any signs of life when starting beside that:

2021-02-09 19:53:26.207 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Time zone set to 'Europe/Berlin'.

2021-02-09 19:53:26.292 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Location set to '51.40595735299591,6.649402924638057'.

2021-02-09 19:53:26.300 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Locale set to 'de'.

I renamed my files so that I do not have the first part (e.g. “motion”) as a separate file, so no more motion.rules, instead I now have motion.notify.rules. However the problem still exists - also with other files like notification.push.rules, and notification.sound.rules. I can only send push notifications once I touched the file after a restart.

Yes, when the problem revolves around filenames that all begin with the same segment, you will have a problem with filenames that all begin with notification. What did you expect.

I just wanted to point out that the issue is not coming from having a motion.rules and a motion.lights.rules file (i.e. a file that basically just has the first package part as its name), but will always occur when there is a common start of filenames.

Which is exactly what rossko57 and I have been trying to say all this time.