From 9c537fb926f065809f46972e150b19a181f1b447 Mon Sep 17 00:00:00 2001 From: Andrea Pierangeli Date: Wed, 7 Feb 2024 18:09:48 +0100 Subject: [PATCH] Add OpenHAB custom service --- docs/customservices.md | 17 ++++ dummy-data/openHAB/rest/systeminfo | 18 ++++ src/components/services/OpenHAB.vue | 144 ++++++++++++++++++++++++++++ 3 files changed, 179 insertions(+) create mode 100644 dummy-data/openHAB/rest/systeminfo create mode 100644 src/components/services/OpenHAB.vue diff --git a/docs/customservices.md b/docs/customservices.md index 910f401..64ed416 100644 --- a/docs/customservices.md +++ b/docs/customservices.md @@ -35,6 +35,7 @@ within Homer: - [Tdarr](#tdarr) - [PiAlert](#pialert) - [Immich](#immich) + - [OpenHAB](#openhab) If you experiencing any issue, please have a look to the [troubleshooting](troubleshooting.md) page. @@ -446,3 +447,19 @@ The Immich server must be running at least version 1.85.0 for the correct api en apikey: "<--- Your api key --->" # administrator user updateInterval: 5000 # (Optional) Interval (in ms) for updating the stats ``` + +## OpenHAB + +You need to set the type to OpenHAB, provide an api key and enable cors on OpenHAB. + +```yaml +- name: "OpenHAB" + logo: "assets/tools/sample.png" + url: "http://192.168.0.151/" + type: "OpenHAB" + apikey: "<---insert-api-key-here--->" + things: true # true will query the things API and report total and online things count. false will skip the call + items: true # true will query the items API and report total items count. false will skip the call +``` +To create an API token on OpenHAB, follow the [official documentation here](https://www.openhab.org/docs/configuration/apitokens.html). +To enable cors on OpenHAB, edit your services/runtime.cfg and uncomment or add this line: `org.openhab.cors:enable=true` \ No newline at end of file diff --git a/dummy-data/openHAB/rest/systeminfo b/dummy-data/openHAB/rest/systeminfo new file mode 100644 index 0000000..e692cea --- /dev/null +++ b/dummy-data/openHAB/rest/systeminfo @@ -0,0 +1,18 @@ +{ + "systemInfo": { + "configFolder": "/etc/openhab", + "userdataFolder": "/var/lib/openhab", + "logFolder": "/var/log/openhab", + "javaVersion": "17.0.9", + "javaVendor": "Azul Systems, Inc.", + "javaVendorVersion": "Zulu17.46+19-CA", + "osName": "Linux", + "osVersion": "6.5.11-4-pve", + "osArchitecture": "amd64", + "availableProcessors": 2, + "freeMemory": 75885968, + "totalMemory": 494927872, + "uptime": 2150186, + "startLevel": 100 + } +} \ No newline at end of file diff --git a/src/components/services/OpenHAB.vue b/src/components/services/OpenHAB.vue new file mode 100644 index 0000000..03b50b2 --- /dev/null +++ b/src/components/services/OpenHAB.vue @@ -0,0 +1,144 @@ + + + + + -- 2.41.0