diff --git a/manifest.json b/manifest.json index 20ee609..adab036 100644 --- a/manifest.json +++ b/manifest.json @@ -39,7 +39,7 @@ "Icon": "resources/img/hubitat_logo", "URL": "https://github.com/ripnet/streamdeck-hubitat", "PropertyInspectorPath": "pi/hubitat_pi.html", - "Version": "1.4", + "Version": "1.5", "Category": "Hubitat", "CategoryIcon": "resources/img/category", "OS": [ diff --git a/pi/hubitat_pi.html b/pi/hubitat_pi.html index 4c744cd..f964d3d 100644 --- a/pi/hubitat_pi.html +++ b/pi/hubitat_pi.html @@ -10,9 +10,12 @@
Global
-
Hostname
+
API URL
+
+ Example: http://192.168.1.2/apps/api/229 +
Access Token
@@ -119,7 +122,7 @@ function getDevices() { - $.get("http://" + globalSettings.hostname + "/apps/api/229/devices/all?access_token=" + globalSettings.access_token, function(data) { + $.get(globalSettings.hostname + "/devices/all?access_token=" + globalSettings.access_token, function(data) { devices = []; data.forEach(function(device) { if (device.capabilities.includes("Switch")) { diff --git a/plugin/index.html b/plugin/index.html index e358910..ef8d774 100755 --- a/plugin/index.html +++ b/plugin/index.html @@ -37,7 +37,8 @@ const hubitat = { start: function() { - hubitatWebsocket = new WebSocket("ws://" + globalSettings.hostname + "/eventsocket"); + let url = new URL(globalSettings.hostname) + hubitatWebsocket = new WebSocket("ws://" + url.hostname + "/eventsocket"); hubitatWebsocket.onopen = function() { } @@ -66,7 +67,7 @@ globalSettings.hasOwnProperty('access_token') ) { const id = instances[context].settings.device; - $.get("http://" + globalSettings.hostname + "/apps/api/229/devices/" + id + "?access_token=" + globalSettings.access_token, function (data) { + $.get(globalSettings.hostname + "/devices/" + id + "?access_token=" + globalSettings.access_token, function (data) { data.attributes.forEach(function (a) { if (a.name === "switch") { @@ -86,7 +87,7 @@ globalSettings.hasOwnProperty('access_token') ) { const id = instances[context].settings.device; - $.get("http://" + globalSettings.hostname + "/apps/api/229/devices/" + id + "/" + state + "?access_token=" + globalSettings.access_token, function (data) { + $.get(globalSettings.hostname + "/devices/" + id + "/" + state + "?access_token=" + globalSettings.access_token, function (data) { instances[context].state = state; updateState(context); });