Catching CloudClient events

Is there a way of setting up a rule (or other trap) to catch events generated by the CloudClient?

I would like to trigger rules based on the events.

log example below, where it disconnected and reconnected.

2021-01-05 16:05:06.673 [ERROR] [io.openhabcloud.internal.CloudClient] - Error connecting to the openHAB Cloud instance

2021-01-05 16:05:06.678 [INFO ] [io.openhabcloud.internal.CloudClient] - Disconnected from the openHAB Cloud service (UUID = x, base URL = http://localhost:8080)

2021-01-05 16:05:08.031 [INFO ] [io.openhabcloud.internal.CloudClient] - Connected to the openHAB Cloud service (UUID = x, base URL = http://localhost:8080)

Jim

You could

  • do fgrep on the log file
  • trigger this by running e.g. crontab of the system
  • extract fields with regular expression / cut command
  • store the extracted values in an item using the REST API

In case you are only interested in changes of ONLINE, OFFLINE status you may login to the cloud and extract the OFFLINE/ONLINE string

In addition to the aforementioned hints you could use the Log Reader Binding:

grafik

1 Like

That binding looks exactly what I’m after, thanks :+1: