Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v1] release #279

Draft
wants to merge 38 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
4818f5d
Use cookie for authentication (#167)
Cruguah Apr 26, 2023
96565c7
Bump version to 0.4.0b1
iMicknl Apr 26, 2023
2651fed
Update translations to include link to the README
iMicknl Apr 26, 2023
b2c9be0
Change code style
iMicknl Aug 13, 2023
1baf10a
Update sensor.py (#269)
AzimuthMiridian Nov 13, 2023
9f94f36
Fix authenticate argument (#278)
jnxxx Dec 13, 2023
266d0a7
Bump requirements to 2023.12.0
iMicknl Dec 13, 2023
b916f35
Fix (most) tests
iMicknl Dec 13, 2023
41294b4
Skip 2 tests
iMicknl Dec 13, 2023
02ce203
Bugfix in device diagnostics for refresh method
iMicknl Dec 13, 2023
403c381
Fix device diagnostics and bump to 0.4.0b3
iMicknl Dec 13, 2023
6d04dc7
Remove options flow + translations
iMicknl Dec 13, 2023
e94fc9f
Improve translation
iMicknl Dec 13, 2023
bbf0596
Add first translations
iMicknl Dec 13, 2023
54c98d3
Fix battery level calculation for Nest Protect by adding support for …
iMicknl Dec 16, 2023
a65b2fa
Improve enums in beta branch
iMicknl Dec 16, 2023
6034fbc
Add typing
iMicknl Dec 16, 2023
09466ac
Update aiohttp client usage to create a new session
iMicknl Dec 16, 2023
17a2866
Remove unneeded exception
iMicknl Dec 16, 2023
34c075d
Bump to 0.4.0b4
iMicknl Dec 16, 2023
214b727
Update instructions
iMicknl Dec 17, 2023
5860e0a
Small docs tweaks
iMicknl Dec 17, 2023
e1928cc
Small log tweak
iMicknl Dec 17, 2023
1834626
Update README image
iMicknl Dec 18, 2023
0d74ac2
Add more bucket types (#286)
iMicknl Dec 18, 2023
dceef80
deprecation fixes (#300)
bmos Jan 16, 2024
b7f7362
Fix battery level sensor for Nest Temperature Sensors (#289)
alexanv1 Jan 27, 2024
bdedfc5
Improve cookie method code (#285)
iMicknl Jun 15, 2024
638314e
Bump version to 0.4.0b5
iMicknl Jun 15, 2024
6700067
Remove obsolete translation file
iMicknl Jun 15, 2024
f8e5c68
Update translations
iMicknl Jun 15, 2024
e38852a
Update diagnostics
iMicknl Jun 15, 2024
30e081b
Add sensor class measurement
iMicknl Jun 15, 2024
d3740b0
Add exception logging
iMicknl Jun 15, 2024
bc233ef
Maybe fix errors in _async_subscribe_for_data #347 (#355)
ScottESanDiego Sep 29, 2024
f62b82f
Revert "Maybe fix errors in _async_subscribe_for_data #347 (#355)" (#…
iMicknl Oct 5, 2024
9703e6a
Fix Python Tests Dependency Installation Error on Beta (#360)
bmos Oct 5, 2024
b013b9b
Bump version number
iMicknl Oct 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 41 additions & 36 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,41 @@
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
{
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
"name": "ha-nest-protect",
"forwardPorts": [8123],
"portsAttributes": {
"8123": {
"label": "Home Assistant",
"onAutoForward": "openBrowserOnce"
}
},
"postCreateCommand": "pip install -r requirements_dev.txt && pre-commit install && pre-commit install-hooks",
"containerEnv": {
"DEVCONTAINER": "1"
},
"remoteUser": "vscode",
"customizations": {
"vscode": {
"extensions": [
"ms-python.vscode-pylance",
"ms-python.python",
"redhat.vscode-yaml",
"esbenp.prettier-vscode",
"GitHub.vscode-pull-request-github",
"GitHub.copilot"
],
"settings": {
"python.pythonPath": "/usr/local/bin/python",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true
}
}
}
}
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
{
"image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye",
"name": "ha-nest-protect",
"forwardPorts": [
8123
],
"portsAttributes": {
"8123": {
"label": "Home Assistant",
"onAutoForward": "openBrowserOnce"
}
},
"features": {
"ghcr.io/devcontainers-contrib/features/ffmpeg-apt-get:1": {}
},
"postCreateCommand": "sudo apt-get update && sudo apt-get install -y libturbojpeg0 libpcap-dev && pip install -r requirements_dev.txt && pre-commit install && pre-commit install-hooks",
"containerEnv": {
"DEVCONTAINER": "1"
},
"remoteUser": "vscode",
"customizations": {
"vscode": {
"extensions": [
"ms-python.vscode-pylance",
"ms-python.python",
"redhat.vscode-yaml",
"esbenp.prettier-vscode",
"GitHub.vscode-pull-request-github",
"GitHub.copilot"
],
"settings": {
"python.pythonPath": "/usr/local/bin/python",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true
}
}
}
}
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ body:
description: Enable [debug logging](https://github.com/iMicknl/ha-nest-protect#enable-debug-logging) and paste your full log here, if you have errors.
value: |
<details><summary>Logs</summary>

```
Copy/paste any log here, between the starting and ending backticks (`)
```

</details>

- type: textarea
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: '3.12'
- uses: pre-commit/action@v3.0.0
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11']
python-version: ['3.12']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand Down
13 changes: 6 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.31.1
rev: v3.16.0
hooks:
- id: pyupgrade
args: [--py37-plus]
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 24.4.2
hooks:
- id: black
args:
- --safe
- --quiet
files: ^((custom_components)/.+)?[^/]+\.py$
- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
rev: v2.3.0
hooks:
- id: codespell
args:
Expand All @@ -22,18 +21,18 @@ repos:
- --quiet-level=2
exclude_types: [csv, json]
- repo: https://github.com/PyCQA/flake8
rev: 3.9.2
rev: 7.0.0
hooks:
- id: flake8
additional_dependencies:
- flake8-docstrings==1.5.0
- pydocstyle==5.1.1
files: ^(custom_components)/.+\.py$
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.26.3
rev: v1.35.1
hooks:
- id: yamllint
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![Detail page of a Nest Protect device](https://user-images.githubusercontent.com/1424596/158192051-c4a49665-2675-4299-9abf-c0848623445a.png)
![Detail page of a Nest Protect device](https://github.com/iMicknl/ha-nest-protect/assets/1424596/8fd15c57-2a9c-4c20-8c8f-65a526573d1e)

[![hacs_badge](https://img.shields.io/badge/HACS-Default-orange.svg)](https://github.com/hacs/integration)
[![GitHub release](https://img.shields.io/github/release/iMicknl/ha-nest-protect.svg)](https://GitHub.com/iMicknl/ha-nest-protect/releases/)
Expand All @@ -14,6 +14,7 @@ This integration will add the most important sensors of your Nest Protect device

- Only Google Accounts are supported, there is no plan to support legacy Nest accounts
- When Nest Protect (wired) occupancy is triggered, it will stay 'on' for 10 minutes. (API limitation)
- Only _cookie authentication_ is supported as Google removed the API key authentication method. This means that you need to login to the Nest website at least once to generate a cookie. This cookie will be used to authenticate with the Nest API. The cookie will be stored in the Home Assistant configuration folder and will be used for future requests. If you logout from your browser or change your password, you need to reautenticate and and replace the current issue_token and cookies.

## Installation

Expand All @@ -25,14 +26,29 @@ Search for the Nest Protect integration and choose install. Reboot Home Assistan

[![Open your Home Assistant instance and start setting up a new integration.](https://my.home-assistant.io/badges/config_flow_start.svg)](https://my.home-assistant.io/redirect/config_flow_start/?domain=nest_protect)


### Manual

Copy the `custom_components/nest_protect` to your custom_components folder. Reboot Home Assistant and configure the Nest Protect integration via the integrations page or press the blue button below.

[![Open your Home Assistant instance and start setting up a new integration.](https://my.home-assistant.io/badges/config_flow_start.svg)](https://my.home-assistant.io/redirect/config_flow_start/?domain=nest_protect)

## Retrieving `issue_token` and `cookies`

(adapted from [homebridge-nest documentation](https://github.com/chrisjshull/homebridge-nest))

The values of "issue_token" and "cookies" are specific to your Google Account. To get them, follow these steps (only needs to be done once, as long as you stay logged into your Google Account).

1. Open a Chrome/Edge browser tab in Incognito Mode (or clear your cookies).
2. Open Developer Tools (View/Developer/Developer Tools).
3. Click on **Network** tab. Make sure 'Preserve Log' is checked.
4. In the **Filter** box, enter `issueToken`
5. Go to home.nest.com, and click **Sign in with Google**. Log into your account.
6. One network call (beginning with iframerpc) will appear in the Dev Tools window. Click on it.
7. In the Headers tab, under General, copy the entire Request URL (beginning with https://accounts.google.com). This is your _'issue_token'_ in the configuration form.
8. In the **Filter** box, enter _oauth2/iframe_.
9. Several network calls will appear in the Dev Tools window. Click on the last iframe call.
10. In the **Headers** tab, under **Request Headers**, copy the entire cookie (include the whole string which is several lines long and has many field/value pairs - do not include the cookie: name). This is your _'cookies'_ in the configuration form.
11. Do not log out of home.nest.com, as this will invalidate your credentials. Just close the browser tab.

## Advanced

Expand Down
2 changes: 1 addition & 1 deletion config/configuration.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
default_config:

logger:
default: info
default: error
logs:
custom_components.nest_protect: debug

Expand Down
Loading
Loading