Enable & Disable Nest Camera Recording

Neither the basic camera component nor the Nest integration (i.e., Nest camera platform) support enabling and disabling recording. I’ve created custom components that add this feature to the standard components. For HA versions prior to 0.71 (when python-nest switched to REST Streaming) it also effectively enhances the python-nest package so that changes sent to the Nest API have time to be reflected in future updates from the Nest API. (Without going into detail, this avoids long delays in seeing the change reflected in the corresponding camera entity.)

After adding the files described below (and restarting HA), the following new service will be available:

camera.nest_set_operation_mode

It takes two parameters:

entity_id of camera

operation_mode which can be either idle or recording

In the instructions that follow, <ha_config> is your Home Assistant configuration directory.

If you are using HA versions prior to 0.71, place the following at <ha_config>/custom_components/nest.py:

IMPORTANT: If you are using HA 0.71 or later, do NOT use the following file. Use only the file shown next.

https://github.com/pnbruckner/homeassistant-config/blob/master/custom_components/nest.py

And place the following at <ha_config>/custom_components/camera/nest.py:

https://github.com/pnbruckner/homeassistant-config/blob/master/custom_components/camera/nest.py

Works perfectly in 0.70.1, thanks for this!

1 Like

I will look at into it. BTW, python-nest has been upgraded to 4.0.1, which supports stream API, no cache anymore. HA change already made in 0.71 beta.

Yep, I knew that change was coming. I’ll update my custom component (which probably just means deleting custom_components/nest.py) once it hits an official release. Thanks!

@awarecan, if you meant you’ll look into making this a standard feature for the Nest Cam, that would be great! Also it would be nice if the service itself (e.g., set_operation_mode) was added to the basic camera component, along with the required infrastructure, so that camera platform code (like this and others) could more easily add the implementation (as is done with other camera services.) I would have suggested these changes myself but I still haven’t gotten comfortable with getting all the development infrastructure installed and up to speed using them that are required to make formal pull requests. It seems a bit daunting.

For anyone using this, if you’ve upgraded to 0.71 or above, I think all you’ll need to do is to just remove my custom_components/nest.py file and leave custom_components/camera/nest.py as-is. I think that should work, although I haven’t tested it yet because I haven’t upgraded yet. If you do try this, let us know if that works for you or not.

I opened a PR https://github.com/home-assistant/home-assistant/pull/14880 specific for Nest Cam.

I appreciate you doing this because, as I said, I’m not able to make formal pull requests myself yet. However, rather than adding a Nest Camera specific turn_on and turn_off service, I think it would be much better overall if the camera component had a set_operation_mode service added (very similar to the climate component) which accepts values such as idle, streaming and recording, which are the basic camera states. (Of course, for the Nest Cam, only idle and recording make sense.) If you would consider doing that it would be much appreciated. (E.g., I’ve also enhanced my local copy of the Amcrest Camera platform and for controlling its basic state, I use a similar service with the option's being idle, streaming and recording.)

Good suggestion. I can do it.

1 Like

Add something to Camera level needs go through architect review. I opened an RFC. Feel free to join the discussion, @pnbruckner

1 Like

For those reading this and are on 0.71.0, if you don’t delete “custom_components/nest.py”, the nest component will not show up at all! As soon as you delete it, restart hass and you’re back in business!

Thanks! That’s kind of what I expected. Thanks for testing it and providing feedback. Glad it’s still working (with that removed.) I’ll update the instructions above tomorrow.

Thank you!

Seems like that’s going nowhere (i.e., the request to add the service at the camera component level.) Maybe you should just go back to adding the feature to the Nest camera platform. I would recommend doing it like I did, but feel free to implement however you think best. As long as people have the ability to enable and disable streaming/recording, that’s what matters. Thanks!

https://github.com/home-assistant/home-assistant/pull/14880 had been approved few days ago. Waiting for merge. Hope will be get merged in next release.

1 Like

Looks like this is broken with 72.1. Was working well in prior versions! Any ideas?

Yes. If you read above, as of release 0.71, you need to remove my custom_components/nest.py. And at some point, this functionality is getting rolled into the released component, so my custom component will no longer be necessary. I just don’t recall if that has been done yet. @awarecan would know which release this is in. (I’m still using 0.69.1. Haven’t upgraded recently for a variety of reasons.)

busy on new auth system… let me try to finish on/off camera in 0.74 release

1 Like

https://github.com/home-assistant/home-assistant/pull/15051 is the pending PR

Already removed this previoiusly in my posts and got it working. Looks like awarecan needs to wrap up a few things :slight_smile: