BewhiskeredBard / homebridge-scout

A Homebridge plugin that enables HomeKit integration for the Scout security system.
MIT License
4 stars 2 forks source link

Incorrect HomeKit services/characteristics added for v1 Scout hardware #40

Closed Tom2527 closed 4 years ago

Tom2527 commented 4 years ago

Each Scout Access Sensor in my home is exposed as two tiles: a contact sensor and a temperature sensor. I have no idea why there is a temperature sensor because as far as I know this sensor is not present in the hardware. At the moment all my Scout related tiles (both contact sensor and temperature) are listed as "Fault Detected" without any further explanation. I cannot find any related info in the log files.

UPDATE: I just read on the Scout website the current contact sensors do indeed have a temperature sensor. As far as I know, I have version 1 and these don't include this sensor. (Firmware 1.3.6) The contact sensor tiles work perfectly in HomeKit (despite the Fault Detected error). Maybe as a solution there could be an option to exclude the temperature tile in HomeKit?

BewhiskeredBard commented 4 years ago

Thanks for the bug report! I exchanged my v1 system recently, so I’ve only been able to test with v2 sensors.

I do have one question: Is this a problem for access sensors exclusively, or for door panels as well?

I think there’s a couple of approaches I might take with this:

  1. Add an option to hide temperature and humidity sensors from access sensors and door panels. No clue if motion sensors might also have these.

  2. Find a way to determine if the hardware supports temperature/humidity before adding those services to the accessory.

Tom2527 commented 4 years ago

Hi, this also affects door panels.

I would go for the easy way and allow the user to add an option “v1” in the config file. As old and new sensors are not mixed in one system I don’t really see the need to detect them automatically. It’s a one time thing.

You could consider adding options to hide access sensors tiles, temperature tiles, ... from HomeKit for people who don’t want to clutter the Home app. But that’s just a nice to have.

BewhiskeredBard commented 4 years ago

I’m hesitant to add any unnecessary configuration options and would rather have things “just work”.

Are you familiar with using web browser dev tools, like to inspect the response of an XHR request from a web page? If so, would you be willing to log into the Scout dashboard and copy the response body of the GET /locations/{locationId}/devices request (where {locationId} is either a UUID or string of seemingly random characters)?

Tom2527 commented 4 years ago

I can do that, but if it would help I can also make a temp account for my scout panel. It also gives the opportunity to look into supporting motion sensors.

BewhiskeredBard commented 4 years ago

Getting a one-time dump from the devices request would probably be sufficient, but if you're willing to do that, it would definitely make it easier for me to debug and test. The best way to get in touch directly would probably be via the Homebridge Slack or Twitter.

Tom2527 commented 4 years ago

No problem. I can’t DM you on Twitter though as it says I can’t message this account. I’m now on the Homebridge Slack, but can’t see you there.

BewhiskeredBard commented 4 years ago

I'm in the #homebridge-scout channel.

Alternatively, I've just pushed a new version (0.2.5) that adds debug logging, so if you run homebridge --debug and send me the line starting with [ScoutAlarm] Devices:, that would give me all the details I would need.

Tom2527 commented 4 years ago

here you go:

[
  {
    "version": "01D03D06",
    "reported": {
      "mesh_address": 0,
      "hw_version": "1.0.0",
      "timedout": false,
      "channel": 26,
      "trigger": {
        "at": "2019-12-31T14:53:45.473Z",
        "state": "close"
      },
      "battery": {
        "low": null
      },
      "fw_version": "1.3.6",
      "uptime": 5129072
    },
    "mode_ids": [
      "54ca4d1c671a816b55000039",
      "54ca4d86671a81ce96000033",
      "5688fc4da1cb3442eb000338"
    ],
    "created": "2017-12-14T16:42:26.000Z",
    "name": "Front Door",
    "updated": "2017-12-14T16:46:56.074Z",
    "desired": {
      "chirp": {
        "enabled": false
      },
      "chirps": {
        "hub": true
      }
    },
    "pro_monitoring_label": "006",
    "heartbeat": 1577804189221,
    "location_id": "54ca3b40935b88c780000006",
    "hub_id": "0a70080064100452904ba000a0000100",
    "id": "0a70080064100452584da000a0000100",
    "type": "door_panel"
  },
  {
    "version": "01D03D06",
    "reported": {
      "mesh_address": 5,
      "timedout": false,
      "channel": 0,
      "trigger": {
        "at": "2019-12-31T09:55:02.216Z",
        "state": "open"
      },
      "battery": {
        "low": "2019-12-27T16:01:37.773Z"
      },
      "fw_version": "1.3.6",
      "uptime": 160344
    },
    "mode_ids": [
      "54ca4d86671a81ce96000033",
      "5688fc4da1cb3442eb000338"
    ],
    "created": "2015-01-29T16:00:52.710Z",
    "name": "Bedroom Window",
    "updated": "2017-12-14T18:43:47.820Z",
    "desired": {},
    "pro_monitoring_label": "006",
    "heartbeat": 1577804353168,
    "location_id": "54ca3b40935b88c780000006",
    "hub_id": "0a70080064100452904ba000a0000100",
    "id": "0a700800641004522822a000a0000100",
    "type": "access_sensor"
  },
  {
    "version": "01D03D06",
    "reported": {
      "mesh_address": 3,
      "timedout": false,
      "channel": 0,
      "trigger": {
        "at": "2019-10-14T18:14:34.894Z",
        "state": "close"
      },
      "battery": {
        "low": "2019-06-09T02:01:58.734Z"
      },
      "fw_version": "1.3.6",
      "uptime": 167644
    },
    "mode_ids": [
      "54ca4d1c671a816b55000039",
      "54ca4d86671a81ce96000033",
      "5688fc4da1cb3442eb000338"
    ],
    "created": "2015-01-29T15:53:15.253Z",
    "name": "Garage",
    "updated": "2017-03-27T15:45:05.065Z",
    "desired": {},
    "pro_monitoring_label": "004",
    "heartbeat": 1577804877430,
    "location_id": "54ca3b40935b88c780000006",
    "hub_id": "0a70080064100452904ba000a0000100",
    "id": "0a7008006410045100e4a000a0000100",
    "type": "access_sensor"
  },
  {
    "version": "01D03D06",
    "reported": {
      "mesh_address": 1,
      "timedout": false,
      "channel": 0,
      "trigger": {
        "at": "2019-12-31T09:23:06.532Z",
        "state": "close"
      },
      "battery": {
        "low": "2019-11-19T02:04:26.026Z"
      },
      "fw_version": "1.3.6",
      "uptime": 168660
    },
    "mode_ids": [
      "54ca4d1c671a816b55000039",
      "54ca4d86671a81ce96000033",
      "5688fc4da1cb3442eb000338"
    ],
    "created": "2015-01-29T14:59:35.868Z",
    "name": "Kitchen Door",
    "updated": "2017-07-02T14:28:58.511Z",
    "desired": {
      "chirps": {
        "hub": false
      }
    },
    "pro_monitoring_label": "002",
    "heartbeat": 1577805795747,
    "location_id": "54ca3b40935b88c780000006",
    "hub_id": "0a70080064100452904ba000a0000100",
    "id": "0a700800641004526842a000a0000100",
    "type": "access_sensor"
  },
  {
    "version": "01D03D06",
    "reported": {
      "mesh_address": 4,
      "timedout": false,
      "channel": 0,
      "trigger": {
        "at": "2019-12-31T09:05:53.282Z",
        "state": "close"
      },
      "battery": {
        "low": "2019-10-31T06:04:05.491Z"
      },
      "fw_version": "1.3.6",
      "uptime": 169180
    },
    "mode_ids": [
      "54ca4d86671a81ce96000033",
      "5688fc4da1cb3442eb000338"
    ],
    "created": "2015-01-29T15:54:49.039Z",
    "name": "Room Arthur",
    "updated": "2019-05-05T10:04:05.558Z",
    "desired": {
      "chirps": {
        "hub": false
      }
    },
    "pro_monitoring_label": "005",
    "heartbeat": 1577806417334,
    "location_id": "54ca3b40935b88c780000006",
    "hub_id": "0a70080064100452904ba000a0000100",
    "id": "0a70080064100451c025a000a0000100",
    "type": "access_sensor"
  },
  {
    "version": "01D02D02",
    "reported": {
      "mesh_address": 2,
      "timedout": false,
      "channel": 0,
      "trigger": {
        "state": "motion_stop"
      },
      "battery": {
        "low": null
      },
      "fw_version": "1.2.2",
      "uptime": 20412
    },
    "mode_ids": [
      "5688fc4da1cb3442eb000338"
    ],
    "created": "2015-01-29T15:50:23.475Z",
    "name": "Motion Sensor",
    "updated": "2017-12-14T18:44:06.996Z",
    "desired": {},
    "pro_monitoring_label": "003",
    "heartbeat": 1577805270609,
    "location_id": "54ca3b40935b88c780000006",
    "hub_id": "0a70080064100452904ba000a0000100",
    "id": "0a70080064100450d80fa000a0000100",
    "type": "motion_sensor"
  }
]
BewhiskeredBard commented 4 years ago

This is super helpful — thank you! There are a bunch of differences between the data reported for v1 and v2 accessories. Aside from temperature and humidity, the v1 hardware also doesn't report a tamper state or a manufacturer, and it reports the model number in a different field.

It's going to require a little refactoring, but I can make the plug-in automatically determine which HomeKit services/characteristics to assign to each accessory based on the available data. I'll let you know when I have something to test.

Tom2527 commented 4 years ago

Great, I look forward to it. Just wanted to let you know that the main security system tile also indicates the temperature. It's set to 0 degrees and doesn't cause any errors.

BewhiskeredBard commented 4 years ago

In that case, could you also send over the matching [ScoutAlarm] Hub: line from the debug logs? The hub is treated as a different sort of beast by the Scout API.

BewhiskeredBard commented 4 years ago

Pull request #42 should fix all of the non-hub issues. Feel free to test:

git clone -b v1 https://github.com/jordanryanmoore/homebridge-scout.git && \
cd homebridge-scout && \
npm install -g
Tom2527 commented 4 years ago

Seems to work fine. Great job.

BewhiskeredBard commented 4 years ago

So, just to confirm… you don’t see the temperature or humidity accessories any more (except for the hub)? And no faults?

Tom2527 commented 4 years ago

I still see the temperature (0 degrees) on the security tile (underneath the arm options). But it doesn’t give an error. Would be nice to hide that one as well. All the other tiles work fine. All my tiles do give the low battery warning, but that is correct (issue with Scout) so unless that hides another warning, it all seems to work perfectly fine. I do notice that the status “open” or “closed” is marked as red on each tile. Not sure if that’s normal or a result of the low battery warning.

BewhiskeredBard commented 4 years ago

I still see the temperature (0 degrees) on the security tile (underneath the arm options). But it doesn’t give an error. Would be nice to hide that one as well.

Yeah, I haven't fixed that yet, but I intend to.

All the other tiles work fine. All my tiles do give the low battery warning, but that is correct (issue with Scout) so unless that hides another warning, it all seems to work perfectly fine.

👍

I do notice that the status “open” or “closed” is marked as red on each tile. Not sure if that’s normal or a result of the low battery warning.

Based on what I've experienced with official HomeKit devices, if an accessory has low battery or a fault, the status is red, so this is what I would expect.

BewhiskeredBard commented 4 years ago

@Tom2527, if there's any chance you could send over the [ScoutAlarm] Hub: debug log line at some point, it would be much appreciated. 🙂

Tom2527 commented 4 years ago
{
  "version": "01D03D06",
  "reported": {
    "connection": {
      "remote": {
        "port": 1151,
        "ip": "212.233.9.70"
      }
    },
    "battery": {
      "level": 255,
      "active": false
    },
    "fw_version": "1.3.6",
    "cellular": {
      "model_version": "LISA-U200",
      "iccid": "99999999999999999999",
      "strength": {
        "rssi": "no signal",
        "ber": 99
      },
      "coordinates": {},
      "active": false,
      "imei": "352648062322490",
      "imsi": "+CME ERROR: SIM",
      "fw_version": "22.90",
      "cgmi": "u-blox",
      "sim_state": "canceled"
    },
    "status": "active",
    "uptime": 19721496
  },
  "created": "2015-03-16T19:11:49.479Z",
  "serial_number": "BS4090000107",
  "updated": "2019-01-15T19:03:56.300Z",
  "desired": {
    "siren": {
      "on": false
    },
    "chirp": "off"
  },
  "heartbeat": 1577811627279,
  "location_id": "54ca3b40935b88c780000006",
  "id": "0a70080064100452904ba000a0000100",
  "install_code": "19CDF2",
  "type": "scout1"
}
BewhiskeredBard commented 4 years ago

Thanks! I’ll try to get a new release out later today with all the v1 fixes.

BewhiskeredBard commented 4 years ago

For the record, the notable hub differences are:

BewhiskeredBard commented 4 years ago

The fixes for #40 and #44 were released in 0.4.0. Thanks again, @Tom2527!

https://github.com/jordanryanmoore/homebridge-scout#user-content-credits

Tom2527 commented 4 years ago

I do have one strange issue where the open and closed states of the door panel and some contact sensors is switched. When I open a door the homekit tile shows it as closed and vice versa. I'll do some more testing to find out if it's the plugin or ScoutAlarm being good old unreliable ScoutAlarm. Could you in a next update add more logging for triggering events? Now it's states "triggered event fired". Could you add the open/closed state as well?

BewhiskeredBard commented 4 years ago

Well, that's not good.

The logs will have the entire event object if you have debugging enabled (tagged with [ScoutAlarm] Device Event:).