From 7adf50f4bfef773d62f4ff9678c32c0dca5ce512 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Sat, 20 Jan 2024 10:16:11 +0100 Subject: [PATCH] Update index.js --- index.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index e71b853..3fb12c3 100755 --- a/index.js +++ b/index.js @@ -511,6 +511,9 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.eqLogic=eqLogic; Serv.actions={}; Serv.infos={}; + if(cmd.moving) { + Serv.infos.moving=cmd.moving; + } if(cmd.stateClosing) { Serv.infos.state=cmd.stateClosing; if(Serv.infos.state.subType == 'binary') { @@ -4579,7 +4582,30 @@ JeedomPlatform.prototype.getAccessoryValue = function(characteristic, service, i } break; case Characteristic.PositionState.UUID : - returnValue = Characteristic.PositionState.STOPPED; + if(moving in service.infos) { + for (const cmd of cmdList) { + if (cmd.generic_type == 'FLAP_MOVING' || cmd.generic_type == 'WINDOW_MOVING') { + switch(parseInt(cmd.currentValue)) { + case 0 : + returnValue=Characteristic.PositionState.DECREASING; + break; + case 1 : + returnValue=Characteristic.PositionState.INCREASING; + break; + case 2 : + returnValue=Characteristic.PositionState.STOPPED; + break; + default : + returnValue=Characteristic.PositionState.STOPPED; + break; + } + that.log('debug','---------update PositionState:',returnValue); + break; + } + } + } else { + returnValue = Characteristic.PositionState.STOPPED; + } break; case Characteristic.CurrentHorizontalTiltAngle.UUID : case Characteristic.TargetHorizontalTiltAngle.UUID :