MisterWil / abodepy

A thin Python wrapper for the Abode alarm API
MIT License
50 stars 17 forks source link

Occupancy Sensor #26

Closed dawiyo closed 5 years ago

dawiyo commented 6 years ago

In case this helps

No motion

[{
  "id": "ZB:5f2401",
  "type_tag": "device_type.povs",
  "type": "Occupancy",
  "name": "Garage Occupancy",
  "area": "1",
  "zone": "10",
  "sort_order": "",
  "is_window": "",
  "bypass": "0",
  "schar_24hr": "0",
  "sresp_24hr": "0",
  "sresp_mode_0": "0",
  "sresp_entry_0": "0",
  "sresp_exit_0": "0",
  "group_name": "Ungrouped",
  "group_id": "1",
  "default_group_id": "1",
  "sort_id": "10000",
  "sresp_mode_1": "0",
  "sresp_entry_1": "0",
  "sresp_exit_1": "0",
  "sresp_mode_2": "0",
  "sresp_entry_2": "0",
  "sresp_exit_2": "0",
  "sresp_mode_3": "0",
  "uuid": "be29d39bfa7ea4e0add232c2d5fe5ebc",
  "sresp_entry_3": "0",
  "sresp_exit_3": "0",
  "sresp_mode_4": "0",
  "sresp_entry_4": "0",
  "sresp_exit_4": "0",
  "version": "POVS_00.00.03.18TC",
  "origin": "abode",
  "has_subscription": null,
  "control_url": "",
  "deep_link": null,
  "status_color": "#5cb85c",
  "faults": {
    "low_battery": 0,
    "tempered": 0,
    "supervision": 0,
    "out_of_order": 0,
    "no_response": 0
  },
  "status": "Online",
  "statuses": {
    "motion": "0"
  },
  "status_ex": "",
  "actions": [],
  "status_icons": [],
  "sresp_trigger": "0",
  "sresp_restore": "0",
  "occupancy_timer": "30",
  "sensitivity": "4",
  "model": "L1",
  "icon": "assets\/icons\/occupancy-sensor.svg"
}]

Motion detected

[{
  "id": "ZB:5f2401",
  "type_tag": "device_type.povs",
  "type": "Occupancy",
  "name": "Garage Occupancy",
  "area": "1",
  "zone": "10",
  "sort_order": "",
  "is_window": "",
  "bypass": "0",
  "schar_24hr": "0",
  "sresp_24hr": "0",
  "sresp_mode_0": "0",
  "sresp_entry_0": "0",
  "sresp_exit_0": "0",
  "group_name": "Ungrouped",
  "group_id": "1",
  "default_group_id": "1",
  "sort_id": "10000",
  "sresp_mode_1": "0",
  "sresp_entry_1": "0",
  "sresp_exit_1": "0",
  "sresp_mode_2": "0",
  "sresp_entry_2": "0",
  "sresp_exit_2": "0",
  "sresp_mode_3": "0",
  "uuid": "be29d39bfa7ea4e0add232c2d5fe5ebc",
  "sresp_entry_3": "0",
  "sresp_exit_3": "0",
  "sresp_mode_4": "0",
  "sresp_entry_4": "0",
  "sresp_exit_4": "0",
  "version": "POVS_00.00.03.18TC",
  "origin": "abode",
  "has_subscription": null,
  "control_url": "",
  "deep_link": null,
  "status_color": "#5cb85c",
  "faults": {
    "low_battery": 0,
    "tempered": 0,
    "supervision": 0,
    "out_of_order": 0,
    "no_response": 0
  },
  "status": "Motion Detected!",
  "statuses": {
    "motion": "1"
  },
  "status_ex": "",
  "actions": [],
  "status_icons": [],
  "sresp_trigger": "0",
  "sresp_restore": "0",
  "occupancy_timer": "30",
  "sensitivity": "4",
  "model": "L1",
  "icon": "assets\/icons\/occupancy-sensor.svg"
}]
dawiyo commented 6 years ago

Any movement on this?

SeattlePaulus commented 6 years ago

I have had an issue with this as well. Found that by changing the devices/binary_sensor.py file to check for STATUS_ONLINE instead of STATUS_OFFLINE I can get the binary sensor to trigger on a motion event. Looks like the binary sensors report that they are ONLINE at all times unless they are being triggered when they go to 'Motion Detected!' state for the Occupancy sensor.

jonasrosland commented 6 years ago

The solution by @SeattlePaulus worked for me too, so perhaps that could be included?

shred86 commented 5 years ago

Just made a pull request with this change. Tested with an Abode Indoor Motion sensor. According to Abode support, the indoor motion sensor is basically treated the same as the occupancy sensor as in both will report motion status even when Abode is in standby. The indoor motion sensor appears to have a cool down timer of 1 minute (not sure about the occupancy sensor as I don't have one). When you pair it to Abode, it also shows up as an occupancy sensor.

Edit: So by simply changing STATUS_OFFLINE to STATUS_ONLINE in the return statement, it works but key fobs and water sensors show the incorrect state. I committed a change that checks if the device is an occupancy sensor and if it is, then return the state if the status is not STATUS_ONLINE.

MisterWil commented 5 years ago

Fixed with #40 and released in abodepy-0.15.0