pyalarmdotcom / pyalarmdotcomajax

Python library for accessing Alarm.com services. Not affiliated with Alarm.com.
MIT License
11 stars 14 forks source link

Add Garage Door functionality #8

Closed notqualifiedforthis closed 3 years ago

notqualifiedforthis commented 3 years ago

Could someone integrate garage door open/close/status? I may give it a go myself but it would probably be weeks out. Thinking someone else may be able to implement faster.

Found the following on node-alarm-dot-com.

uvjustin commented 3 years ago

I don't have a garage door on my system so I don't know what the underlying JSON for that device type looks like. You can have a look at it yourself - the JSON data should be returned from the system status url at https://www.alarm.com/web/api/systems/systems/{your_system_id}. If you can get me the JSON data I can update the library. Otherwise, if you want to make a PR yourself you can have a look at what @hufman did for thermostats here: https://github.com/uvjustin/pyalarmdotcomajax/pull/7

notqualifiedforthis commented 3 years ago

JSON from system URL { "data": { "id": 4321, "type": "systems/system", "attributes": { "description": "Home", "hasSnapShotCameras": False, "supportsSecureArming": True, "remainingImageQuota": 0, "systemGroupName": "", "unitId": 1234 }, "relationships": { "partitions": { "data": [ { "id": "1234-127", "type": "devices/partition" } ], "meta": { "count": "1" } }, "locks": { "data": [], "meta": { "count": "0" } }, "accessControlAccessPointDevices": { "data": [], "meta": { "count": "0" } }, "cameras": { "data": [], "meta": { "count": "0" } }, "sdCardCameras": { "data": [], "meta": { "count": "0" } }, "garageDoors": { "data": [ { "id": "1234-1200", "type": "devices/garage-door" } ], "meta": { "count": "1" } }, "waterValves": { "data": [], "meta": { "count": "0" } }, "scenes": { "data": [ { "id": "5921766", "type": "automation/scene" }, { "id": "5921767", "type": "automation/scene" }, { "id": "5921768", "type": "automation/scene" }, { "id": "5921769", "type": "automation/scene" }, { "id": "14778643", "type": "automation/scene" } ], "meta": { "count": "5" } }, "sensors": { "data": [ { "id": "1234-3", "type": "devices/sensor" }, { "id": "1234-4", "type": "devices/sensor" }, { "id": "1234-1", "type": "devices/sensor" }, { "id": "1234-2", "type": "devices/sensor" } ], "meta": { "count": "4" } }, "waterSensors": { "data": [], "meta": { "count": "0" } }, "sumpPumps": { "data": [], "meta": { "count": "0" } }, "waterMeters": { "data": [], "meta": { "count": "0" } }, "lights": { "data": [], "meta": { "count": "0" } }, "x10Lights": { "data": [], "meta": { "count": "0" } }, "thermostats": { "data": [], "meta": { "count": "0" } }, "remoteTemperatureSensors": { "data": [], "meta": { "count": "0" } }, "commercialTemperatureSensors": { "data": [], "meta": { "count": "0" } }, "valveSwitches": { "data": [], "meta": { "count": "0" } }, "boilerControlSystem": { "data": None }, "geoDevices": { "data": [ { "id": "1234-2201", "type": "geolocation/geo-device" } ], "meta": { "count": "1" } }, "fences": { "data": [ { "id": "539298", "type": "geolocation/fence" } ], "meta": { "count": "1" } }, "imageSensors": { "data": [], "meta": { "count": "0" } }, "configuration": { "data": { "id": "4321", "type": "systems/configuration" } }, "shades": { "data": [], "meta": { "count": "0" } }, "gates": { "data": [], "meta": { "count": "0" } }, "switches": { "data": [], "meta": { "count": "0" } } } }, "included": [], "meta": { "transformer_version": "1.1" } }

Data from the garageDoors URL { "data": [ { "id": "1200", "type": "devices/garage-door", "attributes": { "state": 2, "desiredState": 2, "managedDeviceType": 3, "hasState": True, "canBeRenamed": True, "canBeDeleted": False, "canAccessWebSettings": False, "canAccessAppSettings": False, "webSettings": 1001, "macAddress": "", "manufacturer": "Linear Corp", "isOAuth": False, "isZWave": True, "isMalfunctioning": False, "canBeSaved": True, "canChangeDescription": True, "description": "Garage (ID: 2)", "deviceModelId": 2371, "canConfirmStateChange": True, "canReceiveCommands": True, "remoteCommandsEnabled": True, "hasPermissionToChangeState": True, "deviceIcon": { "icon": 320 }, "batteryLevelNull": None, "lowBattery": False, "criticalBattery": False }, "relationships": { "system": { "data": { "id": "1234", "type": "systems/system" } }, "stateInfo": { "data": { "id": "1200-2", "type": "devices/state-info" } } } } ], "included": [], "meta": { "transformer_version": "1.1" } }

notqualifiedforthis commented 3 years ago

I submit a pull request. FIRST ONE EVER!! I have it working locally and reporting up to Home Assistant successfully. I may pursue sending open and close commands later.

uvjustin commented 3 years ago

Thanks for the PR! My first PR was this year too while trying to improve a few things with my HA setup. It turned into a rabbit hole looking into random components and resulting in a lot of wasted hours 🤣. I will look at a PR for sending open/close garage commands, but generally I don't think it makes sense for this custom component to go too far into the home automation space. I think it makes more sense to pair your Z-wave devices directly to a Z-wave hub through Home Assistant rather than going through the ADC hub.