Openhab2 rules problem. PaperUI rules present in Karaf scheduler, HABmin rules do not import or execute

I have a problem with OpenHAB2 with getting rules to import/execute.
When I define rules in PaperUI, I can see them in the web interface and also in Karaf under the scheduler:

openhab> smarthome:automation listRules
----------------------------------------------------------------------------------------------------
ID     UID                                 NAME                                STATUS
----------------------------------------------------------------------------------------------------
1      0df4c68f-1634-4858-a10a-c6ec784ee31d PNUT Night Lite OFF                 IDLE
2      1d75bf81-a51f-422c-b2ab-41ed4e9c8c7e PNUT Night Light ON                 IDLE
3      46df60c6-3343-40f5-a78e-97094f877f65 PNUT ROOM LIGHT OFF (SCHOOL DAYS)   IDLE
4      695d0f0c-d7c9-491b-8dfa-143632af2891 X-MAS Lights ON Outside             IDLE
5      73ab5aa5-ee41-43e5-857f-945f61bdaadc LVRM LAMP OFF (SLEEP)               IDLE
6      74aa25ef-03ea-495c-8247-8a7c0b5fe8c7 PNUT ROOM LIGHT ON (SCHOOL DAYS)    IDLE
7      acdf5eec-ebb8-4e2a-a901-6ae2c17e9342 X-MAS Lights OFF Outside            IDLE
8      d2bed2bf-57e5-4489-8295-3f8cf3949882 MBRM Night Lights ON                IDLE
9      f6c8b229-28e0-4780-88e1-441049208c14 MBRM Night Lights OFF               IDLE
10     ffa4238e-b4ef-4526-bdb1-fbb589ece9bb LVRM LAMP ON (DAY/EVENING)          IDLE
----------------------------------------------------------------------------------------------------

However, when I try to use HABmin rules designer, the rules are written to disk but won’t work. They are being written under /etc/openhab2/rules.
ls /etc/openhab2/rules
(1)_office_fan.rules readme.txt

I tried to use karaf to import the office_fan.rules file and it blows up apparently doesn’t like the formatting. (yes, I do understand that I have to escape the parenthesis, etc. I am not a linux/unix novice.)

Can someone help me to understand just how RULES execute or get imported into OpenHAB2. I have poured through a ton of docs and it seems a lot are geared towards older versions. Perhaps I made a mistake of going with Openhab2 vs the older platform. There are no errors in the openhab.log file related to rules or syntax errors. I suspect the HABmin rules are just not being seen at all.

The PaperUI rules are very simplistic and won’t do what I would like accomplish.

* Platform information:
  * OS: Ubuntu 4.4.0-116-generic
  * Java Runtime Environment: openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.16.04.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
  * openHAB version:
Active   0.10.0.201802191927    Eclipse SmartHome *
Active   2.12.0.v20170518-0757  Xtend Runtime Library
Active   2.12.0.v20170518-0757  Xtend Macro Interfaces
Active   2.12.0.v20170518-0959  Xtext
Active   2.12.0.v20170519-0752  Xtext Common Types
Active   2.12.0.v20171017-1700  Xtext IDE Core
Active   2.12.0.v20170518-0959  Xtext Utility
Active   2.12.0.v20170519-0752  Xbase Model
Active   2.12.0.v20170519-0752  Xbase Generic IDE Services
Active   2.12.0.v20170518-0757  Xbase Runtime Library
Active   2.3.0                  JUPnP Library
Active   2.3.0.201803071159     openHAB Core
Active   2.3.0.201803071159     openHAB Karaf Integration
Resolved 2.3.0.201803071159     openHAB Sound Support, Hosts: 116
Active   2.3.0.201803071159     openHAB Dashboard UI
Active   2.3.0.201803071159     openHAB 1.x Compatibility Layer
Active   1.1.1.201605111122     Swagger Provider
Active   2.4.5                  Jackson-annotations
Active   2.4.5                  Jackson-core
Active   2.4.5                  jackson-databind
Active   2.4.5                  Jackson-dataformat-YAML
Active   0.10.0.201802191927    Eclipse SmartHome Automation API
Active   0.10.0.201802191927    Eclipse SmartHome Automation commands
Active   0.10.0.201802191927    Eclipse SmartHome Automation Core
Active   0.10.0.201802191927    Eclipse SmartHome Automation Module Core
Active   0.10.0.201802191927    Eclipse SmartHome Automation Media Modules
Active   0.10.0.201802191927    Eclipse SmartHome Automation Module Script
Active   0.10.0.201802191927    Eclipse SmartHome Automation Script Globals
Active   0.10.0.201802191927    Eclipse SmartHome Automation Script RuleSupport
Active   0.10.0.201802191927    Eclipse SmartHome Automation Module Timer
Active   0.10.0.201802191927    Eclipse SmartHome Automation GSON Parser
Active   0.10.0.201802191927    Eclipse SmartHome Automation Providers
Active   0.10.0.201802191927    Eclipse SmartHome Automation REST API
Active   0.10.0.201712081218    Eclipse SmartHome Exec Transformation Service
Active   0.10.0.201712081218    Eclipse SmartHome JavaScript Transformation Service
Active   0.10.0.201712081218    Eclipse SmartHome JSonPath Transformation Service
Active   0.10.0.201712081218    Eclipse SmartHome Map Transformation Service
Active   0.10.0.201712081218    Eclipse SmartHome RegEx Transformation Service
Active   0.10.0.201712081218    Eclipse SmartHome Scale Transformation Service
Active   0.10.0.201712081218    Eclipse SmartHome XPath Transformation Service
Active   0.10.0.201712081218    Eclipse SmartHome Xslt Transformation Service
Active   0.10.0.201712081218    Eclipse SmartHome Basic UI, Fragments: 234
Active   0.10.0.201712081218    Eclipse SmartHome WebApp UI, Fragments: 235
Active   0.10.0.201712081218    Eclipse SmartHome Paper UI, Fragments: 238
Active   1.3.5.0                MariaDB JDBC Client
Active   2.3.0.201801141430     Network Binding
Active   2.3.0.201801141430     ZWave Binding
Active   2.3.0.201801141430     openHAB REST Documentation
Active   1.12.0.201801160209    openHAB JDBC SQL Persistence bundle
Resolved 2.3.0.201801141430     openHAB Basic UI Fragment, Hosts: 226
Resolved 2.3.0.201801141430     openHAB Classic UI Fragment, Hosts: 227
Active   2.3.0.201801141430     HABmin User Interface
Active   2.3.0.201801141430     HABPanel User Interface
Resolved 2.3.0.201801141430     openHAB Paper UI Theme Fragment, Hosts: 228
Active   0.9.10.v20160429-1435  reflections (wrap)
Active   1.5.8.v20160511-1038   swagger-jersey2-jaxrs (wrap)
Active   1.12.0.201801160209    openHAB Mqtt Action
Active   1.12.0.201801160209    openHAB MQTT Transport Bundle

First, please use How to use code fences for logs and other data copied and pasted from a terminal.

The Experimental Rules Engine (i.e. rules you create from PaperUI, pay attention to that “experimental,” part of the name, it is still a work in progress) are completely separate from the Rules DSL. Habmin generates Rules DSL (i.e. .rules files). However, I don’t know how well Habmin has kept up with changes to the Rules over the last couple of years so I don’t know if the .rules files generated by it will still work.

.rules files are automatically read into OH as soon as the file is written or changed.

The likely problem here is that there is a syntax error in the generated .rules file. Always look at the logs when you experience problems. You will probably see a line telling you what line and column number there is a syntax error.

Thanks for response,

Is it possible the .rules files need to be dropped into a different folder location?
Presently HABmin is placing them under /etc/openhab2/rules.
The rest of openhab config files seem to be located under /var/lib/openhab2/.

Under /var/lib/openhab2/jsondb there is a file called “automation_rules.json” which appears to be updated with the rules/triggers/events that I defined in PaperUI, but nothing that was done in HABmin.

cat automation_rules.json
{
  "74aa25ef-03ea-495c-8247-8a7c0b5fe8c7": {
    "class": "org.eclipse.smarthome.automation.Rule",
    "value": {
      "triggers": [
        {
          "id": "1",
          "label": "it is a fixed time of day",
          "description": "Triggers at a specified time",
          "configuration": {
            "properties": {
              "time": "06:45"
            }
          },
          "type": "timer.TimeOfDayTrigger"
        }
      ],
      "conditions": [
        {
          "id": "2",
          "label": "it is a certain day of the week",
          "description": "checks for the current day of the week",
          "configuration": {
            "properties": {
              "days": [
                "MON",
                "TUE",
                "WED",
                "THU",
                "FRI"
              ]
            }
          },
          "type": "timer.DayOfWeekCondition"
        }
      ],
      "actions": [
        {
          "id": "3",
          "label": "send a command",
          "description": "Sends a command to a specified item.",
          "configuration": {
            "properties": {
              "itemName": "zwave_device_bd10a0f8_node15_switch_binary",
              "command": "ON"
            }
          },
          "type": "core.ItemCommandAction"
        }
      ],
      "configuration": {
        "properties": {}
      },
      "configDescriptions": [],
      "uid": "74aa25ef-03ea-495c-8247-8a7c0b5fe8c7",
      "name": "PNUT ROOM LIGHT ON (SCHOOL DAYS)",
      "tags": [],
      "visibility": "VISIBLE",
      "description": ""
    }
  },
  "0df4c68f-1634-4858-a10a-c6ec784ee31d": {
    "class": "org.eclipse.smarthome.automation.Rule",
    "value": {
      "triggers": [
        {
          "id": "1",
          "label": "it is a fixed time of day",
          "description": "Triggers at a specified time",
          "configuration": {
            "properties": {
              "time": "08:00"
            }
          },
          "type": "timer.TimeOfDayTrigger"
        }
      ],
      "conditions": [],
      "actions": [
        {
          "id": "2",
          "label": "send a command",
          "description": "Sends a command to a specified item.",
          "configuration": {
            "properties": {
              "itemName": "zwave_device_bd10a0f8_node7_switch_binary",
              "command": "OFF"
            }
          },
          "type": "core.ItemCommandAction"
        }
      ],
      "configuration": {
        "properties": {}
      },
      "configDescriptions": [],
      "uid": "0df4c68f-1634-4858-a10a-c6ec784ee31d",
      "name": "PNUT Night Lite OFF",
      "tags": [],
      "visibility": "VISIBLE"
    }
  },
  "695d0f0c-d7c9-491b-8dfa-143632af2891": {
    "class": "org.eclipse.smarthome.automation.Rule",
    "value": {
      "triggers": [
        {
          "id": "1",
          "label": "it is a fixed time of day",
          "description": "Triggers at a specified time",
          "configuration": {
            "properties": {
              "time": "17:00"
            }
          },
          "type": "timer.TimeOfDayTrigger"
        }
      ],
      "conditions": [],
      "actions": [
        {
          "id": "2",
          "label": "send a command",
          "description": "Sends a command to a specified item.",
          "configuration": {
            "properties": {
              "itemName": "zwave_device_bd10a0f8_node9_switch_binary",
              "command": "ON"
            }
          },
          "type": "core.ItemCommandAction"
        }
      ],
      "configuration": {
        "properties": {}
      },
      "configDescriptions": [],
      "uid": "695d0f0c-d7c9-491b-8dfa-143632af2891",
      "name": "X-MAS Lights ON Outside",
      "tags": [],
      "visibility": "VISIBLE"
    }
  },
  "ffa4238e-b4ef-4526-bdb1-fbb589ece9bb": {
    "class": "org.eclipse.smarthome.automation.Rule",
    "value": {
      "triggers": [
        {
          "id": "1",
          "label": "it is a fixed time of day",
          "description": "Triggers at a specified time",
          "configuration": {
            "properties": {
              "time": "06:30"
            }
          },
          "type": "timer.TimeOfDayTrigger"
        }
      ],
      "conditions": [],
      "actions": [
        {
          "id": "2",
          "label": "send a command",
          "description": "Sends a command to a specified item.",
          "configuration": {
            "properties": {
              "itemName": "zwave_device_bd10a0f8_node14_switch_binary",
              "command": "ON"
            }
          },
          "type": "core.ItemCommandAction"
        }
      ],
      "configuration": {
        "properties": {}
      },
      "configDescriptions": [],
      "uid": "ffa4238e-b4ef-4526-bdb1-fbb589ece9bb",
      "name": "LVRM LAMP ON (DAY/EVENING)",
      "tags": [],
      "visibility": "VISIBLE"
    }
  },
  "f6c8b229-28e0-4780-88e1-441049208c14": {
    "class": "org.eclipse.smarthome.automation.Rule",
    "value": {
      "triggers": [
        {
          "id": "1",
          "label": "it is a fixed time of day",
          "description": "Triggers at a specified time",
          "configuration": {
            "properties": {
              "time": "23:30"
            }
          },
          "type": "timer.TimeOfDayTrigger"
        }
      ],
      "conditions": [],
      "actions": [
        {
          "id": "2",
          "label": "send a command",
          "description": "Sends a command to a specified item.",
          "configuration": {
            "properties": {
              "itemName": "zwave_device_bd10a0f8_node2_switch_binary",
              "command": "OFF"
            }
          },
          "type": "core.ItemCommandAction"
        },
        {
          "id": "3",
          "label": "send a command",
          "description": "Sends a command to a specified item.",
          "configuration": {
            "properties": {
              "itemName": "zwave_device_bd10a0f8_node3_switch_binary",
              "command": "OFF"
            }
          },
          "type": "core.ItemCommandAction"
        }
      ],
      "configuration": {
        "properties": {}
      },
      "configDescriptions": [],
      "uid": "f6c8b229-28e0-4780-88e1-441049208c14",
      "name": "MBRM Night Lights OFF",
      "tags": [],
      "visibility": "VISIBLE"
    }
  },
  "73ab5aa5-ee41-43e5-857f-945f61bdaadc": {
    "class": "org.eclipse.smarthome.automation.Rule",
    "value": {
      "triggers": [
        {
          "id": "1",
          "label": "it is a fixed time of day",
          "description": "Triggers at a specified time",
          "configuration": {
            "properties": {
              "time": "01:00"
            }
          },
          "type": "timer.TimeOfDayTrigger"
        }
      ],
      "conditions": [],
      "actions": [
        {
          "id": "2",
          "label": "send a command",
          "description": "Sends a command to a specified item.",
          "configuration": {
            "properties": {
              "itemName": "zwave_device_bd10a0f8_node14_switch_binary",
              "command": "OFF"
            }
          },
          "type": "core.ItemCommandAction"
        }
      ],
      "configuration": {
        "properties": {}
      },
      "configDescriptions": [],
      "uid": "73ab5aa5-ee41-43e5-857f-945f61bdaadc",
      "name": "LVRM LAMP OFF (SLEEP)",
      "tags": [],
      "visibility": "VISIBLE"
    }
  },
  "acdf5eec-ebb8-4e2a-a901-6ae2c17e9342": {
    "class": "org.eclipse.smarthome.automation.Rule",
    "value": {
      "triggers": [
        {
          "id": "1",
          "label": "it is a fixed time of day",
          "description": "Triggers at a specified time",
          "configuration": {
            "properties": {
              "time": "00:00"
            }
          },
          "type": "timer.TimeOfDayTrigger"
        }
      ],
      "conditions": [],
      "actions": [
        {
          "id": "2",
          "label": "send a command",
          "description": "Sends a command to a specified item.",
          "configuration": {
            "properties": {
              "itemName": "zwave_device_bd10a0f8_node9_switch_binary",
              "command": "OFF"
            }
          },
          "type": "core.ItemCommandAction"
        }
      ],
      "configuration": {
        "properties": {}
      },
      "configDescriptions": [],
      "uid": "acdf5eec-ebb8-4e2a-a901-6ae2c17e9342",
      "name": "X-MAS Lights OFF Outside",
      "tags": [],
      "visibility": "VISIBLE"
    }
  },
  "d2bed2bf-57e5-4489-8295-3f8cf3949882": {
    "class": "org.eclipse.smarthome.automation.Rule",
    "value": {
      "triggers": [
        {
          "id": "1",
          "label": "it is a fixed time of day",
          "description": "Triggers at a specified time",
          "configuration": {
            "properties": {
              "time": "17:00"
            }
          },
          "type": "timer.TimeOfDayTrigger"
        }
      ],
      "conditions": [],
      "actions": [
        {
          "id": "2",
          "label": "send a command",
          "description": "Sends a command to a specified item.",
          "configuration": {
            "properties": {
              "itemName": "zwave_device_bd10a0f8_node2_switch_binary",
              "command": "ON"
            }
          },
          "type": "core.ItemCommandAction"
        },
        {
          "id": "3",
          "label": "send a command",
          "description": "Sends a command to a specified item.",
          "configuration": {
            "properties": {
              "itemName": "zwave_device_bd10a0f8_node3_switch_binary",
              "command": "ON"
            }
          },
          "type": "core.ItemCommandAction"
        }
      ],
      "configuration": {
        "properties": {}
      },
      "configDescriptions": [],
      "uid": "d2bed2bf-57e5-4489-8295-3f8cf3949882",
      "name": "MBRM Night Lights ON",
      "tags": [],
      "visibility": "VISIBLE"
    }
  },
  "1d75bf81-a51f-422c-b2ab-41ed4e9c8c7e": {
    "class": "org.eclipse.smarthome.automation.Rule",
    "value": {
      "triggers": [
        {
          "id": "1",
          "label": "it is a fixed time of day",
          "description": "Triggers at a specified time",
          "configuration": {
            "properties": {
              "time": "21:00"
            }
          },
          "type": "timer.TimeOfDayTrigger"
        }
      ],
      "conditions": [],
      "actions": [
        {
          "id": "2",
          "label": "send a command",
          "description": "Sends a command to a specified item.",
          "configuration": {
            "properties": {
              "itemName": "zwave_device_bd10a0f8_node7_switch_binary",
              "command": "ON"
            }
          },
          "type": "core.ItemCommandAction"
        },
        {
          "id": "3",
          "label": "send a command",
          "description": "Sends a command to a specified item.",
          "configuration": {
            "properties": {
              "itemName": "zwave_device_bd10a0f8_node15_switch_binary",
              "command": "OFF"
            }
          },
          "type": "core.ItemCommandAction"
        }
      ],
      "configuration": {
        "properties": {}
      },
      "configDescriptions": [],
      "uid": "1d75bf81-a51f-422c-b2ab-41ed4e9c8c7e",
      "name": "PNUT Night Light ON",
      "tags": [],
      "visibility": "VISIBLE"
    }
  },
  "46df60c6-3343-40f5-a78e-97094f877f65": {
    "class": "org.eclipse.smarthome.automation.Rule",
    "value": {
      "triggers": [
        {
          "id": "1",
          "label": "it is a fixed time of day",
          "description": "Triggers at a specified time",
          "configuration": {
            "properties": {
              "time": "07:30"
            }
          },
          "type": "timer.TimeOfDayTrigger"
        }
      ],
      "conditions": [
        {
          "id": "2",
          "label": "it is a certain day of the week",
          "description": "checks for the current day of the week",
          "configuration": {
            "properties": {
              "days": [
                "MON",
                "TUE",
                "WED",
                "THU",
                "FRI"
              ]
            }
          },
          "type": "timer.DayOfWeekCondition"
        }
      ],
      "actions": [
        {
          "id": "3",
          "label": "send a command",
          "description": "Sends a command to a specified item.",
          "configuration": {
            "properties": {
              "itemName": "zwave_device_bd10a0f8_node15_switch_binary",
              "command": "OFF"
            }
          },
          "type": "core.ItemCommandAction"
        }
      ],
      "configuration": {
        "properties": {}
      },
      "configDescriptions": [],
      "uid": "46df60c6-3343-40f5-a78e-97094f877f65",
      "name": "PNUT ROOM LIGHT OFF (SCHOOL DAYS)",
      "tags": [],
      "visibility": "VISIBLE"
    }
  }
}

I was hoping that since the Xtend modules/libraries were showing up in karaf that I would still be able to use HABmin style rules. Seems like tons of how-to’s are showing using .rules files with Openhab2, but I just don’t see anyone talking about how these are picked up and executed. The rule file was generated by HABmin and I don’t think it has syntax errors. Setting logging level to DEBUG produced no error events.

// This rule file is autogenerated by HABmin.
// Any changes made manually to this file will be overwritten next time HABmin rules are saved.

// Imports
import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*

// Global Variables
var boolean Pulsing = false
var Timer _timer_001_A = null
var Timer _timer_001_B = null

// Constants used to generate this rule
// TempHIGH == 18.8
// TempLOW == 18.7

rule "Office Fan"
when
    Item zwave_device_bd10a0f8_node6_sensor_temperature changed
    or
    Item zwave_device_bd10a0f8_node18_switch_binary changed
then
  if ((zwave_device_bd10a0f8_node6_sensor_temperature.state >= 18.8)) {
    Pulsing = false

    postUpdate(zwave_device_bd10a0f8_node18_switch_binary, ON)
  }
  else if (((Pulsing == false) && (zwave_device_bd10a0f8_node6_sensor_temperature.state <= 18.7))) {
    postUpdate(zwave_device_bd10a0f8_node18_switch_binary, OFF)
  }

  if ((zwave_device_bd10a0f8_node18_switch_binary.state == OFF)) {
    if (_timer_001_A == null) {
      _timer_001_A = createTimer(now.plusHours(3)) [|
        _timer_001_A.cancel()
        _timer_001_A = null
        Pulsing = true

        postUpdate(zwave_device_bd10a0f8_node18_switch_binary, ON)
      ]
    }
  }
  else if(_timer_001_A != null) {
    _timer_001_A.cancel()
    _timer_001_A = null
  }

  if (((zwave_device_bd10a0f8_node18_switch_binary.state == ON) && (Pulsing == true))) {
    if (_timer_001_B == null) {
      _timer_001_B = createTimer(now.plusMinutes(10)) [|
        _timer_001_B.cancel()
        _timer_001_B = null
        Pulsing = false

        postUpdate(zwave_device_bd10a0f8_node18_switch_binary, OFF)
      ]
    }
  }
  else if(_timer_001_B != null) {
    _timer_001_B.cancel()
    _timer_001_B = null
  }
end

No, that is the correct location.

Like I said before, the two are completely separate. They have nothing to do with each other. You will not find anything associated with .rules files in jsondb and vice versa.

That’s because there is nothing to say. Save a file to that location with a .rules extension and OH will immediately read and attempt to parse it and use it.

You don’t need to set the logging level to DEBUG. But you do have to find the lines where OH tried to load the file and most likely failed which happened immediately after the file was saved to disk. You can force a reload by touching the file.

I can already see that Habmin has not kept up with changes to the Rules Engine and because of this do not recommend using it. For one, none of those imports are needed anymore, and even if they were, none of the classes that it is attempting to import are in those locations any longer.

I’m almost certain there is a syntax error in the code somewhere. Force a reload while watching openhab.log. You should see something along the lines of “Refreshing model ‘(1)_office_fan.rules’” followed by the first syntax error it sees.

One thing that does stand out is that does not look like a valid file name. It may not be able to handle the (1) in the name. Did you add that or was it added automatically by Habmin? If you added that, remove it. If it was added automatically, then that is another good reason not to use the Rules editor in Habmin right now. If you touch that file and you see nothing in openhab.log about it trying to load the model you know that the (1) is a problem.

Hrmm, ok so I saw the imports warning tossed previously and thought that this was just a warning but wouldn’t impact the import of the rule. I also saw the null value comparison warnings.
The (1) was prepended to the filename by HABmin. I copied the file to “test.rules” and also updated the internal script name to “test”.

2018-03-13 18:55:35.578 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'test.rules'
2018-03-13 18:55:37.121 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'test.rules', using it anyway:
The use of wildcard imports is deprecated.
The use of wildcard imports is deprecated.
The use of wildcard imports is deprecated.
The operator '==' should be replaced by '===' when null is one of the arguments.
The operator '!=' should be replaced by '!==' when null is one of the arguments.
The operator '==' should be replaced by '===' when null is one of the arguments.
The operator '!=' should be replaced by '!==' when null is one of the arguments.

I fixed all of those and here is openhab.log entries:

2018-03-13 18:58:01.428 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'test.rules'
2018-03-13 18:58:02.898 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'test.rules'

No more rule warnings, but I still do not see a rule listed in Karaf, only the rules that were defined in paperUI.
Is it possible I am missing something related to my rules modules/configuration?

openhab> config:list | grep rule
   rules = rules
   defaultHLI = rulehli
   misc = restdocs,ruleengine
   feature.esh-automation-module-script-rulesupport/0.10.0.SNAPSHOT = esh-automation-module-script-rulesupport/0.10.0.SNAPSHOT
   feature.esh-model-rule-ide/0.10.0.SNAPSHOT = esh-model-rule-ide/0.10.0.SNAPSHOT
   feature.esh-model-rule-runtime/0.10.0.SNAPSHOT = esh-model-rule-runtime/0.10.0.SNAPSHOT
   feature.esh-model-rule/0.10.0.SNAPSHOT = esh-model-rule/0.10.0.SNAPSHOT
   feature.openhab-misc-ruleengine/2.3.0.SNAPSHOT = openhab-misc-ruleengine/2.3.0.SNAPSHOT

Should I be using a different karaf command to list the rules that are running?

openhab> smarthome:automation listRules
----------------------------------------------------------------------------------------------------
ID     UID                                 NAME                                STATUS
----------------------------------------------------------------------------------------------------
1      0df4c68f-1634-4858-a10a-c6ec784ee31d PNUT Night Lite OFF                 IDLE
2      1d75bf81-a51f-422c-b2ab-41ed4e9c8c7e PNUT Night Light ON                 IDLE
3      46df60c6-3343-40f5-a78e-97094f877f65 PNUT ROOM LIGHT OFF (SCHOOL DAYS)   IDLE
4      695d0f0c-d7c9-491b-8dfa-143632af2891 X-MAS Lights ON Outside             IDLE
5      73ab5aa5-ee41-43e5-857f-945f61bdaadc LVRM LAMP OFF (SLEEP)               IDLE
6      74aa25ef-03ea-495c-8247-8a7c0b5fe8c7 PNUT ROOM LIGHT ON (SCHOOL DAYS)    IDLE
7      acdf5eec-ebb8-4e2a-a901-6ae2c17e9342 X-MAS Lights OFF Outside            IDLE
8      d2bed2bf-57e5-4489-8295-3f8cf3949882 MBRM Night Lights ON                IDLE
9      f6c8b229-28e0-4780-88e1-441049208c14 MBRM Night Lights OFF               IDLE
10     ffa4238e-b4ef-4526-bdb1-fbb589ece9bb LVRM LAMP ON (DAY/EVENING)          IDLE
----------------------------------------------------------------------------------------------------

openhab> smarthome:automation importRules -st /etc/openhab2/rules/test.rules
FAIL : org.eclipse.smarthome.automation.parser.gson.internal.RuleGSONParser.parse(RuleGSONParser.java:55)
org.eclipse.smarthome.automation.internal.commands.CommandlineRuleImporter.importData(CommandlineRuleImporter.java:113)
org.eclipse.smarthome.automation.internal.commands.CommandlineRuleImporter.importRules(CommandlineRuleImporter.java:100)
org.eclipse.smarthome.automation.internal.commands.AutomationCommands.importRules(AutomationCommands.java:469)
org.eclipse.smarthome.automation.internal.commands.AutomationCommandImport.execute(AutomationCommandImport.java:81)
org.eclipse.smarthome.automation.internal.commands.AutomationCommands.executeCommand(AutomationCommands.java:511)
org.eclipse.smarthome.automation.internal.commands.AutomationCommandsPluggable.execute(AutomationCommandsPluggable.java:159)
org.eclipse.smarthome.io.console.ConsoleInterpreter.execute(ConsoleInterpreter.java:56)
org.eclipse.smarthome.io.console.karaf.internal.CommandWrapper.execute(CommandWrapper.java:79)
org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68)
org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86)
org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:571)
org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:497)
org.apache.felix.gogo.runtime.Closure.execute(Closure.java:386)
org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:417)
org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229)
org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59)
java.util.concurrent.FutureTask.run(FutureTask.java:266)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)


I think that is what you should expect. The file.rules and experimental PaperUI rules are completely separate systems.

I’ll say it again. The two are completely separate. YOU WILL NOT SEE .rules RULES IN KARAF.

Your rule is loaded. Assuming the triggers are right the rule is running and will respond to the defined triggers.

Okay, I will experiment with a simpler rule then and see what happens. Perhaps add some logging within the rule which seems to be an option for debugging.

I think this openhab2 system could use an updated block level diagram/flowchart or something. What I had seen previously showed addons flowed into core, which were built on top of equinox/karaf. As a result, I was under the impression all configuration details were visible in karaf.

I have been banging my head into the wall, thanks for turning me around or at least 90 degrees.

I had created rules using Paper UI and they were working fine until I created a manual rule any placed it under openhab_config/rules folder.

With this action, all my rules created using Paper UI just disappeared and I could not bring them back, though I had removed manualy created .rules file.

I have to recreate the rules using Paper UI to bring them back.

Any idea what might had gone wrong that I lose rules created using paper UI.
Can the rules created using Paper UI and manually created co-exist?

Thanks.

Rules in the .rules folder are completely independent from the Rules created through PaperUI. There is no reason that your PaperUI Rules should have been removed and the two can run side by side without problem. Without logs and whole lot of testing we’ll never know why the Rules disappeared.

There should be a backup of your Rules in /var/lib/openhab2/jsondb/backups so you don’t have to recreate them. Every time you make a change a new backup is created so just pick the backup from just before they all disappeared. Though there are only so many backups. If you’ve been recreating the rules, you likely lost those backups by now.

Thanks for this info. I shall check the backup folder to get back the rules and log file for issue, admitting i am not expert.