timcharper / homebridge-vivint

Integrates Vivint security system with Apple Home
Other
33 stars 34 forks source link

Additional support Glass Break and Motion Detector #16

Open kotahukka opened 5 years ago

kotahukka commented 5 years ago

Would it be possible to get support for the motion detector and glass break? Also any idea what is causing the other "Do not know how to handle device" errors?

Jul 3 14:52:57 Library homebridge[4920]: [2019-7-3 14:52:57] [Vivint] Do not know how to handle device! ID: 20003 Data.t: scheduler_service data.ec: undefined Data.n: undefined Jul 3 14:52:57 Library homebridge[4920]: [2019-7-3 14:52:57] [Vivint] Do not know how to handle device! ID: 5 Data.t: energy_service data.ec: undefined Data.n: undefined Jul 3 14:52:57 Library homebridge[4920]: [2019-7-3 14:52:57] [Vivint] Do not know how to handle device! ID: 12 Data.t: network_hosts_service data.ec: undefined Data.n: undefined Jul 3 14:52:57 Library homebridge[4920]: [2019-7-3 14:52:57] [Vivint] Do not know how to handle device! ID: 13 Data.t: panel_diagnostics_service data.ec: undefined Data.n: undefined Jul 3 14:52:57 Library homebridge[4920]: [2019-7-3 14:52:57] [Vivint] Do not know how to handle device! ID: 32 Data.t: wireless_sensor data.ec: 475 Data.n: Living Room Glass Break Jul 3 14:52:57 Library homebridge[4920]: [2019-7-3 14:52:57] [Vivint] Do not know how to handle device! ID: 33 Data.t: wireless_sensor data.ec: 609 Data.n: Living Room Motion Detector

daymondm commented 5 years ago

Glass break detectors can be added, but I'd advise against it: the event stream is some times unreliable so receiving an immediate notification when a sensor is activated is not always possible. You'd receive the update when the snapshot is updated at the interval specified in the config file. At that point, using Vivint's app to manage the security of your home would be a better choice.

The Do not know how to handle device messages you are seeing are not errors, they are simply telling you that there are other devices that support could be added for. Its useful debugging information.

It looks like that motion sensor you are using with your vivint sensor is not one that is supplied from Vivint (or at least a different model than was supplied when the plugin was added). To add support for your motion sensor, you would simply need to modify the following line:

  extend(MotionSensor, {
    appliesTo: (data) => {
      return ((data.t == "wireless_sensor") && ((data.ec == 1249) || (data.ec == 1249))
    },

(side note - not sure why 1249 is mentioned twice on this line) to:

  extend(MotionSensor, {
    appliesTo: (data) => {
      return ((data.t == "wireless_sensor") && ((data.ec == 1249) || (data.ec == 609))
    },

Its on line 347 of device_set.js if my copy is still the same as what is posted here

balansse commented 4 years ago

@kotahukka check out my fork. I added the support for more devices, including Glass Break detectors and fire alarm sensors.