Ghawken / HomeKitLink-Siri

8 stars 3 forks source link

Motion Sensor Not Reporting Status #32

Open joshsnelling opened 1 year ago

joshsnelling commented 1 year ago

Describe the bug I'm adding DSC security devices to HomeKitSiri Link, including several contact sensors and motion sensors. I saw this post in the Indigo forums, so I first tried adding the contact sensors as ContactSensor and by setting the Device State to use the state.open state. This worked, although there was a small delay in updating the UI in the Home app (I assume this is an Apple/HomeKit issue, since triggers worked when the sensor turned on/off).

I next tried adding motion sensors, which is where I'm running into the issue. When I use the MotionSensor device type with the same state.open setting, HomeKit never receives updates then the sensor open/closes and triggers configured for it don't run. I can set the same device to be a ContactSensor with the same settings and it works as expected (updates show in the Home app and triggers are run).

I'm able to work around the issue by creating a virtual device using the Masquerade plugin, but I'd rather not do that if I can avoid it.

Are there any known issues or configuration differences with motion sensors that I should be aware of?

To Reproduce Steps to reproduce the behavior: See above

Expected behavior See above

Screenshots N/A

Device Information Go to Device in Indigo and Right Click "Print Device Details to Event Log" Copy and Paste Event Log details here:

address : 
batteryLevel : None
buttonGroupCount : 0
configured : True
description : 
deviceTypeId : homeKitBridgeDevice
displayStateId : Status
displayStateImageSel : PowerOn
displayStateValRaw : Operational
displayStateValUi : Operational
enabled : True
energyAccumBaseTime : None
energyAccumTimeDelta : None
energyAccumTotal : None
energyCurLevel : None
errorState : 
folderId : 207016382
globalProps : MetaProps : (dict)
     com.GlennNZ.indigoplugin.HomeKitLink-Siri : (dict)
          HomeKit_publishDevice_2 : true (bool)
          altName : Kitchen Motion (string)
          audioSelector : false (bool)
          bridgeUniqueID : REDACTED (integer)
          deviceId : 668562228 (string)
          deviceSensor : state.open (string)
          deviceSubtype : MotionSensor (string)
          doorbellId :  (string)
          enablePublishFields : true (bool)
          inverseSelector : false (bool)
          isDeviceSelected : true (bool)
          selectdevice_or_AG : device (string)
          showALL : true (bool)
          showSubtypes : true (bool)
          tempSelector : false (bool)
id : 1510346189
lastChanged : 2023-10-22 11:09:18
lastSuccessfulComm : 2023-10-22 11:09:18
model : HomeKitLink-Siri Bridge
name : HKLS Security Server
ownerProps : com.GlennNZ.indigoplugin.HomeKitLink-Siri : (dict)
     HomeKit_publishDevice_2 : true (bool)
     altName : Kitchen Motion (string)
     audioSelector : false (bool)
     bridgeUniqueID : REDACTED (integer)
     deviceId : 668562228 (string)
     deviceSensor : state.open (string)
     deviceSubtype : MotionSensor (string)
     doorbellId :  (string)
     enablePublishFields : true (bool)
     inverseSelector : false (bool)
     isDeviceSelected : true (bool)
     selectdevice_or_AG : device (string)
     showALL : true (bool)
     showSubtypes : true (bool)
     tempSelector : false (bool)
pluginId : com.GlennNZ.indigoplugin.HomeKitLink-Siri
pluginProps : emptyDict : (dict)
protocol : Plugin
remoteDisplay : True
sharedProps : com.indigodomo.indigoserver : (dict)
states : States : (dict)
     QRCode : <div><h1>HomeKitLink Siri</h1>
   <p>  Indigo Plugin: Scan this QR Code to add HomeKitLink Siri Bridge to HomeKit</p>
   <img src="data:image/png;base64,REDACTED width="600" height="600"></div> (string)
     Status : Operational (string)
     pincode : REDACTED (string)
     uniqueID : REDACTED (string)
subModel : 
subType : 
supportsAllLightsOnOff : False
supportsAllOff : False
supportsOnState : False
supportsStatusRequest : False
version : None

If Camera Stream Related N/A

Additional context N/A

Ghawken commented 1 year ago

Thanks for the info. Sounds potentially like a bug if ContactSensor works but MotionSensor does not.

re: Delay - update to 0.6.27 - deals with some sources of delay. In releases tab here on github. That’s if haven’t already.

re: Motion Sensor Odd. Can you copy and paste the information about the motion sensor device you are publishing? (the DSC one) & version of DSC plugin (I’ll have a look at its code base as well)

[Edit]

I have had a look at code - and the motionSensor device currently doesn’t support other set states. I’m not entirely sure why - at first guess will be oversight on my part. Although if you set up the motionSensor device and uses its main sensorValue (which I would be guessing would be true or false) it should work - which is perhaps why this hasn’t come up before? Provided it is a sensor devices and has a sensorValue that is.. (the logging of motion sensor devices would confirm above is possible)

Thanks

joshsnelling commented 1 year ago

Thanks for the quick feedback. Here's one of the motion devices I've been trying to add. I'm using version v2022.0.6 of the DSC plugin.

address : 
batteryLevel : None
buttonGroupCount : 0
configured : True
description : Z34, 05 - Interior Stay/Away
deviceTypeId : alarmZone
displayStateId : state
displayStateImageSel : MotionSensor
displayStateValRaw : closed
displayStateValUi : closed
enabled : True
energyAccumBaseTime : None
energyAccumTimeDelta : None
energyAccumTotal : None
energyCurLevel : None
errorState : 
folderId : 1931361113
globalProps : MetaProps : (dict)
     com.GlennNZ.indigoplugin.HomeKitLink-Siri : (dict)
          HomeKit_audioSelector :  (string)
          HomeKit_bridgeUniqueID :  (string)
          HomeKit_deviceSensor :  (string)
          HomeKit_deviceSubtype :  (string)
          HomeKit_inverseSelector :  (string)
          HomeKit_tempSelector :  (string)
          homekit-name :  (string)
     com.frightideas.indigoplugin.dscAlarm : (dict)
          occupancyGroup : 0 (integer)
          var : None (empty)
          zoneLogChanges : true (bool)
          zoneNumber : 34 (string)
          zonePartition : 1 (string)
          zoneType : zoneTypeMotion (string)
id : 668562228
lastChanged : 2023-10-22 17:17:34
lastSuccessfulComm : 2023-10-22 17:17:34
model : Alarm Zone
name : 34 - Kitchen Motion
ownerProps : com.frightideas.indigoplugin.dscAlarm : (dict)
     occupancyGroup : 0 (integer)
     var : None (empty)
     zoneLogChanges : true (bool)
     zoneNumber : 34 (string)
     zonePartition : 1 (string)
     zoneType : zoneTypeMotion (string)
pluginId : com.frightideas.indigoplugin.dscAlarm
pluginProps : emptyDict : (dict)
protocol : Plugin
remoteDisplay : True
sharedProps : com.indigodomo.indigoserver : (dict)
states : States : (dict)
     LastChangedShort : 1m (string)
     LastChangedTimer : 1 (integer)
     bypass : nobypass (string)
     bypass.bypassed : false (bool)
     bypass.nobypass : true (bool)
     state : closed (string)
     state.closed : true (bool)
     state.open : false (bool)
     state.tripped : false (bool)
subModel : 
subType : 
supportsAllLightsOnOff : False
supportsAllOff : False
supportsOnState : False
supportsStatusRequest : False
version : None
Ghawken commented 1 year ago

OK. Thanks

It is a custom device - so won't have the default sensorValue - which is why motion not working.

Should be simple matter of adding motion Sensor to the others sensors (as said not sure why not there already...).

Should have a new HKLS release within next 12 hours or so.

Thanks

Ghawken commented 1 year ago

Ok

Try 0.6.28 - there now just use the green Code button. I try to never commit any breaking changes..

Motion Sensor Was obviously one the first devices I supported (and started more in vein of could this be done) It was missing a few of the other sensors updates that the other - one-way sensor devices have - mainly the ability to be created from any Indigo boolean device.

Fixed in this update hopefully.

I believe I have worked around any breaking changes for other on Off relay type devices being Motion Sensors, without breaking other sensor types...

Please give it a test and let me know

Edit: Small issue with Z-Wave Motion Sensor devices... Fixing now

Thanks

Ghawken commented 1 year ago

Try 0.6.29

Fixed the Z-wave motion Sensor issue, hopefully not introducing update issues for other sensors (including temp etc.)

Thanks

joshsnelling commented 1 year ago

Thanks for the quick support and sorry for the delayed response on my side. I confirmed that the changes in version 0.6.29 appear to work as expected. I was able to integrate the motion sensors and automations run when triggered.

From my standpoint, your changes can be merged, but I'm not sure if you want others to test anything.

7RDR7 commented 1 year ago

It works on my system as well. I'm using the AD2USB Alarm Interface. Thanks!