FlyingDiver / Indigo-Occupatum

Location and Occupancy plugin for the Indigo Home Automation System
MIT License
2 stars 4 forks source link

device becomes on when one of several motion sensors becomes off after zone cancel #5

Closed cronutan closed 3 years ago

cronutan commented 3 years ago

When I cancel timer for zone (off) I get the state of the occupatum device off as exppected, however when one of my motion sensors turns off subsequently the occupatum device becomes on again and then after timeout becomes off again.

Screen Shot 2021-02-12 at 3 33 01 PM

Log of the sequence:

2021-02-12 15:48:24.819 Received INSTEON    "L0_LR_OCP" on (button 1)
2021-02-12 15:48:24.819 Trigger L0_LR_OCP_ON_VAR
2021-02-12 15:48:24.820 Trigger L0_LR_VOCP_ACTN_VAR
2021-02-12 15:48:24.823 Occupatum Debug Watched Device updated: L0_LR_OCP
2021-02-12 15:48:24.825 Trigger L0_LR_VMNT_ON_VAR
2021-02-12 15:48:24.826 Trigger Occupancy Log Update
2021-02-12 15:48:24.827 Trigger Action Log Update
2021-02-12 15:48:24.829 Occupatum Debug L0_LR_OCPTM: checkSensors, onSensorsOnOff = on, onSensorsOnOff = on, sensors: [168366766, 935853968]
2021-02-12 15:48:24.829 Occupatum Debug L0_LR_OCPTM: checkSensors, occupied = True, previous = False, delay = 0.0
2021-02-12 15:48:24.829 Occupatum Debug L0_LR_OCPTM: checkSensors, starting delay timer <_Timer(Thread-77, initial)> with delay = 0.0
2021-02-12 15:48:24.830 Occupatum Debug L0_LR_OCPTM: delayTimerComplete, occupied = True
2021-02-12 15:48:24.831 Occupatum Debug L0_LR_OCPTM_LT_ON: Testing Event Trigger
2021-02-12 15:48:24.831 Occupatum Debug L0_LR_OCPTM_LT_ON: Match on Zone L0_LR_OCPTM
2021-02-12 15:48:24.831 Trigger L0_LR_OCPTM_LT_ON
2021-02-12 15:48:24.831 Action Group    L0_LR_ON
2021-02-12 15:48:24.836 Occupatum Debug L0_FR_OCPTM_LT_ON: Testing Event Trigger
2021-02-12 15:48:24.836 Occupatum Debug L0_LR_OCPTM_LT_OFF: Testing Event Trigger
2021-02-12 15:48:24.836 Occupatum Debug L0_LR_OCPTM_LT_OFF: Match on Zone L0_LR_OCPTM
2021-02-12 15:48:24.836 Occupatum Debug L0_FR_OCPTM_LT_OFF: Testing Event Trigger
2021-02-12 15:48:24.974 DSC Alarm   Alarm Zone 'L0_GR_MTN' Opened.
2021-02-12 15:48:24.974 Trigger L0_GR_MNT_ON_VAR
2021-02-12 15:48:24.977 Trigger Occupancy Log Update
2021-02-12 15:48:24.989 Occupatum Debug Watched Device updated: L0_GR_MNT_MSQRD
2021-02-12 15:48:24.991 Occupatum Debug L0_GR_OCPTM: checkSensors, onSensorsOnOff = on, onSensorsOnOff = on, sensors: [1950901611]
2021-02-12 15:48:24.991 Occupatum Debug L0_GR_OCPTM: checkSensors, occupied = True, previous = False, delay = 0.0
2021-02-12 15:48:24.991 Occupatum Debug L0_GR_OCPTM: checkSensors, starting delay timer <_Timer(Thread-78, initial)> with delay = 0.0
2021-02-12 15:48:24.991 Occupatum Debug L0_GR_OCPTM: delayTimerComplete, occupied = True
2021-02-12 15:48:24.991 Occupatum Debug L0_LR_OCPTM_LT_ON: Testing Event Trigger
2021-02-12 15:48:24.991 Occupatum Debug L0_FR_OCPTM_LT_ON: Testing Event Trigger
2021-02-12 15:48:24.992 Occupatum Debug L0_LR_OCPTM_LT_OFF: Testing Event Trigger
2021-02-12 15:48:24.992 Occupatum Debug L0_FR_OCPTM_LT_OFF: Testing Event Trigger
2021-02-12 15:48:25.090 Sent INSTEON    "PowerLinc Interface" on to 100% (instant) (scene 11 - L0_LR)
2021-02-12 15:48:25.551 Z-Wave  received "L0_LR_OCP_Z" status update is on
2021-02-12 15:48:25.553 Occupatum Debug Watched Device updated: L0_LR_OCP_Z
2021-02-12 15:48:25.556 Occupatum Debug L0_LR_OCPTM: checkSensors, onSensorsOnOff = on, onSensorsOnOff = on, sensors: [168366766, 935853968]
2021-02-12 15:48:25.556 Occupatum Debug L0_LR_OCPTM: checkSensors, occupied = True, previous = True, delay = 0.0
2021-02-12 15:48:25.557 Occupatum Debug L0_LR_OCPTM: checkSensors, starting delay timer <_Timer(Thread-79, initial)> with delay = 0.0
2021-02-12 15:48:25.557 Occupatum Debug L0_LR_OCPTM: delayTimerComplete, occupied = True
2021-02-12 15:48:25.557 Occupatum Debug L0_LR_OCPTM_LT_ON: Testing Event Trigger
2021-02-12 15:48:25.557 Occupatum Debug L0_LR_OCPTM_LT_ON: Match on Zone L0_LR_OCPTM
2021-02-12 15:48:25.557 Trigger L0_LR_OCPTM_LT_ON
2021-02-12 15:48:25.557 Action Group    L0_LR_ON
2021-02-12 15:48:25.560 Occupatum Debug L0_FR_OCPTM_LT_ON: Testing Event Trigger
2021-02-12 15:48:25.560 Occupatum Debug L0_LR_OCPTM_LT_OFF: Testing Event Trigger
2021-02-12 15:48:25.560 Occupatum Debug L0_LR_OCPTM_LT_OFF: Match on Zone L0_LR_OCPTM
2021-02-12 15:48:25.560 Occupatum Debug L0_FR_OCPTM_LT_OFF: Testing Event Trigger
2021-02-12 15:48:25.666 Sent INSTEON    "PowerLinc Interface" on to 100% (instant) (scene 11 - L0_LR)
2021-02-12 15:48:26.711 DSC Alarm   Alarm Zone 'L0_GR_MTN' Closed.
2021-02-12 15:48:26.711 Trigger L0_GR_MNT_OFF_VAR
2021-02-12 15:48:26.714 Occupatum Debug Watched Device updated: L0_GR_MNT_MSQRD
2021-02-12 15:48:26.716 Occupatum Debug L0_GR_OCPTM: checkSensors, onSensorsOnOff = on, onSensorsOnOff = on, sensors: [1950901611]
2021-02-12 15:48:26.716 Occupatum Debug L0_GR_OCPTM: checkSensors, occupied = False, previous = True, delay = 480.0
2021-02-12 15:48:26.716 Occupatum Debug L0_GR_OCPTM: checkSensors, starting delay timer <_Timer(Thread-80, initial)> with delay = 480.0
2021-02-12 15:48:26.749 Schedule    L0_LR_OCPTM_LT_ON (delayed action)
2021-02-12 15:48:26.769 Sent INSTEON    "PowerLinc Interface" on to 100% (instant) (scene 11 - L0_LR)
2021-02-12 15:48:29.952 Received INSTEON    "L0_LR_LT" off
2021-02-12 15:48:29.953 Trigger L0_LR_LT_OFF
2021-02-12 15:48:29.953 Trigger L0_LR_VOCP_OFF_VAR
2021-02-12 15:48:29.974 Occupatum Debug L0_LR_OCPTM: No Timer Active
2021-02-12 15:48:30.823 DSC Alarm   Alarm Zone 'L0_GR_MTN' Opened.
2021-02-12 15:48:30.823 Trigger L0_GR_MNT_ON_VAR
2021-02-12 15:48:30.828 Occupatum Debug Watched Device updated: L0_GR_MNT_MSQRD
2021-02-12 15:48:30.831 Occupatum Debug L0_GR_OCPTM: checkSensors, onSensorsOnOff = on, onSensorsOnOff = on, sensors: [1950901611]
2021-02-12 15:48:30.832 Occupatum Debug L0_GR_OCPTM: checkSensors, occupied = True, previous = True, delay = 0.0
2021-02-12 15:48:30.832 Occupatum Debug L0_GR_OCPTM: checkSensors, cancelling existing delay timer
2021-02-12 15:48:30.832 Occupatum Debug L0_GR_OCPTM: checkSensors, starting delay timer <_Timer(Thread-81, initial)> with delay = 0.0
2021-02-12 15:48:30.833 Occupatum Debug L0_GR_OCPTM: delayTimerComplete, occupied = True
2021-02-12 15:48:30.833 Occupatum Debug L0_LR_OCPTM_LT_ON: Testing Event Trigger
2021-02-12 15:48:30.833 Occupatum Debug L0_FR_OCPTM_LT_ON: Testing Event Trigger
2021-02-12 15:48:30.833 Occupatum Debug L0_LR_OCPTM_LT_OFF: Testing Event Trigger
2021-02-12 15:48:30.833 Occupatum Debug L0_FR_OCPTM_LT_OFF: Testing Event Trigger
2021-02-12 15:48:32.634 DSC Alarm   Alarm Zone 'L0_GR_MTN' Closed.
2021-02-12 15:48:32.635 Trigger L0_GR_MNT_OFF_VAR
2021-02-12 15:48:32.638 Occupatum Debug Watched Device updated: L0_GR_MNT_MSQRD
2021-02-12 15:48:32.639 Occupatum Debug L0_GR_OCPTM: checkSensors, onSensorsOnOff = on, onSensorsOnOff = on, sensors: [1950901611]
2021-02-12 15:48:32.640 Occupatum Debug L0_GR_OCPTM: checkSensors, occupied = False, previous = True, delay = 480.0
2021-02-12 15:48:32.640 Occupatum Debug L0_GR_OCPTM: checkSensors, starting delay timer <_Timer(Thread-82, initial)> with delay = 480.0
2021-02-12 15:48:35.495 DSC Alarm   Alarm Zone 'L2_LR_MTN' Opened.
2021-02-12 15:48:35.495 Trigger L2_LR_MNT_ON_VAR
2021-02-12 15:48:35.499 Trigger Occupancy Log Update
2021-02-12 15:48:36.154 DSC Alarm   Alarm Zone 'L1_FR_MTN' Opened.
2021-02-12 15:48:36.154 Trigger L1_FR_MNT_ON_VAR
2021-02-12 15:48:36.155 Trigger Occupancy Log Update
2021-02-12 15:48:36.865 DSC Alarm   Alarm Zone 'L2_LR_MTN' Closed.
FlyingDiver commented 3 years ago

Let me know if you think there's still something to be done in the input logic of the zones. I don't really have any control over the timeouts on the input sensors. Unless I separate the on and off actions and treat them differently. That is, add a class of sensors that are only used for "on" sensing or "off" sensing. Hmmm.

cronutan commented 3 years ago

The only thing I would change is how the cancel timer function works. I think it would be nice if you could invoke it even before the timer starts which would then simply change to unoccupied as soon as all the motions are off.

That way I could cancel timer without immediately without changing occupied state not worrying about how long an individual motion sensor is set to.

P.S. Not going out anymore.

FlyingDiver commented 3 years ago

I don't understand. How can you cancel a timer that hasn't started yet? If you want the zone to go unoccupied as soon as all the sensors are off, then don't put in a delay at all. In any case, I think the specific issue here is fixed. If you want to add some other functionality, then open a new issue. If you do that, give a step by step description of what should happen when, including sensor changes and user actions.