Next-Generation-Rules - UNINTIALIZED - HANDLER_INITIALIAZING_ERROR - Ephemeris

Tags: #<Tag:0x00007f616e5e7190> #<Tag:0x00007f616e5e70a0> #<Tag:0x00007f616e5e6ee8>

Hi there,

I have a problem with the Experimental Rules in the PaperUI.
I use Openhab 2.5.9 as a docker container.

Docker-Compose file
version: '3.3'

services:
   openhab2:
     image: openhab/openhab:2.5.9
     ports:
      - "20070:8080"
      - "5007:5007"
     volumes: 
      - /etc/localtime:/etc/localtime
      - /etc/timezone:/etc/timezone
      - /etc/openhab/conf:/openhab/conf
      - /etc/openhab/userdata:/openhab/userdata
      - /etc/openhab/addons:/openhab/addons
     environment:
      - USER_ID=997
      - GROUP_ID=996
      - EXTRA_JAVA_OPTS=-Duser.timezone=Europe/Berlin
      - OPENHAB_HTTP_PORT=8080
      - OPENHAB_HTTPS_PORT=8443
     labels:
      - "traefik.docker.network=web"
      - "traefik.http.routers.openhab.rule=Host(`some.dns.name`)"
      - "traefik.http.routers.openhab.tls=true"
      - "traefik.http.routers.openhab.tls.certresolver=leresolver"
      - "traefik.http.routers.openhab.entrypoints=websecure"
      - "traefik.http.services.openhab.loadbalancer.server.port=8080"
      - "traefik.http.routers.openhab.middlewares=authopenhab"
      - "traefik.http.middlewares.authopenhab.basicauth.users=username:password"
      - "traefik.http.middlewares.authopenhab.basicauth.removeheader=true"
     depends_on:
      - influxdb
      - grafana
     restart: always
     networks:
      - web
      - internal

   influxdb:
    image: influxdb:latest
    ports:
      - "8086:8086"
    volumes:
    - influxdb_storage:/var/lib/influxdb
    depends_on:
      - grafana
    restart: always
    labels:
       - traefik.enable=false
    networks:
      - internal

   grafana:
    image: grafana/grafana
    #ports:
            #  - 3000
    labels:
      - "traefik.docker.network=web"
      - "traefik.http.routers.grafana.rule=Host(`some.dns.name`)"
      - "traefik.http.routers.grafana.tls=true"
      - "traefik.http.routers.grafana.tls.certresolver=leresolver"
      - "traefik.http.routers.grafana.entrypoints=websecure"
      - "traefik.http.services.grafana.loadbalancer.server.port=3000"
    volumes:
      - grafana_storage:/var/lib/grafana
    restart: always
    networks:
      - web
      - internal

volumes:
  influxdb_storage: {}
  grafana_storage: {}

networks:
  web:
    external: true
  internal:
    external: false

When I add “It is a weekend” the rule is “UNINITIALIZED - HANDLER_INITIALIZING_ERROR”. The same problem occours when I use “It is a weekday”.

Screenshot from the rule:

Screenshot from the error:

In the events.log I found this error message:

2020-10-17 17:56:36.959 [.event.RuleStatusInfoEvent] - 1098bff6-ad2c-4812-8528-038b64ad87a0 updated: UNINITIALIZED (HANDLER_INITIALIZING_ERROR): Getting handler 'ephemeris.WeekendCondition' for module '3' failed: Config parameter 'offset' is missing in the configuration of module '3'.

After this I changed the offset in the rule from nothing to “0”. But the error occours again.
Then I took a look at the “automation_rules.json”.
The offset is set to “0” in the .json file.

automation_rules.json
"1098bff6-ad2c-4812-8528-038b64ad87a0": {
    "class": "org.openhab.core.automation.dto.RuleDTO",
    "value": {
      "triggers": [
        {
          "id": "1",
          "label": "it is a fixed time of day",
          "description": "Triggers at a specified time",
          "configuration": {
            "time": "16:35"
          },
          "type": "timer.TimeOfDayTrigger"
        }
      ],
      "conditions": [
        {
          "inputs": {},
          "id": "3",
          "label": "It is a weekend",
          "description": "Checks if the current day is on the weekend.",
          "configuration": {
            "offset": 0.0
          },
          "type": "ephemeris.WeekendCondition"
        }
      ],
      "actions": [
        {
          "inputs": {},
          "id": "2",
          "label": "send a command",
          "description": "Sends a command to a specified item.",
          "configuration": {
            "itemName": "Hue_Switch_Ankleidezimmer",
            "command": "ON"
          },
          "type": "core.ItemCommandAction"
        }
      ],
      "configuration": {},
      "configDescriptions": [],
      "uid": "1098bff6-ad2c-4812-8528-038b64ad87a0",
      "name": "Test",
      "tags": [],
      "visibility": "VISIBLE"
    }
  }

I know that the condition “It is a weekend” uses ephemeris.
I added in the service folder the file “ephemeris.cfg” and add the following parameters:

city=WĂĽrzburg
country=de
dayset-workday=[MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY]
dayset-weekend=[SATURDAY,SUNDAY]
region=by

But the error occours again and again.

Does someone has an idea to fix this?

Thanks a lot.

Sebastian

Spaces in rules are important but the forum eats spaces by default. Please use code fences.

How to use code fences - Tutorials & Examples - openHAB Community

Hi,

sorry for that.
I just fixed it.

1 Like

Should that be "type": "ephemeris.isWeekend" ?

I don´t know if it should be "type": "ephemeris.isWeekend".
I created the rule in the PaperUI and the system itselfs created the rule in the .json file.
When I change it in the “automation_rules.json” the rule through still the error “UNINITIALIZED - HANDLER_INITIALIZING_ERROR”.

That was just a guess from quickly looking at the documentation. I do not use ephemeris. @rlkoshak is the expert here.

The short answer is I don’t think that rule trigger works in PaperUI. In large part PaperUI’s rules editor is pretty broken and I wouldn’t recommend using it. Of if you do use it, you will probably need to avoid the time based rule triggers.

These all appear to be working in OH 3 though.

Also, make sure you’ve configured Ephemeris. It won’t work if that hasn’t been configured even outside of PaperUI. You can configure it in the Configuration -> System menu in PaperUI or see the Actions documentation page for the full documentation for how to configure it.

1 Like