From bf46427ba7b9e3d8d31adb46510be23e2363ec78 Mon Sep 17 00:00:00 2001 From: mattreim <80219712+mattreim@users.noreply.github.com> Date: Wed, 31 Jan 2024 00:06:42 +0100 Subject: [PATCH 01/11] Small fixes.js --- main.js | 56 ++++++++++++++++---------------------------------------- 1 file changed, 16 insertions(+), 40 deletions(-) diff --git a/main.js b/main.js index b800a87..cdd4396 100755 --- a/main.js +++ b/main.js @@ -93,12 +93,9 @@ class deconz extends utils.Adapter { let parameters = {}; let action = ""; let method = ""; - let transitionTime = - err === null && tTime !== null ? tTime.val * 10 : "none"; + let transitionTime = err === null && tTime !== null ? tTime.val * 10 : "none"; - let obj = await this.getObjectAsync( - this.name + "." + this.instance + "." + id - ); + let obj = await this.getObjectAsync(this.name + "." + this.instance + "." + id); if (obj === null) return false; switch (dp) { @@ -213,12 +210,8 @@ class deconz extends utils.Adapter { state.val === "carnival" || state.val === "glow" ) { - let effectspeed = await this.getStateAsync( - this.name + "." + this.instance + "." + id + ".effectspeed" - ); - const effectcolours = await this.getStateAsync( - this.name + "." + this.instance + "." + id + ".effectcolours" - ); + let effectspeed = await this.getStateAsync(this.name + "." + this.instance + "." + id + ".effectspeed"); + const effectcolours = await this.getStateAsync(this.name + "." + this.instance + "." + id + ".effectcolours"); if (effectspeed !== null) { effectspeed = effectspeed.val; } else { @@ -235,9 +228,6 @@ class deconz extends utils.Adapter { parameters = '{"effect": ' + JSON.stringify(state.val) + "}"; } break; - case "colormode": - parameters = `{ "${dp}": "${state.val}" }`; - break; case "dimup": case "dimdown": oid; @@ -245,17 +235,10 @@ class deconz extends utils.Adapter { this.name + "." + this.instance + "." + id + ".dimspeed" ); - if ( - dimspeed === null || - dimspeed === undefined || - dimspeed.val === 0 - ) { + if (dimspeed === null || dimspeed === undefined || dimspeed.val === 0) + { dimspeed = 10; - this.setState( - this.name + "." + this.instance + "." + id + ".dimspeed", - 10, - true - ); + this.setState(this.name + "." + this.instance + "." + id + ".dimspeed", 10, true); } let speed = dp === "dimup" ? dimspeed.val : dimspeed.val * -1; if (transitionTime !== "none") { @@ -265,11 +248,8 @@ class deconz extends utils.Adapter { } break; case "action": - if ( - state.val === null || - state.val === undefined || - state.val === 0 - ) { + if (state.val === null || state.val === undefined || state.val === 0) + { return; } parameters = `{ ${state.val} }`; @@ -284,9 +264,7 @@ class deconz extends utils.Adapter { break; case "delete": method = "DELETE"; - await this.delObjectAsync( - this.name + "." + this.instance + "." + id - ); + await this.delObjectAsync(this.name + "." + this.instance + "." + id); break; case "store": action = "store"; @@ -306,7 +284,7 @@ class deconz extends utils.Adapter { }, }); break; - //boolean + //boolean&number case "boost": case "delay": case "displayflipped": @@ -327,6 +305,7 @@ class deconz extends utils.Adapter { break; //string case "airquality": + case "colormode": case "clickmode": case "devicemode": case "errorcode": @@ -363,8 +342,7 @@ class deconz extends utils.Adapter { parameters = JSON.stringify(parameters); } - let controlId = - obj !== null || obj !== undefined ? obj.native.id : ""; + let controlId = obj !== null || obj !== undefined ? obj.native.id : ""; switch (obj.common.role) { case "blind": @@ -2800,9 +2778,6 @@ async function SetObjectAndState(id, name, type, stateName, value) { objRole = "state"; break; case "on": - objType = "boolean"; - objRole = "switch"; - break; case "off": objType = "boolean"; objRole = "switch"; @@ -2887,6 +2862,7 @@ async function SetObjectAndState(id, name, type, stateName, value) { case "sensitivitymax": objType = "number"; objRole = "state"; + objWrite = false; objDefault = 0; break; case "speed": @@ -2955,8 +2931,8 @@ async function SetObjectAndState(id, name, type, stateName, value) { case "tholddark": objType = "number"; objRole = "value"; - objDefault = 0; objWrite = false; + objDefault = 0; break; case "tholdoffset": objType = "number"; @@ -2978,8 +2954,8 @@ async function SetObjectAndState(id, name, type, stateName, value) { case "transitiontime": objType = "number"; objRole = "state"; - objUnit = "s"; objDefault = 0; + objUnit = "s"; break; case "usertest": objType = "boolean"; From 0344620ddb3320ec4cba7dd861e89910453775db Mon Sep 17 00:00:00 2001 From: mattreim <80219712+mattreim@users.noreply.github.com> Date: Thu, 1 Feb 2024 01:20:32 +0100 Subject: [PATCH 02/11] Add more sensor attributes from deConz REST-API --- main.js | 173 ++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 143 insertions(+), 30 deletions(-) diff --git a/main.js b/main.js index cdd4396..4085e8b 100755 --- a/main.js +++ b/main.js @@ -289,30 +289,34 @@ class deconz extends utils.Adapter { case "delay": case "displayflipped": case "duration": - case "externalwindowopen": + case "externalwindowopen": + case "interfacemode": case "ledindication": case "locked": case "lift": + case "melody": + case "mountingmode": case "off": case "offset": + case "pulseconfiguration": + case "resetpresence": case "sensitivity": case "tilt": case "usertest": case "volume": - case "windowopen_set": - case "melody": + case "windowcoveringtype": + case "windowopen_set": parameters = `{ "${dp}": ${state.val} }`; break; //string - case "airquality": case "colormode": case "clickmode": case "devicemode": - case "errorcode": case "fanmode": case "mode": case "preset": - case "windowopen": + case "swingmode": + case "triggerdistance": parameters = `{ "${dp}": "${state.val}" }`; break; //temperature @@ -2483,6 +2487,14 @@ async function SetObjectAndState(id, name, type, stateName, value) { case "airquality": objType = "string"; objRole = "state"; + objWrite = false; + break; + case "airqualityppb": + objType = "number"; + objRole = "value"; + objWrite = false; + objMin = 0; + objMax = 65534; break; case "battery": objType = "number"; @@ -2522,6 +2534,11 @@ async function SetObjectAndState(id, name, type, stateName, value) { objRole = "sensor.alarm"; objWrite = false; break; + case "charging": + objType = "boolean"; + objRole = "state"; + objWrite = false; + break; case "configid": objType = "number"; objRole = "state"; @@ -2587,7 +2604,10 @@ async function SetObjectAndState(id, name, type, stateName, value) { break; case "delay": objType = "number"; - objRole = "state"; + objRole = "value"; + objMin = 0; + objMax = 65535; + objUnit = "s"; break; case "devicemode": objType = "string"; @@ -2601,7 +2621,7 @@ async function SetObjectAndState(id, name, type, stateName, value) { objType = "number"; objRole = "value"; objMin = 0; - objMax = 999999; + objMax = 65535; objDefault = 600; objUnit = "s"; break; @@ -2652,9 +2672,15 @@ async function SetObjectAndState(id, name, type, stateName, value) { objDefault = "[[255,0,0],[0,255,0],[0,0,255]]"; value = JSON.stringify(value); break; + case "enrolled": + objType = "number"; + objRole = "state"; + break; case "externalsensortemp": objType = "number"; objRole = "level.temperature"; + objMin = -32768; + objMax = 32767; objDefault = 0; objUnit = "°C"; value = value / 100; @@ -2666,6 +2692,15 @@ async function SetObjectAndState(id, name, type, stateName, value) { case "fanmode": objType = "string"; objRole = "state"; + objStates = { + off: "off", + low: "low", + medium: "medium", + high: "high", + on: "on", + auto: "auto", + smart: "smart", + }; break; case "fire": objType = "boolean"; @@ -2677,6 +2712,13 @@ async function SetObjectAndState(id, name, type, stateName, value) { objRole = "indicator"; objWrite = false; break; + case "floortemperature": + objType = "number"; + objRole = "value.temperature"; + objWrite = false; + objUnit = "°C"; + value = value / 100; + break; case "group": objType = "number"; objRole = "state"; @@ -2689,6 +2731,11 @@ async function SetObjectAndState(id, name, type, stateName, value) { objUnit = "°C"; value = value / 100; break; + case "heating": + objType = "boolean"; + objRole = "indicator"; + objWrite = false; + break; case "hue": objType = "number"; objRole = "level.color.hue"; @@ -2713,12 +2760,26 @@ async function SetObjectAndState(id, name, type, stateName, value) { objRole = "indicator"; objWrite = false; break; + case "interfacemode": + objType = "number"; + objRole = "value"; + objWrite = false; + break; + case "lastset": + objType = "string"; + objRole = "value.datetime"; + objWrite = false; + break; case "lastupdated": objType = "string"; objRole = "value.datetime"; objWrite = false; value = UTCtoLocal(value); break; + case "lat": + objType = "number"; + objRole = "value.datetime"; + break; case "ledindication": objType = "boolean"; objRole = "indicator"; @@ -2750,7 +2811,11 @@ async function SetObjectAndState(id, name, type, stateName, value) { objType = "string"; objRole = "value.datetime"; objWrite = false; - break; + break; + case "long": + objType = "number"; + objRole = "value.datetime"; + break; case "lift": objType = "number"; objRole = "level.value"; @@ -2777,6 +2842,15 @@ async function SetObjectAndState(id, name, type, stateName, value) { objType = "string"; objRole = "state"; break; + case "mountingmode": + objType = "boolean"; + objRole = "switch"; + break; + case "mountingmodeactive": + objType = "boolean"; + objRole = "indicator"; + objWrite = false; + break; case "on": case "off": objType = "boolean"; @@ -2785,8 +2859,8 @@ async function SetObjectAndState(id, name, type, stateName, value) { case "offset": objType = "number"; objRole = "state"; - objMin = -999; - objMax = 999; + objMin = -32768; + objMax = 32767; objDefault = 0; break; case "open": @@ -2816,6 +2890,11 @@ async function SetObjectAndState(id, name, type, stateName, value) { objRole = "sensor.motion"; objWrite = false; break; + case "presenceevent": + objType = "string"; + objRole = "state"; + objWrite = false; + break; case "pressure": objType = "number"; objRole = "value.pressure"; @@ -2837,11 +2916,21 @@ async function SetObjectAndState(id, name, type, stateName, value) { complex: "complex", }; break; + case "pulseconfiguration": + objType = "number"; + objRole = "value"; + objMin = 0; + objMax = 65535; + break; case "reachable": objType = "boolean"; objRole = "indicator.reachable"; objWrite = false; break; + case "resetpresence": + objType = "boolean"; + objRole = "switch"; + break; case "sat": objType = "number"; objRole = "level.color.saturation"; @@ -2849,6 +2938,16 @@ async function SetObjectAndState(id, name, type, stateName, value) { objMax = 255; objDefault = 255; break; + case "schedule": + objType = "object"; + objRole = "schedule"; + objDefault = "{}"; + value = JSON.stringify(value); + break; + case "scheduler": + objType = "string"; + objRole = "state"; + break; case "scheduleron": objType = "boolean"; objRole = "state"; @@ -2865,17 +2964,17 @@ async function SetObjectAndState(id, name, type, stateName, value) { objWrite = false; objDefault = 0; break; - case "speed": - objType = "number"; - objRole = "state"; - objDefault = 0; - break; case "status": objType = "number"; objRole = "state"; objWrite = false; objDefault = 0; break; + case "stop": + objType = "boolean"; + objRole = "button"; + objDefault = true; + break; case "sunrise": objType = "string"; objRole = "date.sunrise"; @@ -2896,18 +2995,12 @@ async function SetObjectAndState(id, name, type, stateName, value) { objRole = "state"; objWrite = false; break; - case "stop": - objType = "boolean"; - objRole = "button"; - objDefault = true; - break; - case "schedule": - objType = "object"; - objRole = "schedule"; - objDefault = "{}"; - value = JSON.stringify(value); + case "speed": + objType = "number"; + objRole = "state"; + objDefault = 0; break; - case "scheduler": + case "swingmode": objType = "string"; objRole = "state"; break; @@ -2931,13 +3024,16 @@ async function SetObjectAndState(id, name, type, stateName, value) { case "tholddark": objType = "number"; objRole = "value"; - objWrite = false; - objDefault = 0; + objMin = 0; + objMax = 65534; + objDefault = 12000; break; case "tholdoffset": objType = "number"; objRole = "value"; - objDefault = 0; + objMin = 1; + objMax = 65534; + objDefault = 7000; break; case "tilt": objType = "number"; @@ -2957,10 +3053,19 @@ async function SetObjectAndState(id, name, type, stateName, value) { objDefault = 0; objUnit = "s"; break; + case "triggerdistance": + objType = "string"; + objRole = "state"; + break; case "usertest": objType = "boolean"; objRole = "switch"; break; + case "utc": + objType = "string"; + objRole = "value.datetime"; + objWrite = false; + break; case "valve": objType = "number"; objRole = "value.valve"; @@ -2982,6 +3087,7 @@ async function SetObjectAndState(id, name, type, stateName, value) { case "vibration": objType = "boolean"; objRole = "sensor.vibration"; + objWrite = false; break; case "vibrationstrength": objType = "number"; @@ -2994,9 +3100,16 @@ async function SetObjectAndState(id, name, type, stateName, value) { objRole = "sensor.alarm.flood"; objWrite = false; break; + case "windowcoveringtype": + objType = "number"; + objRole = "state"; + objMin = 0; + objMax = 9; + break; case "windowopen": objType = "string"; objRole = "state"; + objWrite = false; break; case "windowopen_set": objType = "boolean"; From 39f5dd4a4ff86401ada7f8a9fea6c3357530167c Mon Sep 17 00:00:00 2001 From: mattreim <80219712+mattreim@users.noreply.github.com> Date: Thu, 1 Feb 2024 16:12:53 +0100 Subject: [PATCH 03/11] Fix some object items --- main.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/main.js b/main.js index 4085e8b..18f4638 100755 --- a/main.js +++ b/main.js @@ -292,7 +292,9 @@ class deconz extends utils.Adapter { case "externalwindowopen": case "interfacemode": case "ledindication": + case "lat": case "locked": + case "long": case "lift": case "melody": case "mountingmode": @@ -2679,8 +2681,6 @@ async function SetObjectAndState(id, name, type, stateName, value) { case "externalsensortemp": objType = "number"; objRole = "level.temperature"; - objMin = -32768; - objMax = 32767; objDefault = 0; objUnit = "°C"; value = value / 100; @@ -2756,14 +2756,13 @@ async function SetObjectAndState(id, name, type, stateName, value) { value = value / 100; break; case "hostflags": - objType = "number"; + objType = "string"; objRole = "indicator"; objWrite = false; break; case "interfacemode": objType = "number"; - objRole = "value"; - objWrite = false; + objRole = "state"; break; case "lastset": objType = "string"; @@ -2778,7 +2777,7 @@ async function SetObjectAndState(id, name, type, stateName, value) { break; case "lat": objType = "number"; - objRole = "value.datetime"; + objRole = "value.gps.latitude"; break; case "ledindication": objType = "boolean"; @@ -2814,11 +2813,13 @@ async function SetObjectAndState(id, name, type, stateName, value) { break; case "long": objType = "number"; - objRole = "value.datetime"; + objRole = "value.gps.longitude"; break; case "lift": objType = "number"; objRole = "level.value"; + objMin = 0; + objMax = 100; objDefault = 0; break; case "lux": @@ -3038,7 +3039,10 @@ async function SetObjectAndState(id, name, type, stateName, value) { case "tilt": objType = "number"; objRole = "level.value"; + objMin = 0; + objMax = 100; objDefault = 1; + objUnit = "%"; break; case "tiltangle": objType = "number"; From 27fe54e53af4a4641711a9e00ca1c44f86d0c586 Mon Sep 17 00:00:00 2001 From: mattreim <80219712+mattreim@users.noreply.github.com> Date: Thu, 1 Feb 2024 20:27:18 +0100 Subject: [PATCH 04/11] Set colorloopspeed: default 15 --- main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.js b/main.js index 18f4638..a3a0466 100755 --- a/main.js +++ b/main.js @@ -2569,7 +2569,7 @@ async function SetObjectAndState(id, name, type, stateName, value) { objRole = "state"; objMin = 1; objMax = 255; - objDefault = 255; + objDefault = 15; break; case "colormode": objType = "string"; From efcf883c3fb47d0fd7139591ce3a3cfa128e14c1 Mon Sep 17 00:00:00 2001 From: mattreim <80219712+mattreim@users.noreply.github.com> Date: Fri, 2 Feb 2024 14:14:03 +0100 Subject: [PATCH 05/11] Set objects write [fix] --- main.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/main.js b/main.js index a3a0466..607ca8e 100755 --- a/main.js +++ b/main.js @@ -284,11 +284,13 @@ class deconz extends utils.Adapter { }, }); break; - //boolean&number + //set boolean&number case "boost": + case "charging": case "delay": case "displayflipped": case "duration": + case "enrolled": case "externalwindowopen": case "interfacemode": case "ledindication": @@ -303,6 +305,11 @@ class deconz extends utils.Adapter { case "pulseconfiguration": case "resetpresence": case "sensitivity": + case "speed": + case "tholddark": + case "tholdoffset": + case "toggle": + case "transitiontime": case "tilt": case "usertest": case "volume": @@ -310,7 +317,7 @@ class deconz extends utils.Adapter { case "windowopen_set": parameters = `{ "${dp}": ${state.val} }`; break; - //string + //set string case "colormode": case "clickmode": case "devicemode": @@ -321,11 +328,10 @@ class deconz extends utils.Adapter { case "triggerdistance": parameters = `{ "${dp}": "${state.val}" }`; break; - //temperature + //set temperature case "heatsetpoint": case "coolsetpoint": - case "externalsensortemp": - case "temperature": + case "externalsensortemp": let val = Math.floor(state.val * 100); parameters = `{ "${dp}": ${val} }`; break; @@ -2539,11 +2545,11 @@ async function SetObjectAndState(id, name, type, stateName, value) { case "charging": objType = "boolean"; objRole = "state"; - objWrite = false; break; case "configid": objType = "number"; objRole = "state"; + objWrite = false; break; case "consumption": objType = "number"; @@ -2778,6 +2784,7 @@ async function SetObjectAndState(id, name, type, stateName, value) { case "lat": objType = "number"; objRole = "value.gps.latitude"; + objRead= false; break; case "ledindication": objType = "boolean"; @@ -2814,6 +2821,7 @@ async function SetObjectAndState(id, name, type, stateName, value) { case "long": objType = "number"; objRole = "value.gps.longitude"; + objRead= false; break; case "lift": objType = "number"; From 44172e96d1f179697c5a2cd89d246569bf833166 Mon Sep 17 00:00:00 2001 From: mattreim <80219712+mattreim@users.noreply.github.com> Date: Fri, 2 Feb 2024 15:37:56 +0100 Subject: [PATCH 06/11] remove transitiontime from write list --- main.js | 1 - 1 file changed, 1 deletion(-) diff --git a/main.js b/main.js index 607ca8e..002f1bb 100755 --- a/main.js +++ b/main.js @@ -309,7 +309,6 @@ class deconz extends utils.Adapter { case "tholddark": case "tholdoffset": case "toggle": - case "transitiontime": case "tilt": case "usertest": case "volume": From 7e00b6691c6dc20154bfdf94e860ab246637d45f Mon Sep 17 00:00:00 2001 From: mattreim <80219712+mattreim@users.noreply.github.com> Date: Tue, 20 Feb 2024 12:07:47 +0100 Subject: [PATCH 07/11] Add more min/max values --- main.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/main.js b/main.js index 002f1bb..60d9b98 100755 --- a/main.js +++ b/main.js @@ -176,18 +176,14 @@ class deconz extends utils.Adapter { } break; case "colorspeed": - let effect = await this.getStateAsync( - this.name + "." + this.instance + "." + id + ".effect" - ); + let effect = await this.getStateAsync(this.name + "." + this.instance + "." + id + ".effect"); if (effect && effect.val === "colorloop") { parameters = '{"colorloopspeed": ' + state.val + ', "effect": "colorloop"}'; } break; case "effect": if (state.val === "colorloop") { - const speed = await this.getStateAsync( - this.name + "." + this.instance + "." + id + ".colorspeed" - ); + const speed = await this.getStateAsync(this.name + "." + this.instance + "." + id + ".colorspeed"); if (speed.val === null || speed.val === undefined) { speed.val = 1; } @@ -2560,6 +2556,8 @@ async function SetObjectAndState(id, name, type, stateName, value) { case "coolsetpoint": objType = "number"; objRole = "level.temperature"; + objMin = 7.0; + objMax = 35.0; objDefault = 0; objUnit = "°C"; value = value / 100; @@ -2686,6 +2684,8 @@ async function SetObjectAndState(id, name, type, stateName, value) { case "externalsensortemp": objType = "number"; objRole = "level.temperature"; + objMin = -327.68; + objMax = 327.67; objDefault = 0; objUnit = "°C"; value = value / 100; @@ -2732,6 +2732,8 @@ async function SetObjectAndState(id, name, type, stateName, value) { case "heatsetpoint": objType = "number"; objRole = "level.temperature"; + objMin = 5.0; + objMax = 32.0; objDefault = 20.0; objUnit = "°C"; value = value / 100; @@ -2867,8 +2869,8 @@ async function SetObjectAndState(id, name, type, stateName, value) { case "offset": objType = "number"; objRole = "state"; - objMin = -32768; - objMax = 32767; + objMin = -327.68; + objMax = 327.67; objDefault = 0; break; case "open": From 7dae477a25d90aafed0a86487f6aaa9b594a4198 Mon Sep 17 00:00:00 2001 From: mattreim <80219712+mattreim@users.noreply.github.com> Date: Wed, 21 Feb 2024 15:13:44 +0100 Subject: [PATCH 08/11] Add object: setvalve --- main.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.js b/main.js index 60d9b98..455fb05 100755 --- a/main.js +++ b/main.js @@ -300,6 +300,7 @@ class deconz extends utils.Adapter { case "offset": case "pulseconfiguration": case "resetpresence": + case "setvalve": case "sensitivity": case "speed": case "tholddark": @@ -2963,6 +2964,10 @@ async function SetObjectAndState(id, name, type, stateName, value) { objRole = "state"; objWrite = false; break; + case "setvalve": + objType = "boolean"; + objRole = "switch"; + break; case "sensitivity": objType = "number"; objRole = "state"; From 57255b7676083f6e3df1b1873f6cc618934977c8 Mon Sep 17 00:00:00 2001 From: mattreim <80219712+mattreim@users.noreply.github.com> Date: Thu, 22 Feb 2024 17:43:20 +0100 Subject: [PATCH 09/11] corrections --- main.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index 455fb05..f90fb49 100755 --- a/main.js +++ b/main.js @@ -2506,8 +2506,8 @@ async function SetObjectAndState(id, name, type, stateName, value) { objWrite = false; objMin = 0; objMax = 100; - objUnit = "%"; objDefault = 0; + objUnit = "%"; break; case "bri": objType = "number"; @@ -2559,7 +2559,7 @@ async function SetObjectAndState(id, name, type, stateName, value) { objRole = "level.temperature"; objMin = 7.0; objMax = 35.0; - objDefault = 0; + objDefault = 18.0; objUnit = "°C"; value = value / 100; break; @@ -2698,6 +2698,7 @@ async function SetObjectAndState(id, name, type, stateName, value) { case "fanmode": objType = "string"; objRole = "state"; + objDefault = "auto"; objStates = { off: "off", low: "low", @@ -2722,6 +2723,7 @@ async function SetObjectAndState(id, name, type, stateName, value) { objType = "number"; objRole = "value.temperature"; objWrite = false; + objDefault = 0; objUnit = "°C"; value = value / 100; break; @@ -2771,6 +2773,7 @@ async function SetObjectAndState(id, name, type, stateName, value) { case "interfacemode": objType = "number"; objRole = "state"; + objDefault = 0; break; case "lastset": objType = "string"; @@ -2843,6 +2846,7 @@ async function SetObjectAndState(id, name, type, stateName, value) { objType = "number"; objRole = "state"; objWrite = false; + objDefault = 0; break; case "melody": objType = "number"; @@ -2932,6 +2936,7 @@ async function SetObjectAndState(id, name, type, stateName, value) { objRole = "value"; objMin = 0; objMax = 65535; + objDefault = 0; break; case "reachable": objType = "boolean"; @@ -3074,6 +3079,7 @@ async function SetObjectAndState(id, name, type, stateName, value) { case "triggerdistance": objType = "string"; objRole = "state"; + objUnit = "m"; break; case "usertest": objType = "boolean"; @@ -3089,6 +3095,7 @@ async function SetObjectAndState(id, name, type, stateName, value) { objRole = "value.valve"; objWrite = false; objDefault = 0; + objUnit = "%"; break; case "voltage": objType = "number"; @@ -3123,6 +3130,7 @@ async function SetObjectAndState(id, name, type, stateName, value) { objRole = "state"; objMin = 0; objMax = 9; + objDefault = 0; break; case "windowopen": objType = "string"; From 5bf5792ef2f1b6478eb6bfeb12d00494c4a8062c Mon Sep 17 00:00:00 2001 From: mattreim <80219712+mattreim@users.noreply.github.com> Date: Fri, 23 Feb 2024 08:53:49 +0100 Subject: [PATCH 10/11] Add switch objects --- main.js | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index f90fb49..67ebabc 100755 --- a/main.js +++ b/main.js @@ -2456,7 +2456,7 @@ async function SetObjectAndState(id, name, type, stateName, value) { let objDefault = null; switch (stateName) { - //attributes + //attributes&objects case "alarm": objType = "boolean"; objRole = "sensor.alarm"; @@ -2478,6 +2478,13 @@ async function SetObjectAndState(id, name, type, stateName, value) { objRole = "indicator"; objWrite = false; break; + case "angle": + objType = "number"; + objRole = "state"; + objWrite = false; + objDefault = 0; + objUnit = "°"; + break; case "any_on": objType = "boolean"; objRole = "indicator"; @@ -2527,6 +2534,7 @@ async function SetObjectAndState(id, name, type, stateName, value) { objType = "number"; objRole = "state"; objWrite = false; + objDefault = 0; buttonEvents(`${type}.${id}.buttonevent`, value); break; case "boost": @@ -2682,6 +2690,12 @@ async function SetObjectAndState(id, name, type, stateName, value) { objType = "number"; objRole = "state"; break; + case "eventduration": + objType = "number"; + objRole = "state"; + objWrite = false; + objDefault = 0; + break; case "externalsensortemp": objType = "number"; objRole = "level.temperature"; @@ -2727,6 +2741,12 @@ async function SetObjectAndState(id, name, type, stateName, value) { objUnit = "°C"; value = value / 100; break; + case "gesture": + objType = "number"; + objRole = "state"; + objWrite = false; + objDefault = 0; + break; case "group": objType = "number"; objRole = "state"; @@ -3141,6 +3161,18 @@ async function SetObjectAndState(id, name, type, stateName, value) { objType = "boolean"; objRole = "switch"; break; + case "x": + objType = "number"; + objRole = "state"; + objWrite = false; + objDefault = 0; + break; + case "y": + objType = "number"; + objRole = "state"; + objWrite = false; + objDefault = 0; + break; case "xy": objType = "array"; objRole = "color.CIE"; From 80622dc0b228e3047f1e3d3f3e39b4c99c570f38 Mon Sep 17 00:00:00 2001 From: mattreim <80219712+mattreim@users.noreply.github.com> Date: Wed, 28 Feb 2024 17:53:33 +0100 Subject: [PATCH 11/11] Reset offset default because v2.26.1 --- main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index 67ebabc..98d8a07 100755 --- a/main.js +++ b/main.js @@ -2894,8 +2894,8 @@ async function SetObjectAndState(id, name, type, stateName, value) { case "offset": objType = "number"; objRole = "state"; - objMin = -327.68; - objMax = 327.67; + objMin = -999; + objMax = 999; objDefault = 0; break; case "open":