From ca15b3dddd74379c4c9cb446bde586dab2cdfa9c Mon Sep 17 00:00:00 2001 From: Florian Hotze Date: Sun, 19 Jun 2022 13:42:42 +0200 Subject: [PATCH] Update openhab-js tern defs for https://github.com/openhab/openhab-js/pull/132 This adds the `things` namespace with the `Thing` class and the Thing getter methods. Signed-off-by: Florian Hotze --- .../web/src/assets/openhab-js-tern-defs.json | 66 ++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/bundles/org.openhab.ui/web/src/assets/openhab-js-tern-defs.json b/bundles/org.openhab.ui/web/src/assets/openhab-js-tern-defs.json index 3bac44011d..d52a2253bb 100644 --- a/bundles/org.openhab.ui/web/src/assets/openhab-js-tern-defs.json +++ b/bundles/org.openhab.ui/web/src/assets/openhab-js-tern-defs.json @@ -214,9 +214,69 @@ }, "safeItemName": { "!doc": "Helper function to ensure an item name is valid. All invalid characters are replaced with an underscore.", - "!type": "fn(s: ?)" + "!type": "fn(s: string) -> string" } }, + "Thing": { + "bridgeUID": { + "!doc": "UID of Thing's bridge.", + "!type": "string" + }, + "label": { + "!doc": "Label of the Thing.", + "!type": "string" + }, + "location": { + "!doc": "Physical location of the Thing.", + "!type": "string" + }, + "status": { + "!doc": "Thing status (e.g. ONLINE or OFFLINE).", + "!type": "string" + }, + "statusInfo": { + "!doc": "More detailed status of Thing.", + "!type": "string" + }, + "thingTypeUID": { + "!doc": "UID of Thing's type.", + "!type": "string" + }, + "uid": { + "!doc": "UID of Thing.", + "!type": "string" + }, + "isEnabled": { + "!doc": "Whether the thing is enabled or not.", + "!type": "boolean" + }, + "setLabel": { + "!doc": "Set the Thing label.", + "!type": "fn(label: string)" + }, + "setLocation": { + "!doc": "Set the physical location of the Thing.", + "!type": "fn(location: string)" + }, + "setProperty": { + "!doc": "Set the value of a property of the Thing.", + "!type": "fn(name: string, value: string)" + }, + "setEnabled": { + "!doc": "Enable or disable the Thing.", + "!type": "fn(enabled: boolean)" + } + }, + "ThingsNamespace": { + "getThing": { + "!doc": "Get a single Thing from openHAB.", + "!type": "fn(uid: string, nullIfMissing?: boolean) -> Thing" + }, + "getThings": { + "!doc": "Get all Things", + "!type": "fn() -> [Thing]" + } + }, "CacheNamespace": { "get": { "!doc": "Returns the value to which the specified key is mapped", @@ -479,6 +539,10 @@ "!doc": "Items namespace. This namespace handles querying and updating openHAB Items.", "!type": "ItemsNamespace" }, + "things": { + "!doc": "Things namespace. This namespace handles querying and updating openHAB Things.", + "!type": "ThingsNamespace" + }, "cache": { "!doc": "Shared cache namespace. This namespace provides a default cache that can be use to set and retrieve objects that will be persisted between reloads of scripts.", "!type": "CacheNamespace"