pyalarmdotcom / alarmdotcom

Custom component to allow Home Assistant to interface with Alarm.com
MIT License
115 stars 35 forks source link

Camera support #101

Open AritroSaha10 opened 2 years ago

AritroSaha10 commented 2 years ago

Which device would you like us to support? Outdoor Camera (ADC-V723): https://www.telus.com/en/smarthome-security/security-system-products/security-outdoor-camera

Where does this device appear in the Alarm.com mobile app? Video

What types of actions does this device support? E.g.: Garage doors support opening and closing. Alarm systems support arming (home, away, and night modes) and disarming.

Which provider do you use? Telus (formerly ADT Canada)

Include pyalarmdotcomajax Server Output No information regarding the camera after running adc -u USERNAME -p PASSWORD.

Include Action Endpoints Base URL: https://www.alarm.com/web/api/video Take snapshot suffix: snapshots/<camera-id> Request recording suffix: requestRecording?id=<camera-id>

Some other (probably useful) endpoints WebRTC sources suffix (GET): liveVideoHighestResSources/<camera-id> WebRTC initial stream log send (POST): streamLogs/webrtcStreamLogs/sendInitialWebrtcStreamLog Attributes of all cameras (GET): cameras

elahd commented 2 years ago

@AritroSaha10 There is a pretty popular WebRTC component for Home Assistant: https://github.com/AlexxIT/WebRTC. Other integrations use this component to display their streams. This is probably a good candidate for integration with ADC cameras. I don't have an ADC camera, though, so I'd be looking to you to drive this effort.

There are two obvious approaches here:

  1. Access the stream made available via the Alarm.com API (looks like you already identified the endpoints). This is probably the more stable approach.
  2. Access the camera directly using the approach outlined in https://github.com/uvjustin/alarmdotcom/issues/50#issuecomment-1019305600. This is probably more resilient as this approach lets you access the cameras over your LAN.
AritroSaha10 commented 2 years ago

I'll try to use the WebRTC component code, thanks. Though, I believe the 2nd method might not be possible since some camera's don't use MJPEG (ex. the ADC-V723, the one I have).

However, it might be possible to use RTSP with some work. I did some digging and found out that there is a feature on the Qolsys IQ Panel 2 where you can stream the camera to it directly (?). It says that both of them must be on the same network for the feature to work, so it implies something direct between the two devices? If the traffic between both can be intercepted with Wireshark, it might yield the RTSP user/pass. However, this wouldn't work as a plug-and-play solution for the integration.

Right now, I'm trying to figure out how to get the stream working through Alarm.com, but I'm not completely where to start as I'm unfamiliar with WebRTC, and I don't know how I can use the TURN/STUN servers and Janus webhooks provided by the endpoints to view the stream anywhere else than the alarm.com website. In addition, it seems like the proxy url is encrypted? Not sure where to start with that either.

maol01 commented 1 year ago

I would like support for the motiondetector with camera

elahd commented 1 year ago

Posting data provided by @karthikmannem1991:

ADC-V723x (#217):

https://www.alarmsystemstore.com/products/alarm-com-adc-v723-outdoor-1080p-wi-fi-camera

{
    "data": [
        {
            "id": "102347524-2049",
            "type": "video/devices/camera",
            "attributes": {
                "supportsSnapShot": true,
                "canTakeSnapshot": true,
                "supportsRecording": true,
                "canRequestRecording": true,
                "canUploadClips": true,
                "maxSvrClipDownloadDurationSec": 3600,
                "username": "123",
                "hasSvrSchedule": false,
                "onvifParentId": null,
                "excludedFromVisualVerification": false,
                "excludedFromEscalatedEvents": false,
                "liveViewHdToggleEnabled": true,
                "supportsEndToEndWebRTCStreaming": true,
                "supports4MPStreaming": false,
                "supportsSiren": false,
                "canSirenBeActivatedByLogin": false,
                "isSirenEnabledInSettings": false,
                "isSirenPlaying": false,
                "osdOverlayEnabled": false,
                "canPanTilt": false,
                "maxPanTiltLevel": 0,
                "canZoom": false,
                "maxZoomLevel": 0,
                "minZoomLevelForPanTilt": 0,
                "panTiltPresets": [],
                "preferredPanTiltPreset": null,
                "isUnreachable": false,
                "lastSuccessfulSupervision": "2023-02-24T13:13:46.957Z",
                "canStreamToPanel": true,
                "canChangeStreamToPanel": true,
                "canStreamToPanelBeEnabled": true,
                "isStreamToPanelEnabled": true,
                "doorbellChimeType": -1,
                "supportedDoorbellWedgeOptions": null,
                "doorbellWedgeType": 0,
                "supportsWedgeYesNo": false,
                "supportsWedgeGIF": false,
                "supportsVmdSchedules": true,
                "deviceImagePath": "/web/webimages/camera_images/V723_64px.png?v=2",
                "deviceModel": "ADC-V723X",
                "macAddress": "xxxxxxxxxx",
                "firmwareVersion": "0.6.6.770",
                "publicIp": "xxxxxxxxxx",
                "privateIp": "xxxxxxxx",
                "port": "40926",
                "httpsPort": "41926",
                "shouldUseEntireImageForSnapshot": false,
                "hasDdnsed": true,
                "usageProtocolMapping": {
                    "18": 1,
                    "9": 1,
                    "10": 1,
                    "6": 1,
                    "20": 1
                },
                "isVirtualCamera": false,
                "isVarifocalCamera": false,
                "hasSdRecordingSchedule": false,
                "isBatteryCameraAndUsingGatewayForBackendAccess": false,
                "supportsLiveView": true,
                "forcedAspectRatio": 1.77777779,
                "canBeSaved": false,
                "canChangeDescription": false,
                "description": "myCamera",
                "deviceModelId": 0,
                "canConfirmStateChange": false,
                "canReceiveCommands": false,
                "remoteCommandsEnabled": false,
                "hasPermissionToChangeState": false,
                "deviceIcon": {
                    "icon": 27
                },
                "batteryLevelNull": null,
                "lowBattery": false,
                "criticalBattery": false
            },
            "relationships": {
                "videoEvents": {
                    "data": [],
                    "meta": {
                        "count": "0"
                    }
                },
                "password": {
                    "data": {
                        "id": "102347524-2049",
                        "type": "video/cameraPassword"
                    }
                },
                "videoSource": {
                    "data": {
                        "id": "102347524-2049",
                        "type": "video/videoSources/liveVideoSource"
                    }
                },
                "videoSourceHd": {
                    "data": {
                        "id": "102347524-2049",
                        "type": "video/videoSources/liveVideoHighestResSource"
                    }
                },
                "svrVideoSource": {
                    "data": {
                        "id": "102347524-2049",
                        "type": "video/videoSources/svrVideoSource"
                    }
                },
                "svrScrubberThumbnailEndpoint": {
                    "data": {
                        "id": "102347524-2049",
                        "type": "video/svrThumbnailEndpoint"
                    }
                },
                "cameraSiren": {
                    "data": null
                },
                "liveVideoSetting": {
                    "data": {
                        "id": "102347524-2049",
                        "type": "video/live-video-setting"
                    }
                },
                "snapshot": {
                    "data": {
                        "id": "102347524-2049",
                        "type": "video/snapshot"
                    }
                },
                "privacyZonesSetting": {
                    "data": {
                        "id": "102347524-2049",
                        "type": "video/privacy-zones-setting"
                    }
                },
                "system": {
                    "data": {
                        "id": "12385880",
                        "type": "systems/system"
                    }
                },
                "stateInfo": {
                    "data": null
                }
            }
        }
    ],
    "included": [],
    "meta": {
        "transformer_version": "1.1"
    }
}

ADC-VDB780B (#216)

https://doorbell.poweredbyalarm.com/vdb780b-install/

{
            "id": "102347524-2051",
            "type": "video/devices/camera",
            "attributes": {
                "supportsSnapShot": true,
                "canTakeSnapshot": true,
                "supportsRecording": true,
                "canRequestRecording": true,
                "canUploadClips": true,
                "maxSvrClipDownloadDurationSec": 3600,
                "username": "123",
                "hasSvrSchedule": false,
                "onvifParentId": null,
                "excludedFromVisualVerification": false,
                "excludedFromEscalatedEvents": false,
                "liveViewHdToggleEnabled": true,
                "supportsEndToEndWebRTCStreaming": false,
                "supports4MPStreaming": false,
                "supportsSiren": false,
                "canSirenBeActivatedByLogin": false,
                "isSirenEnabledInSettings": false,
                "isSirenPlaying": false,
                "osdOverlayEnabled": false,
                "canPanTilt": false,
                "maxPanTiltLevel": 0,
                "canZoom": false,
                "maxZoomLevel": 0,
                "minZoomLevelForPanTilt": 0,
                "panTiltPresets": [],
                "preferredPanTiltPreset": null,
                "isUnreachable": false,
                "lastSuccessfulSupervision": "2023-02-12T02:20:36.293Z",
                "canStreamToPanel": true,
                "canChangeStreamToPanel": true,
                "canStreamToPanelBeEnabled": true,
                "isStreamToPanelEnabled": true,
                "doorbellChimeType": 1,
                "supportedDoorbellWedgeOptions": null,
                "doorbellWedgeType": 0,
                "supportsWedgeYesNo": false,
                "supportsWedgeGIF": false,
                "supportsVmdSchedules": false,
                "deviceImagePath": "/web/webimages/camera_images/VDB780B_64px.png?v=2",
                "deviceModel": "ADC-VDB780B",
                "macAddress": "xxxxxxxxxxx",
                "firmwareVersion": "2.4.1.081",
                "publicIp": "xxxxxxxxx",
                "privateIp": "xxxxxxxxx",
                "port": "80",
                "httpsPort": "443",
                "shouldUseEntireImageForSnapshot": false,
                "hasDdnsed": false,
                "usageProtocolMapping": {
                    "18": 1,
                    "9": 1,
                    "10": 1,
                    "6": 1,
                    "20": 1
                },
                "isVirtualCamera": false,
                "isVarifocalCamera": false,
                "hasSdRecordingSchedule": false,
                "isBatteryCameraAndUsingGatewayForBackendAccess": true,
                "supportsLiveView": true,
                "forcedAspectRatio": null,
                "canBeSaved": false,
                "canChangeDescription": false,
                "description": "Doorbell",
                "deviceModelId": 0,
                "canConfirmStateChange": false,
                "canReceiveCommands": false,
                "remoteCommandsEnabled": false,
                "hasPermissionToChangeState": false,
                "deviceIcon": {
                    "icon": 27
                },
                "batteryLevelNull": null,
                "lowBattery": false,
                "criticalBattery": false
            },
            "relationships": {
                "videoEvents": {
                    "data": [],
                    "meta": {
                        "count": "0"
                    }
                },
                "password": {
                    "data": {
                        "id": "102347524-2051",
                        "type": "video/cameraPassword"
                    }
                },
                "videoSource": {
                    "data": {
                        "id": "102347524-2051",
                        "type": "video/videoSources/liveVideoSource"
                    }
                },
                "videoSourceHd": {
                    "data": {
                        "id": "102347524-2051",
                        "type": "video/videoSources/liveVideoHighestResSource"
                    }
                },
                "svrVideoSource": {
                    "data": {
                        "id": "102347524-2051",
                        "type": "video/videoSources/svrVideoSource"
                    }
                },
                "svrScrubberThumbnailEndpoint": {
                    "data": {
                        "id": "102347524-2051",
                        "type": "video/svrThumbnailEndpoint"
                    }
                },
                "cameraSiren": {
                    "data": null
                },
                "liveVideoSetting": {
                    "data": {
                        "id": "102347524-2051",
                        "type": "video/live-video-setting"
                    }
                },
                "snapshot": {
                    "data": {
                        "id": "102347524-2051",
                        "type": "video/snapshot"
                    }
                },
                "privacyZonesSetting": {
                    "data": null
                },
                "system": {
                    "data": {
                        "id": "12385880",
                        "type": "systems/system"
                    }
                },
                "stateInfo": {
                    "data": null
                }
            }
        },
ifeign commented 6 months ago

This might be of interest to you

Notes: the web viewer makes a call to https://www.alarm.com/web/api/video/videoSources/liveVideoHighestResSources/<CAM-ID> and receives a response which includes proxyUrl under it's attributes. This proxy url can be used to view the camera live through ADC's servers.