From 2fd9e8696eb2972c0c3bb50c3988747cab325553 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Tue, 17 Sep 2024 08:48:45 +0200 Subject: [PATCH] set default value for customizedValues if no value --- index.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/index.js b/index.js index 130d756..202c4e9 100755 --- a/index.js +++ b/index.js @@ -4557,23 +4557,23 @@ JeedomPlatform.prototype.getAccessoryValue = function(characteristic, service, i cmd.generic_type == 'BARRIER_STATE') { targetValueToTest=cmd.currentValue.toString(); switch(targetValueToTest) { - case customizedValues.OPEN.toString() : + case (customizedValues.OPEN ?? 255).toString() : returnValue=Characteristic.TargetDoorState.OPEN; // 0 HRreturnValue="OPEN"; break; - case customizedValues.CLOSED.toString() : + case (customizedValues.CLOSED ?? 0).toString() : returnValue=Characteristic.TargetDoorState.CLOSED; // 1 HRreturnValue="CLOSED"; break; - case customizedValues.OPENING.toString() : + case (customizedValues.OPENING ?? 254).toString() : returnValue=Characteristic.TargetDoorState.OPEN; // 0 HRreturnValue="OPEN"; break; - case customizedValues.CLOSING.toString() : + case (customizedValues.CLOSING ?? 252).toString() : returnValue=Characteristic.TargetDoorState.CLOSED; // 1 HRreturnValue="CLOSED"; break; - case customizedValues.STOPPED.toString() : + case (customizedValues.STOPPED ?? 253).toString() : returnValue=Characteristic.TargetDoorState.CLOSED; // 1 HRreturnValue="CLOSED"; break; @@ -4594,23 +4594,23 @@ JeedomPlatform.prototype.getAccessoryValue = function(characteristic, service, i cmd.generic_type == 'BARRIER_STATE') { currentValueToTest=cmd.currentValue.toString(); switch(currentValueToTest) { - case customizedValues.OPEN.toString() : + case (customizedValues.OPEN ?? 255).toString() : returnValue=Characteristic.CurrentDoorState.OPEN; // 0 HRreturnValue="OPEN"; break; - case customizedValues.CLOSED.toString() : + case (customizedValues.CLOSED ?? 0).toString() : returnValue=Characteristic.CurrentDoorState.CLOSED; // 1 HRreturnValue="CLOSED"; break; - case customizedValues.OPENING.toString() : + case (customizedValues.OPENING ?? 254).toString() : returnValue=Characteristic.CurrentDoorState.OPENING; // 2 HRreturnValue="OPENING"; break; - case customizedValues.CLOSING.toString() : + case (customizedValues.CLOSING ?? 252).toString() : returnValue=Characteristic.CurrentDoorState.CLOSING; // 3 HRreturnValue="CLOSING"; break; - case customizedValues.STOPPED.toString() : + case (customizedValues.STOPPED ?? 253).toString() : returnValue=Characteristic.CurrentDoorState.STOPPED; // 4 HRreturnValue="STOPPED"; break;