tchellomello / python-ring-doorbell

Python Ring Door Bell is a library written in Python 3 that exposes the Ring.com devices as Python objects.
GNU Lesser General Public License v3.0
546 stars 169 forks source link

Feature Request: Motion Snooze Schedule Control #126

Open jsetton opened 5 years ago

jsetton commented 5 years ago

Control motion snooze schedules. This could be used to toggle motion alerts across all clients associated to a specific device.

Motion Schedule List

GET https://api.ring.com/clients_api/doorbots/<doorbotId>/motion_rules?api_version=11 HTTP/1.1
Authorization:  Bearer <token>
X-API-LANG: en
Hardware_ID:    <hardwareId>
User-Agent: Dalvik/2.1.0 (Linux; U; Android 9; Android SDK built for x86 Build/PSR1.180720.075)
Host:   api.ring.com
Connection: Keep-Alive
Accept-Encoding:    gzip

Motion Schedule Create

POST https://api.ring.com/clients_api/doorbots/<doorbotId>/motion_rules?api_version=11&motion_rule%5Btitle%5D=<title>&motion_rule%5Btime_range%5D%5Bstart_hour%5D=0&motion_rule%5Btime_range%5D%5Bstart_minute%5D=0&motion_rule%5Btime_range%5D%5Bend_hour%5D=23&motion_rule%5Btime_range%5D%5Bend_minute%5D=59&motion_rule%5Bactive%5D=true&motion_rule%5Bdays%5D%5Bmonday%5D=true&motion_rule%5Bdays%5D%5Btuesday%5D=true&motion_rule%5Bdays%5D%5Bwednesday%5D=true&motion_rule%5Bdays%5D%5Bthursday%5D=true&motion_rule%5Bdays%5D%5Bfriday%5D=true&motion_rule%5Bdays%5D%5Bsaturday%5D=true&motion_rule%5Bdays%5D%5Bsunday%5D=true HTTP/1.1
Authorization:  Bearer <token>
X-API-LANG: en
Hardware_ID:    <hardwareId>
Content-Type:   application/x-www-form-urlencoded
User-Agent: Dalvik/2.1.0 (Linux; U; Android 9; Android SDK built for x86 Build/PSR1.180720.075)
Host:   api.ring.com
Connection: Keep-Alive
Accept-Encoding:    gzip
Content-Length: 0

Motion Schedule Delete

DELETE https://api.ring.com/clients_api/doorbots/<doorbotId>/motion_rules/<ruleId>?api_version=11 HTTP/1.1
Authorization:  Bearer <token>
X-API-LANG: en
Hardware_ID:    <hardwareId>
Content-Type:   application/x-www-form-urlencoded
User-Agent: Dalvik/2.1.0 (Linux; U; Android 9; Android SDK built for x86 Build/PSR1.180720.075)
Host:   api.ring.com
Connection: Keep-Alive
Accept-Encoding:    gzip
Content-Length: 0

Motion Schedule Activate

PUT https://api.ring.com/clients_api/doorbots/<doorbotId>/motion_rules/<ruleId>/activate?api_version=11 HTTP/1.1
Authorization:  Bearer <token>
X-API-LANG: en
Hardware_ID:    <hardwareId>
Content-Type:   application/x-www-form-urlencoded
User-Agent: Dalvik/2.1.0 (Linux; U; Android 9; Android SDK built for x86 Build/PSR1.180720.075)
Host:   api.ring.com
Connection: Keep-Alive
Accept-Encoding:    gzip
Content-Length: 0

Motion Schedule Deactivate

PUT https://api.ring.com/clients_api/doorbots/<doorbotId>/motion_rules/<ruleId>/inactivate?api_version=11 HTTP/1.1
Authorization:  Bearer <token>
X-API-LANG: en
Hardware_ID:    <hardwareId>
Content-Type:   application/x-www-form-urlencoded
User-Agent: Dalvik/2.1.0 (Linux; U; Android 9; Android SDK built for x86 Build/PSR1.180720.075)
Host:   api.ring.com
Connection: Keep-Alive
Accept-Encoding:    gzip
Content-Length: 0
242Racing commented 5 years ago

I can get the "Motion Schedule List" working via Postman, but not "Motion Schedule Activate" or "Motion Schedule Deactivate". Any ideas?

jsetton commented 5 years ago

@242Racing I am not sure. Are you using the proper ruleId? Is "Motion Schedule Create" working?

242Racing commented 5 years ago

I can get these working: Motion Schedule List, Motion Schedule Create, Motion Schedule Activate. But not Motion Schedule Deactivate. Getting "404 Not Found". Apperently it doesn't like "...deactivate...".

242Racing commented 5 years ago

Found it! "inactivate" should it be.

jsetton commented 5 years ago

Good catch! I may have mistyped when formatting the original post. I have updated it.

freekeys commented 4 years ago

Hey! Thanks for all your work in this! Is this implemented?

jpveen commented 4 years ago

Is there a way to disable motion detect using this API ? And is there also an option to only disable motion-detect signal from chimes and apps while recording of motion is still possible? Would be great to be able to set motion-detect notifications ON and OFF using this API !

jsetton commented 4 years ago

Would be great to be able to set motion-detect notifications ON and OFF using this API !

You can only snooze #87 or toggle #125 motion alerts on a per app client basis defined by its hardware id. For global toggling, you will need to use scheduling part of this feature request. Basically, have an always disabled schedule already created, and enable it when you want to snooze the alerts and disable it when you want to receive alerts across all your clients.

Is there a way to disable motion detect using this API ?

If you are referring to controlling the camera recording capability, it is possible using the below API calls. This is the other way to globally toggle motion alerts but would lose recording in the process. As for the scheduling capability, these only work on the owner account.

Motion Detection Enable

PATCH https://api.ring.com/devices/v1/devices/<doorbotId>/settings HTTP/1.1
User-Agent: android:com.ringapp:3.22.3(26360453)
Hardware_ID:    <hardwareId>
X-API-LANG: en
Authorization:  Bearer <token>
app_brand:  ring
Content-Type:   application/json; charset=UTF-8
Content-Length: 53
Host:   api.ring.com
Connection: Keep-Alive
Accept-Encoding:    gzip
{
    "motion_settings": {
        "motion_detection_enabled": true
    }
}

Motion Detection Disable

PATCH https://api.ring.com/devices/v1/devices/<doorbotId>/settings HTTP/1.1
User-Agent: android:com.ringapp:3.22.3(26360453)
Hardware_ID:    <hardwareId>
X-API-LANG: en
Authorization:  Bearer <token>
app_brand:  ring
Content-Type:   application/json; charset=UTF-8
Content-Length: 54
Host:   api.ring.com
Connection: Keep-Alive
Accept-Encoding:    gzip
{
    "motion_settings": {
        "motion_detection_enabled": false
    }
}
sdb9696 commented 1 year ago

I have created PR https://github.com/tchellomello/python-ring-doorbell/pull/282 for the Motion Detection Enable/Disable feature mentioned above.

github-actions[bot] commented 4 months ago

There hasn't been any activity on this issue recently. This issue has been automatically marked as stale because of that. It will be closed if no further activity occurs. Please make sure to update to the latest ring_doorbell version and check if that solves the issue. Thank you for your contributions.