KoenZomers / RingApi

Api in .NET 6 to communicate with the Ring Doorbell services
38 stars 18 forks source link

[FEATURE REQUEST] Update Stick Up Camera settings #16

Closed danespinosa closed 1 year ago

danespinosa commented 2 years ago

Is your feature request related to a problem? Please describe. No.

Describe the solution you'd like I am looking to implement a few methods to update a stick up camera settings. Currently I have no idea where I can find the different endpoints to do this. The website uses a different endpoint so it is not compatible with the clients_api endpoint: https://api.ring.com/clients_api/ Specifically I want to use this library to modify the PirSensitivity values. Any guidance would be appreciated and I can help adding the methods and tests to your project.

Describe alternatives you've considered Using the website's endpoints to update settings. https://account.ring.com/api/devices/v1/devices/xxxxxxxx/settings. I guess this would be possible but I would have to request a different token when creating a session?

Thanks a lot for this great project.

danespinosa commented 2 years ago

I have found my solution, the API has the doorbots/id endpoint where I can send a PUT request to update the pir_sensitivity_1.

        public async Task UpdateSensitivity(int doorbotId, int sensitivityValue)
        {
            await EnsureSessionValid();

            // Construct the URL which will update the Ring API sensitivity
            var doorbotsUri = new Uri(RingApiBaseUrl,$"doorbots/{doorbotId}");

            // Construct the body of the message
            var bodyContent = $"{{\"doorbot\": {{ \"settings\": {{ \"pir_sensitivity_1\": {sensitivityValue} }} }} }}";

            // Send the request
            await HttpUtility.SendRequestWithExpectedStatusOutcome(doorbotsUri, System.Net.Http.HttpMethod.Put, System.Net.HttpStatusCode.NoContent, bodyContent, AuthenticationToken);
        }

I see that there is no activity in the repo since 2020, let me know if you would like me to send the PR, if not, I'll just fork your project.

Thanks!

KoenZomers commented 1 year ago

Hi @danespinosa sorry for the late response. Feel free to PR this to the code repo.

KoenZomers commented 1 year ago

Closing this issue awaiting your PR

danespinosa commented 1 year ago

Sounds good, I cloned the repo and did a bunch of updates, I 'll pick the necessary changes and send a PR.