@@ -244,8 +244,12 @@ HomeMaticHomeKitGarageDoorService.prototype.event = function (channel, dp, newVa
244244 this . log . debug ( '[GDS] garage event %s,%s,%s Target Command State %s' , channel , dp , newValue , this . targetCommand )
245245 let eventAddress = channel + '.' + dp
246246 // Kill requery timer
247+
247248 clearTimeout ( this . requeryTimer )
248- clearTimeout ( this . inittimer )
249+
250+ if ( ( eventAddress === this . address_sensor_close ) || ( eventAddress === this . address_sensor_open ) ) {
251+ clearTimeout ( this . inittimer )
252+ }
249253
250254 if ( ( this . address_sensor_close !== undefined ) && ( this . address_sensor_open !== undefined ) ) {
251255 // we have two sensors
@@ -288,27 +292,27 @@ HomeMaticHomeKitGarageDoorService.prototype.event = function (channel, dp, newVa
288292 // first set a new target state but ony if the target was not set by homekit first
289293 if ( this . targetCommand === false ) {
290294 let newState = ( this . didMatch ( newValue , that . state_sensor_close ) ) ? this . characteristic . TargetDoorState . CLOSED : this . characteristic . TargetDoorState . OPEN
291- this . log . debug ( '[GDS] Close sensor is %s set targetDoorState %s' , newValue , newState )
295+ this . log . debug ( '[GDS] Close sensor hm value is %s set targetDoorState %s' , newValue , newState )
292296 this . targetDoorState . updateValue ( newState , null )
293297 }
294298 // wait one second cause we have a really fast going garage door
295299 setTimeout ( function ( ) {
296300 let newState = ( that . didMatch ( newValue , that . state_sensor_close ) ) ? that . characteristic . CurrentDoorState . CLOSED : that . characteristic . CurrentDoorState . OPEN
297- that . log . debug ( '[GDS] timer fired close sensor is %s set new current state %s' , newState , newState )
301+ that . log . debug ( '[GDS] timer fired close sensor hm value is %s set new current state %s' , newValue , newState )
298302 that . currentDoorState . updateValue ( newState , null )
299303 } , 1000 )
300304 }
301305
302306 if ( eventAddress === this . address_sensor_open ) {
303307 if ( this . targetCommand === false ) {
304308 let newState = ( this . didMatch ( newValue , this . state_sensor_open ) ) ? that . characteristic . TargetDoorState . OPEN : this . characteristic . TargetDoorState . CLOSED
305- this . log . debug ( '[GDS] open sensor is %s set new target state %s' , newValue , newState )
309+ this . log . debug ( '[GDS] open sensor hm value is %s set new target state %s' , newValue , newState )
306310 this . targetDoorState . updateValue ( newState , null )
307311 }
308312
309313 setTimeout ( function ( ) {
310314 let newState = ( that . didMatch ( newValue , that . state_sensor_open ) ) ? that . characteristic . CurrentDoorState . OPEN : that . characteristic . CurrentDoorState . CLOSED
311- that . log . debug ( '[GDS] fired open sensor is %s set new state %s' , newValue , newState )
315+ that . log . debug ( '[GDS] fired open sensor hm value is %s set new state %s' , newValue , newState )
312316 that . currentDoorState . updateValue ( newState , null )
313317 } , 1000 )
314318 }
0 commit comments