MisterWil / abodepy

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

Occupancy Sensor #45

Closed milad-soufastai closed 4 years ago

milad-soufastai commented 5 years ago

Looks like the Occupancy Sensor and the Temperature,Humidity, and Light sensor are considered the same so I see an error in my HA logs on every restart since the Occupancy Sensor doesn't provide Humidity information. Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 352, in _async_add_entity await entity.async_update_ha_state() File "/usr/src/app/homeassistant/helpers/entity.py", line 244, in async_update_ha_state unit_of_measurement = self.unit_of_measurement File "/usr/src/app/homeassistant/components/abode/sensor.py", line 76, in unit_of_measurement return self._device.humidity_unit File "/usr/local/lib/python3.7/site-packages/abodepy/devices/sensor.py", line 44, in humidity_unit if CONST.UNIT_PERCENT in self._get_status(CONST.HUMI_STATUS_KEY): TypeError: argument of type 'NoneType' is not iterable

pmcelreavy commented 4 years ago

I am seeing the same issue.

shred86 commented 4 years ago

Does the occupancy sensor actually report humidity in Abode? According to the website, it's supposed to.

Can someone post the JSON data for the occupancy sensor?

milad-soufastai commented 4 years ago

@shred86 Pulled a couple months ago but:

{
    "id": "ZB:322b02",
    "type_tag": "device_type.lm",
    "type": "LM",
    "name": "Occupancy 1",
    "area": "1",
    "zone": "12",
    "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": "Upstairs",
    "group_id": "382793",
    "default_group_id": "1",
    "sort_id": "4",
    "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": "8ee12272b14b709e93732b9aecaff0ff",
    "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,
    "onboard": "0",
    "s2_grnt_keys": "",
    "s2_dsk": "",
    "s2_propty": "",
    "s2_keys_valid": "",
    "zwave_secure_protocol": "",
    "control_url": "",
    "deep_link": null,
    "status_color": "#5cb85c",
    "faults": {
        "low_battery": 0,
        "tempered": 0,
        "supervision": 0,
        "out_of_order": 0,
        "no_response": 0,
        "jammed": 0,
        "zwave_fault": 0
    },
    "status": "70 \u00b0F",
    "statuses": {
        "temperature": "70 \u00b0F",
        "temp": "21.06",
        "lux": "9 lx"
    },
    "status_ex": "",
    "actions": [{
        "label": "High Temperature Alarm",
        "value": "a=1&z=12&trigger=TSH;"
    }, {
        "label": "Low Temperature Alarm",
        "value": "a=1&z=12&trigger=TSL;"
    }],
    "status_icons": [],
    "statusEx": "9",
    "icon": "assets\/icons\/occupancy-sensor.svg"
}, {
    "id": "ZB:322b01",
    "type_tag": "device_type.povs",
    "type": "Occupancy",
    "name": "Occupancy 1",
    "area": "1",
    "zone": "13",
    "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": "Upstairs",
    "group_id": "382793",
    "default_group_id": "1",
    "sort_id": "5",
    "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": "c3cca78a0c9c37db565f7feabd70fa4c",
    "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,
    "onboard": "0",
    "s2_grnt_keys": "",
    "s2_dsk": "",
    "s2_propty": "",
    "s2_keys_valid": "",
    "zwave_secure_protocol": "",
    "control_url": "",
    "deep_link": null,
    "status_color": "#5cb85c",
    "faults": {
        "low_battery": 0,
        "tempered": 0,
        "supervision": 0,
        "out_of_order": 0,
        "no_response": 0,
        "jammed": 0,
        "zwave_fault": 0
    },
    "status": "Online",
    "statuses": {
        "motion": "0"
    },
    "status_ex": "",
    "actions": [],
    "status_icons": [],
    "sresp_trigger": "0",
    "sresp_restore": "0",
    "occupancy_timer": "30",
    "sensitivity": "4",
    "model": "L1",
    "is_motion_sensor": false,
    "icon": "assets\/icons\/motioncamera-a.svg"
}

It doesn't report humidity

shred86 commented 4 years ago

~Hm, so there must be two versions of the Occupancy sensor. The latest one on their website reports humidity, lux and temp. Does anyone have the JSON for that one?~

Edit: Nevermind, I was confusing the actual temp/humidity/lux sensor with the occupancy sensor. So it looks like the temp/humidity/lux sensor is no longer sold. That device reports temp, humidity and lux. The occupancy sensor, which is currently being sold, is supposed to report motion, temp, lux and humidity according to their website. Based on the JSON data, it looks like it actually doesn't report humidity.

Edit 2: Based on this reddit post, it appears there is an occupancy sensor that reports motion, temp and lux, and also a multi sensor which reports motion, temp, lux and humidity. The devices look identical, and the link on the Abode website for both devices goes to the same page. It sounds like the multi sensor is replacing the occupancy sensor. This explains why some folks are seeing humidity and others are not.

I suppose we could just check what is being reported in the statuses key and add only the ones that are actually reported. Probably a better way to do it anyways as right now in the Abode component in Home Assistant, it's just adding all three without any checks.

shred86 commented 4 years ago

@MisterWil This should be resolved with: https://github.com/home-assistant/home-assistant/pull/28516