Support for Nest Protect

@imick first of all, thank you so much for this plugin, I’ve been wanting to get this into HA for ages!

One thing that is confusing me slightly is that a “heat sensor” is exposed as part of the data. My understanding was that Nest Protect did not contain a heat sensor and therefore weren’t permitted in new builds in Wales, but obviously that data is coming from somewhere. Do you happen to know where?

If I can prove to the electricians and builders that the heat sensor is available, then I can continue to slot Nest Protect devices in around the house without issue, otherwise I’ll have to go to my current plan of using a different brand.

To be honest, no clue. It is just available in the data they expose. By the way, if you do an export of all data Google has on you, it will even list the values in Celsius. See Expose actual values (e.g. temperature / heat / light) · Issue #22 · iMicknl/ha-nest-protect · GitHub.

On the following page, they list a Heat sensor as well. 2nd gen Nest Protect sensors - Google Nest Help. Hope this helps.

Oh, fantastic, I spent months trying to track down that information and somehow completely missed that page!

1 Like

Hi all,

I see this error in the logs:

2022-03-11 03:13:54 ERROR (MainThread) [custom_components.nest_protect] Subscriber: pynest exception.
Traceback (most recent call last):
  File "/config/custom_components/nest_protect/pynest/client.py", line 225, in subscribe_for_data
    result = await response.json()
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1103, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('https://czfe39-front01-iad01.transport.home.nest.com/v6/subscribe')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/nest_protect/__init__.py", line 123, in _async_subscribe_for_data
    result = await entry_data.client.subscribe_for_data(
  File "/config/custom_components/nest_protect/pynest/client.py", line 229, in subscribe_for_data
    raise PynestException(
custom_components.nest_protect.pynest.exceptions.PynestException: 504 error while subscribing - <html>
<head><title>504 Gateway Time-out</title></head>
<body bgcolor="white">
<center><h1>504 Gateway Time-out</h1></center>
<hr><center>nginx/1.10.3</center>
</body>
</html>
1 Like

Thanks! Could you create an issue on GitHub? If this happens, you will need to reload the integration or restart Home Assistant for updates to come back in.

I restart my HA and the error logs are gone now…

Not sure if this is common or not, but why do I have duplicate of some and they are Unavailable?

This is mentioned in the release changelog; release v0.3.0 · iMicknl/ha-nest-protect (github.com). This will show up on GitHub or on HACS when you update. Always good to read this :-).

Just installed the Nest Protect integration, authorized my account, copied the token but after pasting it, it says “Unexpected Error”
Logs show “Invalid Grant

2022-03-11 13:23:47 ERROR (MainThread) [custom_components.nest_protect] invalid_grant
Traceback (most recent call last):
File "/config/custom_components/nest_protect/config_flow.py", line 41, in async_step_user
refresh_token = await self.async_validate_input(user_input)
File "/config/custom_components/nest_protect/config_flow.py", line 26, in async_validate_input
refresh_token = await client.get_refresh_token(token)
File "/config/custom_components/nest_protect/pynest/client.py", line 89, in get_refresh_token
raise Exception(result["error"])
Exception: invalid_grant

Any idea?

Could you create an issue on GitHub? This will make it easier to have a look at your issue. The error handling still should be better though, that is on the todo list, however invalid grant I haven’t seen yet.
I assume you have a Google account? (and not a legacy Nest account).

I read but I couldn’t get the information about it.

Sorry for asking won’t do that again, specially when I received that awnser.

Feel free to ask again, I didn’t mean to be this blunt :wink:. Just wanted to point out that there is a changelog, in case you were not familiar with it. No hard feelings.

1 Like

Thanks Mick!

(and not a legacy Nest account).

That did the trick. I had the legacy account. After migration it seems to work fine!

DJ

1 Like

Great to hear! In next update it will also reflect this better when the authentication is not correct. Good to understand that with a legacy Nest account, this experience can be confusing.

Really great to see the development here! I have been silently watching the updates. I have (3) Nest Protects that are around 5 years old - and still currently using the Legacy Nest API.

Looking forward to what appears to be added entities, based on what I see today on my Nest Protects with the legacy API.

Below is an example of one of my current Nest Protects.
Capture

Currently (almost) everything they expose in the API is also exposed in Home Assistant. In future version, I will disable some entities by default perhaps, if they are not used by many users.
See below screenshoto for the current state.

3 Likes

Great! Personally, I would like to have the ability to add all the entities. People can always choose to not display them in their lovelace entity listing.

Are the “Heat Test” and “Humidity Test” for the Nest Protects? Maybe the new models have extra items or my older one has sensors I didn’t realize existed.

I have been holding off upgrading HA for now (even though I could copy the old integration into custom components for now) since I would like to use your Nest Protect custom component once you feel it is ready.

I understand that once you migrate your devices from the legacy Nest Protect API to Google, you can’t go back - so just being cautious since all still works as is right now.

1 Like

I’ve installed the custom component manually and the integration appears in the “Add Integrations”, but when I select to add it:

2022-03-14 10:22:02 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading configuration flow for integration nest_protect: cannot import name 'Platform' from 'homeassistant.const' (/usr/src/homeassistant/homeassistant/const.py)

I’m wondering if it’s because I am on an older version of HA (core-2021.5.5) and there are some constants that were added in later versions?

Exactly, it is developed for the latest release only. With HA being such a fast moving project, it is almost impossible to have backwards compatibility.

If you would use HACS, it will only let you upgrade the integration if your HA version meets the criteria.

Hi imick, first off, thanks for a great integration! I noticed in your screenshot that your Heat Test is showing Problem. I also have this status running your Nest Protect integration v0.3.2. I’ve done a test in the Nest iOS app and it is showing “Everything is ok”. Restarting HA has no effect on the Heat Test status.

Is there a known issue with Heat Test, or is it worth me raising an issue over on Github?

My device spec:
Topaz-2.9
Firmware: 3.4rc6
Hardware: Battery