From f93e685b56191aa964b9c65e0669a2bc34c6914c Mon Sep 17 00:00:00 2001 From: Wouter Born Date: Sat, 1 Jun 2019 12:12:19 +0200 Subject: [PATCH] Update repository for openHAB fork of Eclipse SmartHome (#11) * Because Eclipse SmartHome (ESH) continues as openHAB Core all references to ESH have been updated for this change: * File renames: * smarthome-grafana.js -> openhab-grafana.js * smarthome-grafana-user-defaults.js -> openhab-grafana-user-defaults.js * Code changes: * SmartHomeSubscriber -> OHSubscriber * SMARTHOME_GRAFANA_DEFAULTS -> OHG_DEFAULTS * The project itself has also been renamed from smarthome-grafana to openhab-grafana * The README.md has been updated to allow for easier code diffs by starting each sentence on a new line * Since this is a major change the version is update from 0.1.0 to 1.0.0. The code before all these changes is available in the 0.1.0 release, see: https://github.com/wborn/openhab-grafana/releases/tag/0.1.0 Signed-off-by: Wouter Born --- Gruntfile.js | 10 +- README.md | 149 +++++++++++------- example/html/demo-combo1.html | 4 +- example/html/demo-combo2.html | 4 +- example/html/demo-multi1.html | 4 +- example/html/demo.html | 4 +- example/html/openhab-grafana-user-defaults.js | 13 ++ example/html/openhab-grafana.js | 1 + .../html/smarthome-grafana-user-defaults.js | 13 -- example/html/smarthome-grafana.js | 1 - package.json | 6 +- ...marthome-grafana.js => openhab-grafana.js} | 28 ++-- web/openhab-grafana.js | 1 + web/smarthome-grafana.js | 1 - 14 files changed, 138 insertions(+), 101 deletions(-) create mode 100644 example/html/openhab-grafana-user-defaults.js create mode 100644 example/html/openhab-grafana.js delete mode 100644 example/html/smarthome-grafana-user-defaults.js delete mode 100644 example/html/smarthome-grafana.js rename web-src/{smarthome-grafana.js => openhab-grafana.js} (95%) create mode 100644 web/openhab-grafana.js delete mode 100644 web/smarthome-grafana.js diff --git a/Gruntfile.js b/Gruntfile.js index 91e4a64..dea6165 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -10,8 +10,8 @@ module.exports = function(grunt) { clean: { all: [ - "example/html/smarthome-grafana.js", - "web/smarthome-grafana.js", + "example/html/openhab-grafana.js", + "web/openhab-grafana.js", ] }, @@ -19,14 +19,14 @@ module.exports = function(grunt) { options: { configFile: "eslint.json" }, - target: ["web-src/smarthome-grafana.js"] + target: ["web-src/openhab-grafana.js"] }, uglify: { all: { files: { - "example/html/smarthome-grafana.js": ["web-src/smarthome-grafana.js"], - "web/smarthome-grafana.js": ["web-src/smarthome-grafana.js"] + "example/html/openhab-grafana.js": ["web-src/openhab-grafana.js"], + "web/openhab-grafana.js": ["web-src/openhab-grafana.js"] } } } diff --git a/README.md b/README.md index 9c5a7ec..c0fb3ce 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,48 @@ -# smarthome-grafana +# openhab-grafana -This project provides a JavaScript library with examples to simplify embedding [Grafana](https://grafana.net) panels in [Eclipse SmartHome](http://www.eclipse.org/smarthome) (ESH) and its derivatives like [openHAB 2](http://www.openhab.org) (OH2). +This project provides a JavaScript library with examples to simplify embedding [Grafana](https://grafana.net) panels in [openHAB 2](http://www.openhab.org) (OH) and its derivatives. The library provides the following functionality: -* Generation of Grafana embedded panel URL parameters based on the state of ESH items (using REST and subscribing to [Server-sent events (SSE)](https://en.wikipedia.org/wiki/Server-sent_events)) +* Generation of Grafana embedded panel URL parameters based on the state of OH items (using REST and subscribing to [Server-sent events (SSE)](https://en.wikipedia.org/wiki/Server-sent_events)) * Smart parameter resolution (more on that later) * Debug mode for debugging URL generation -This functionality solves the issue of having to create a `Webview` with a `visibility=[..]` configuration for user customizable Grafana panel parameters. The resulting sitemaps have less duplication and page load times decrease because a only single `Webview` has to be loaded. +This functionality solves the issue of having to create a `Webview` with a `visibility=[..]` configuration for user customizable Grafana panel parameters. +The resulting sitemaps have less duplication and page load times decrease because a only single `Webview` has to be loaded. ## Requirements -* Eclipse SmartHome (ESH) installation, e.g. follow: http://docs.openhab.org/installation/index.html +* openHAB (OH) installation, e.g. follow: https://www.openhab.org/docs/installation/ * Grafana installation/configuration, e.g. follow: https://community.openhab.org/t/influxdb-grafana-persistence-and-graphing/13761 -* **ESH and Grafana accessible via the same host/port to prevent [Same-origin policy](https://en.wikipedia.org/wiki/Same-origin_policy) violations.** E.g. setup a reverse proxy using the [configuration examples](#reverse-proxy-configuration) below. +* **OH and Grafana accessible via the same host/port to prevent [Same-origin policy](https://en.wikipedia.org/wiki/Same-origin_policy) violations.** E.g. setup a reverse proxy using the [configuration examples](#reverse-proxy-configuration) below. ## Library objects, their parameters and how they are resolved The library consists of two kinds of objects: -* `SmartHomeSubscriber`: resolves initial ESH item values and listens for item value changes -* `GrafanaPanel`: keeps track of the properties of a Grafana panel properties, the enclosing `