homebridge-mynest 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +20 -0
- package/CHANGELOG.md +22 -0
- package/CONTRIBUTING.md +40 -0
- package/DEVELOPMENT.md +70 -0
- package/LICENSE +202 -0
- package/README.md +146 -0
- package/RELEASING.md +55 -0
- package/SECURITY.md +49 -0
- package/assets/protobuf/ObserveTraits.protobuf +910 -0
- package/assets/protobuf/nest/messages.proto +8 -0
- package/assets/protobuf/nest/trait/detector.proto +41 -0
- package/assets/protobuf/nest/trait/hvac.proto +262 -0
- package/assets/protobuf/nest/trait/located.proto +94 -0
- package/assets/protobuf/nest/trait/occupancy.proto +365 -0
- package/assets/protobuf/nest/trait/security.proto +516 -0
- package/assets/protobuf/nest/trait/sensor.proto +41 -0
- package/assets/protobuf/nest/trait/structure.proto +27 -0
- package/assets/protobuf/nest/trait/user.proto +28 -0
- package/assets/protobuf/nestlabs/gateway/v1.proto +277 -0
- package/assets/protobuf/root.proto +68 -0
- package/assets/protobuf/weave/common.proto +151 -0
- package/assets/protobuf/weave/trait/description.proto +39 -0
- package/assets/protobuf/weave/trait/heartbeat.proto +39 -0
- package/assets/protobuf/weave/trait/peerdevices.proto +38 -0
- package/assets/protobuf/weave/trait/power.proto +86 -0
- package/assets/protobuf/weave/trait/security.proto +337 -0
- package/config.schema.json +108 -0
- package/dist/accessories/base.d.ts +77 -0
- package/dist/accessories/base.d.ts.map +1 -0
- package/dist/accessories/base.js +122 -0
- package/dist/accessories/base.js.map +1 -0
- package/dist/accessories/protect.d.ts +43 -0
- package/dist/accessories/protect.d.ts.map +1 -0
- package/dist/accessories/protect.js +271 -0
- package/dist/accessories/protect.js.map +1 -0
- package/dist/accessories/temperature-sensor.d.ts +28 -0
- package/dist/accessories/temperature-sensor.d.ts.map +1 -0
- package/dist/accessories/temperature-sensor.js +62 -0
- package/dist/accessories/temperature-sensor.js.map +1 -0
- package/dist/accessories/thermostat.d.ts +33 -0
- package/dist/accessories/thermostat.d.ts.map +1 -0
- package/dist/accessories/thermostat.js +223 -0
- package/dist/accessories/thermostat.js.map +1 -0
- package/dist/api/circuit-breaker.d.ts +85 -0
- package/dist/api/circuit-breaker.d.ts.map +1 -0
- package/dist/api/circuit-breaker.js +194 -0
- package/dist/api/circuit-breaker.js.map +1 -0
- package/dist/api/framing.d.ts +56 -0
- package/dist/api/framing.d.ts.map +1 -0
- package/dist/api/framing.js +120 -0
- package/dist/api/framing.js.map +1 -0
- package/dist/api/http.d.ts +53 -0
- package/dist/api/http.d.ts.map +1 -0
- package/dist/api/http.js +96 -0
- package/dist/api/http.js.map +1 -0
- package/dist/api/observe.d.ts +63 -0
- package/dist/api/observe.d.ts.map +1 -0
- package/dist/api/observe.js +198 -0
- package/dist/api/observe.js.map +1 -0
- package/dist/api/protobuf.d.ts +65 -0
- package/dist/api/protobuf.d.ts.map +1 -0
- package/dist/api/protobuf.js +157 -0
- package/dist/api/protobuf.js.map +1 -0
- package/dist/api/rest.d.ts +100 -0
- package/dist/api/rest.d.ts.map +1 -0
- package/dist/api/rest.js +232 -0
- package/dist/api/rest.js.map +1 -0
- package/dist/api/session.d.ts +41 -0
- package/dist/api/session.d.ts.map +1 -0
- package/dist/api/session.js +128 -0
- package/dist/api/session.js.map +1 -0
- package/dist/api/transport.d.ts +121 -0
- package/dist/api/transport.d.ts.map +1 -0
- package/dist/api/transport.js +562 -0
- package/dist/api/transport.js.map +1 -0
- package/dist/diagnostics/collector.d.ts +89 -0
- package/dist/diagnostics/collector.d.ts.map +1 -0
- package/dist/diagnostics/collector.js +300 -0
- package/dist/diagnostics/collector.js.map +1 -0
- package/dist/diagnostics/format.d.ts +12 -0
- package/dist/diagnostics/format.d.ts.map +1 -0
- package/dist/diagnostics/format.js +52 -0
- package/dist/diagnostics/format.js.map +1 -0
- package/dist/diagnostics/types.d.ts +95 -0
- package/dist/diagnostics/types.d.ts.map +1 -0
- package/dist/diagnostics/types.js +11 -0
- package/dist/diagnostics/types.js.map +1 -0
- package/dist/errors/index.d.ts +168 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +265 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/platform.d.ts +26 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/platform.js +635 -0
- package/dist/platform.js.map +1 -0
- package/dist/settings.d.ts +178 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +203 -0
- package/dist/settings.js.map +1 -0
- package/dist/state/classify.d.ts +65 -0
- package/dist/state/classify.d.ts.map +1 -0
- package/dist/state/classify.js +121 -0
- package/dist/state/classify.js.map +1 -0
- package/dist/state/observe-state.d.ts +64 -0
- package/dist/state/observe-state.d.ts.map +1 -0
- package/dist/state/observe-state.js +150 -0
- package/dist/state/observe-state.js.map +1 -0
- package/dist/state/protect-state.d.ts +70 -0
- package/dist/state/protect-state.d.ts.map +1 -0
- package/dist/state/protect-state.js +190 -0
- package/dist/state/protect-state.js.map +1 -0
- package/dist/state/registry.d.ts +40 -0
- package/dist/state/registry.d.ts.map +1 -0
- package/dist/state/registry.js +233 -0
- package/dist/state/registry.js.map +1 -0
- package/dist/state/sensor-state.d.ts +38 -0
- package/dist/state/sensor-state.d.ts.map +1 -0
- package/dist/state/sensor-state.js +60 -0
- package/dist/state/sensor-state.js.map +1 -0
- package/dist/state/thermostat-state.d.ts +52 -0
- package/dist/state/thermostat-state.d.ts.map +1 -0
- package/dist/state/thermostat-state.js +196 -0
- package/dist/state/thermostat-state.js.map +1 -0
- package/dist/state/traits.d.ts +61 -0
- package/dist/state/traits.d.ts.map +1 -0
- package/dist/state/traits.js +106 -0
- package/dist/state/traits.js.map +1 -0
- package/dist/types/config.d.ts +73 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +11 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/device.d.ts +178 -0
- package/dist/types/device.d.ts.map +1 -0
- package/dist/types/device.js +31 -0
- package/dist/types/device.js.map +1 -0
- package/dist/types/nest.d.ts +145 -0
- package/dist/types/nest.d.ts.map +1 -0
- package/dist/types/nest.js +16 -0
- package/dist/types/nest.js.map +1 -0
- package/dist/utils/bound-characteristics.d.ts +75 -0
- package/dist/utils/bound-characteristics.d.ts.map +1 -0
- package/dist/utils/bound-characteristics.js +124 -0
- package/dist/utils/bound-characteristics.js.map +1 -0
- package/dist/utils/logger.d.ts +37 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +43 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/retry.d.ts +38 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +67 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/utils/sanitizers.d.ts +56 -0
- package/dist/utils/sanitizers.d.ts.map +1 -0
- package/dist/utils/sanitizers.js +209 -0
- package/dist/utils/sanitizers.js.map +1 -0
- package/dist/utils/validators.d.ts +24 -0
- package/dist/utils/validators.d.ts.map +1 -0
- package/dist/utils/validators.js +138 -0
- package/dist/utils/validators.js.map +1 -0
- package/docs/AUTH.md +26 -0
- package/docs/PROTOCOL.md +75 -0
- package/package.json +94 -0
- package/scripts/README.md +14 -0
- package/scripts/verify.mjs +222 -0
package/.env.example
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Nest Account access token, used by the local verification script only.
|
|
2
|
+
#
|
|
3
|
+
# The plugin itself reads this value from the Homebridge platform config
|
|
4
|
+
# (`accessToken`), not from the environment. This file exists so `npm run
|
|
5
|
+
# verify` can talk to a live account without the token ever being typed into a
|
|
6
|
+
# shell history or committed.
|
|
7
|
+
#
|
|
8
|
+
# How to obtain it:
|
|
9
|
+
# 1. Sign in at https://home.nest.com in a browser.
|
|
10
|
+
# 2. In the same browser, open https://home.nest.com/session
|
|
11
|
+
# 3. Copy the value of the `access_token` field from the JSON response.
|
|
12
|
+
#
|
|
13
|
+
# The token grants full control of every thermostat and smoke alarm on the
|
|
14
|
+
# account. Treat it like a password: never commit it, never paste it into an
|
|
15
|
+
# issue report. Copy this file to `.env` (which is gitignored) to use it.
|
|
16
|
+
NEST_ACCESS_TOKEN=
|
|
17
|
+
|
|
18
|
+
# Optional. Set to 1 to talk to Nest's field-test environment
|
|
19
|
+
# (home.ft.nest.com / grpc-web.ft.nest.com) instead of production.
|
|
20
|
+
# NEST_FIELD_TEST=1
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here. From the first release onward, [release-please](https://github.com/googleapis/release-please) owns this file — do not hand-edit version headings after `0.1.0` ships.
|
|
4
|
+
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
## 0.1.0
|
|
8
|
+
|
|
9
|
+
Initial public release of **homebridge-mynest**.
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
- Nest Account `access_token` authentication (Google JWT / `ya29.` shapes rejected at config validation)
|
|
14
|
+
- Dual transport: REST `app_launch` + `/v5/subscribe` merged with HTTP/2 Observe
|
|
15
|
+
- Nest thermostats (read-only), Nest Protect, and Nest Temperature Sensors in HomeKit
|
|
16
|
+
- Homebridge 2–safe characteristic updates via stored getters + `updateValue(...)`
|
|
17
|
+
- Honest Protect occupancy (REST `auto_away` / ~10-minute presence; mains-powered only)
|
|
18
|
+
- Smoke/CO published after Nest REST reports alarm state; REST outages and expired tokens keep tiles in HomeKit but mark them inactive/faulted rather than freezing a live all-clear or tearing services down
|
|
19
|
+
- Accessory removal only after Nest-confirmed drops (Observe + REST two-strike / truncation guards); transport outages and REST-only boots do not bounce rooms or automations
|
|
20
|
+
- Per-transport circuit breakers for sustained Nest edge failures
|
|
21
|
+
- Opt-in diagnostics heartbeats (`diagnosticsInterval` / `structuredLogs`)
|
|
22
|
+
- Observe device prune, rediscovery, and per-transport HTTP 403 budgets
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thanks for interest in improving `homebridge-mynest`.
|
|
4
|
+
|
|
5
|
+
## Development setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install
|
|
9
|
+
npm test
|
|
10
|
+
npm run build
|
|
11
|
+
npm run lint
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
See [DEVELOPMENT.md](DEVELOPMENT.md) for architecture and [RELEASING.md](RELEASING.md) for the release-please / npm Trusted Publishing flow.
|
|
15
|
+
|
|
16
|
+
Use Conventional Commits (`feat:`, `fix:`, `docs:`, `test:`, `chore:`, …).
|
|
17
|
+
|
|
18
|
+
## Rules of the road
|
|
19
|
+
|
|
20
|
+
- **Do not copy** code from `chrisjshull/homebridge-nest` or other Nest plugins. Reimplement from probes and Nest behaviour.
|
|
21
|
+
- **No Google auth** in v1. Nest Account `access_token` only.
|
|
22
|
+
- **No secrets in the repo.** Use `.env` (gitignored) for live scripts; never commit tokens or probe captures that contain account data.
|
|
23
|
+
- **Life-safety honesty.** Do not invent Protect all-clear or motion from unverified Observe fields.
|
|
24
|
+
- **Homebridge 2 update path.** Use `CharacteristicBinder` / `updateValue(reader())` — never `getValue()` for pushes, never `updateValue(characteristic.value)`.
|
|
25
|
+
|
|
26
|
+
## Live verification
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
cp .env.example .env
|
|
30
|
+
# paste NEST_ACCESS_TOKEN
|
|
31
|
+
npm run verify
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`verify` is read-only. Thermostat writes are not available yet.
|
|
35
|
+
|
|
36
|
+
## Pull requests
|
|
37
|
+
|
|
38
|
+
- Keep PRs focused
|
|
39
|
+
- Include tests for behaviour changes
|
|
40
|
+
- Update docs when user-facing semantics change (especially occupancy and smoke/CO)
|
package/DEVELOPMENT.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Development
|
|
2
|
+
|
|
3
|
+
## Architecture
|
|
4
|
+
|
|
5
|
+
Two layers, meeting at the platform. Above it, accessories speak HomeKit. Below it, `api/` speaks Nest (REST + Observe) and knows nothing about HomeKit. The state layer between them is pure and fixture-testable.
|
|
6
|
+
|
|
7
|
+
| Area | Purpose |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| `src/platform.ts` | Discovery, accessory lifecycle, coalesced updates |
|
|
10
|
+
| `src/diagnostics/` | Opt-in health heartbeats and rollup (mirrors sibling plugins) |
|
|
11
|
+
| `src/api/session.ts` | Nest Account session (`GET /session`) |
|
|
12
|
+
| `src/api/rest.ts` | `app_launch` + `/v5/subscribe` |
|
|
13
|
+
| `src/api/observe.ts` | HTTP/2 Observe stream |
|
|
14
|
+
| `src/api/framing.ts` / `protobuf.ts` | Length-delimited frames and trait decode |
|
|
15
|
+
| `src/api/transport.ts` | Independent REST + Observe run loops |
|
|
16
|
+
| `src/state/*` | Observe∪REST merge, Protect/thermostat/sensor readers |
|
|
17
|
+
| `src/accessories/*` | HomeKit accessories + HB2-safe `CharacteristicBinder` |
|
|
18
|
+
| `src/utils/sanitizers.ts` | Central secret redaction |
|
|
19
|
+
| `assets/protobuf/` | Vendored decode-only Nest schemas + ObserveTraits blob |
|
|
20
|
+
|
|
21
|
+
## Design principles
|
|
22
|
+
|
|
23
|
+
- **Nest Account tokens only.** Google JWT / `ya29.` shapes are rejected at config validation.
|
|
24
|
+
- **Observe ∪ REST.** Neither transport is a superset; thermostats are Observe-first; Observe-only Protects must appear.
|
|
25
|
+
- **Life-safety honesty.** No invented Protect all-clear or motion from unverified Observe fields.
|
|
26
|
+
- **HB2 update path.** Store getters; push with `updateValue(reader())` — never `getValue()`, never `updateValue(characteristic.value)`.
|
|
27
|
+
- **Dependency-light.** Runtime dependency is `protobufjs` only; `fetch` and `http2` are Node built-ins.
|
|
28
|
+
- **Secrets never reach the log.** Tokens, Basic headers, and user ids are redacted.
|
|
29
|
+
|
|
30
|
+
## Local workflow
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install
|
|
34
|
+
npm test
|
|
35
|
+
npm run build
|
|
36
|
+
npm run lint
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Live read-only check (requires `.env` with `NEST_ACCESS_TOKEN` — never commit it):
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
cp .env.example .env
|
|
43
|
+
npm run verify
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
`verify` drives compiled `dist/` against the live account and prints the merged inventory. It does not write setpoints. Treat its output as sensitive; prefer redacted paste into issues.
|
|
47
|
+
|
|
48
|
+
## Protocol notes
|
|
49
|
+
|
|
50
|
+
See [docs/PROTOCOL.md](docs/PROTOCOL.md) and [docs/AUTH.md](docs/AUTH.md). Arbitrary-looking constants in `src/settings.ts` are empirical; comments explain why they are what they are.
|
|
51
|
+
|
|
52
|
+
### Bumping the pinned Nest client identity
|
|
53
|
+
|
|
54
|
+
`USER_AGENT` (Chrome 77) and `WEB_APP_VERSION` are pinned because Nest's private backends check them. If production starts returning sustained HTTP 403s after a Nest edge change:
|
|
55
|
+
|
|
56
|
+
1. Capture a fresh session from the Nest web app and note the `User-Agent` / app version strings it sends.
|
|
57
|
+
2. Update the constants in `src/settings.ts` with a Conventional Commit explaining the Nest-side change.
|
|
58
|
+
3. Run `npm run verify` against a live account before merging.
|
|
59
|
+
|
|
60
|
+
Do not bump them casually — an incompatible schema version can change trait shapes this plugin cannot decode.
|
|
61
|
+
|
|
62
|
+
## Tests
|
|
63
|
+
|
|
64
|
+
Unit tests live under `tests/unit/` and use synthesized fixtures only — never live capture. Accessory tests run against real `hap-nodejs` services so the HB2 value-cache bug can actually reproduce.
|
|
65
|
+
|
|
66
|
+
Integration tests live under `tests/integration/` and exercise discovery / transport wiring against fixtures (no live Nest account):
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npm run test:integration
|
|
70
|
+
```
|
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# homebridge-mynest
|
|
2
|
+
|
|
3
|
+
[](https://github.com/tbaur/homebridge-mynest/actions/workflows/test.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/homebridge-mynest)
|
|
5
|
+
[](https://www.npmjs.com/package/homebridge-mynest)
|
|
6
|
+
[](https://nodejs.org)
|
|
7
|
+
[](https://homebridge.io)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
|
|
10
|
+
Expose Nest thermostats, Nest Protect smoke/CO alarms, and Nest Temperature Sensors in Apple HomeKit through Homebridge, using a **Nest Account** access token only (no Google cookie / `issueToken` auth).
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
### Device Support
|
|
15
|
+
|
|
16
|
+
- **Thermostats** — Current temperature, mode, activity, setpoints, humidity when Nest reports it (read-only in this version)
|
|
17
|
+
- **Nest Protect** — Smoke and CO from REST when available; battery / online from REST and/or Observe; optional occupancy and Protect temperature
|
|
18
|
+
- **Temperature Sensors** — Nest Temperature Sensor (kryptonite) pucks
|
|
19
|
+
- **Dual transport** — Merges Nest REST subscribe with HTTP/2 Observe so Observe-only devices still appear
|
|
20
|
+
|
|
21
|
+
### Honesty about Nest's APIs
|
|
22
|
+
|
|
23
|
+
- **Occupancy is not motion** — Nest publishes `auto_away` for mains-powered Protects: roughly a ten-minute presence verdict. Battery Protects, power-unknown Protects, and Observe-only Protects get no occupancy sensor rather than a stuck "empty house"; when REST later goes stale, a last occupancy reading stays published but is marked inactive/faulted
|
|
24
|
+
- **Smoke/CO honesty without accessory churn** — Observe-only Protects omit smoke/CO until REST reports alarm state; if REST later goes down, tiles stay in HomeKit (rooms/automations keep their targets) but are marked inactive/faulted rather than freezing a live all-clear. Battery and online may remain from Observe
|
|
25
|
+
- **Thermostats are Observe-first** — Modern Nest thermostats may be missing from REST entirely; this plugin does not rely on REST-only discovery for HVAC
|
|
26
|
+
|
|
27
|
+
### Reliability
|
|
28
|
+
|
|
29
|
+
- **No accessory churn on outages or token expiry** — Devices leave HomeKit only after Nest-confirmed drops (two-strike + truncation guards on Observe and REST). A cloud blip, REST-only boot, or expired access token stops updates but does not unregister thermostats, Protects, or temp sensors (paste a fresh token and restart)
|
|
30
|
+
- **Circuit breakers** — Independent REST and Observe breakers fail fast when Nest's edge is returning sustained 5xx / network failures, then probe again after a short cooldown (auth and 403 paths keep their own handling)
|
|
31
|
+
- **Diagnostics** *(optional)* — Opt-in health/activity heartbeats, boot/shutdown snapshots, and healthy/degraded transitions in the Homebridge log (REST + Observe transport gauges, breaker state, device inventory, API latency)
|
|
32
|
+
|
|
33
|
+
### Quality
|
|
34
|
+
|
|
35
|
+
<!-- Canonical test count lives here only; keep other docs number-free to avoid multi-place updates. -->
|
|
36
|
+
- **Homebridge 2 safe** — Live updates use stored getters + `updateValue(...)`, not removed `getValue()` or stale `.value` reads
|
|
37
|
+
- **412 Tests** — Jest suite with an 80% coverage gate across statements, branches, functions, and lines
|
|
38
|
+
- **Strict TypeScript** — `strict` mode with unused locals/params and no implicit returns
|
|
39
|
+
- **Secret hygiene** — Access tokens are redacted from logs
|
|
40
|
+
- **No analytics** — Zero tracking or data collection
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
### 1. Install
|
|
45
|
+
|
|
46
|
+
**Homebridge UI** (recommended): Plugins → Search `mynest` → Install
|
|
47
|
+
|
|
48
|
+
**Command line:**
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm install -g homebridge-mynest
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 2. Get a Nest Account token
|
|
55
|
+
|
|
56
|
+
You need a Nest Account (not Google-only) access token from [home.nest.com/session](https://home.nest.com/session). Steps and threat model: [docs/AUTH.md](docs/AUTH.md).
|
|
57
|
+
|
|
58
|
+
Prefer treating that token like a password; Nest Account sessions are account-scoped credentials.
|
|
59
|
+
|
|
60
|
+
### 3. Configure
|
|
61
|
+
|
|
62
|
+
Use the Homebridge UI, or add the platform to `config.json`:
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"platforms": [
|
|
67
|
+
{
|
|
68
|
+
"platform": "MyNest",
|
|
69
|
+
"name": "MyNest",
|
|
70
|
+
"accessToken": "paste-access_token-from-home.nest.com/session"
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 4. Restart Homebridge
|
|
77
|
+
|
|
78
|
+
Thermostats, Protects, and temperature sensors appear in the Home app as Nest reports them.
|
|
79
|
+
|
|
80
|
+
## Supported Devices
|
|
81
|
+
|
|
82
|
+
| Nest device | HomeKit accessory | Notes |
|
|
83
|
+
| --- | --- | --- |
|
|
84
|
+
| Thermostat | Thermostat | Read-only; Observe is source of truth |
|
|
85
|
+
| Nest Protect | Smoke + CO (+ optional occupancy / temp) | Smoke/CO require REST `topaz`; occupancy is ~10-minute presence |
|
|
86
|
+
| Temperature Sensor | Temperature Sensor | Battery + temperature |
|
|
87
|
+
|
|
88
|
+
Cameras, doorbells, locks, and Home/Away structure switches are out of scope for v1.
|
|
89
|
+
|
|
90
|
+
## Configuration Options
|
|
91
|
+
|
|
92
|
+
`name` is required by Homebridge verified plugins and identifies this instance in the logs (defaults to `MyNest`).
|
|
93
|
+
|
|
94
|
+
| Option | Default | Description |
|
|
95
|
+
| --- | --- | --- |
|
|
96
|
+
| `name` | `MyNest` | Required. Plugin instance name shown in Homebridge logs. |
|
|
97
|
+
| `accessToken` | — | Required. Nest Account `access_token` from [docs/AUTH.md](docs/AUTH.md). |
|
|
98
|
+
| `allowThermostatControl` | `false` | Reserved; writes are not supported yet (warns if enabled). |
|
|
99
|
+
| `exposeProtectOccupancy` | `true` | Occupancy from REST `auto_away` when Nest computes it on a mains-powered Protect. |
|
|
100
|
+
| `exposeProtectTemperature` | `false` | Temperature/humidity measured by each Protect. |
|
|
101
|
+
| `ignoredDeviceIds` | `[]` | Device IDs or serials to leave out of HomeKit. |
|
|
102
|
+
| `fieldTest` | `false` | Use Nest field-test hosts. |
|
|
103
|
+
| `diagnosticsInterval` | `0` | Seconds between health heartbeats in the log; `0` off, else `30`–`3600`. |
|
|
104
|
+
| `structuredLogs` | `false` | When diagnostics are enabled, also emit a machine-readable JSON line alongside each human summary. |
|
|
105
|
+
| `debug` | `false` | Verbose logging; tokens are redacted. |
|
|
106
|
+
|
|
107
|
+
## Protect occupancy
|
|
108
|
+
|
|
109
|
+
Nest does not expose a reliable Protect motion event stream to third-party clients. What this plugin publishes (when REST `auto_away` exists on a mains-powered Protect) is Nest's own presence hold-off — on the order of **ten minutes** after the room empties, clearing when activity is seen again. Do not build automations that expect pathlight-speed motion.
|
|
110
|
+
|
|
111
|
+
## Not Working?
|
|
112
|
+
|
|
113
|
+
1. **Authentication error** — Token missing, truncated, Google JWT/`ya29.`, or revoked. Capture a fresh Nest Account token ([docs/AUTH.md](docs/AUTH.md)).
|
|
114
|
+
2. **Thermostat missing** — Modern thermostats are Observe-only on some accounts. With default logging the plugin warns within about a minute if Observe produced no frames; set `debug: true` for stream detail, or run `npm run verify`.
|
|
115
|
+
3. **Protect without smoke/CO** — Likely Observe-only (missing from REST). The accessory still appears; alarm tiles wait for REST.
|
|
116
|
+
4. **No occupancy** — Battery Protect, power unknown, Observe-only Protect, or `exposeProtectOccupancy` off.
|
|
117
|
+
|
|
118
|
+
## Security
|
|
119
|
+
|
|
120
|
+
This plugin holds a Nest Account `access_token` in Homebridge's plaintext `config.json`. That token is account-scoped Nest credentials — anyone who can read the file can act as the Nest web app for the home. Secure the host, prefer rotating the token if it may have leaked, and never paste tokens into issues or logs.
|
|
121
|
+
|
|
122
|
+
Details: [SECURITY.md](SECURITY.md) and [docs/AUTH.md](docs/AUTH.md).
|
|
123
|
+
|
|
124
|
+
Nest publishes no consumer API and can change or revoke sessions without notice. This plugin uses Nest Account tokens only and rejects Google cookie / `ya29.` shapes on purpose.
|
|
125
|
+
|
|
126
|
+
## Requirements
|
|
127
|
+
|
|
128
|
+
- Node.js 20 or newer
|
|
129
|
+
- Homebridge 1.6 or newer, including Homebridge 2.x
|
|
130
|
+
- A Nest Account (not Google-only) with an `access_token` from [home.nest.com/session](https://home.nest.com/session)
|
|
131
|
+
|
|
132
|
+
## More Info
|
|
133
|
+
|
|
134
|
+
- [Authentication](docs/AUTH.md) — capturing the Nest Account token
|
|
135
|
+
- [Protocol notes](docs/PROTOCOL.md) — reverse-engineered Nest behaviour
|
|
136
|
+
- [Development](DEVELOPMENT.md) — architecture and local setup
|
|
137
|
+
- [Contributing](CONTRIBUTING.md)
|
|
138
|
+
- [Security policy](SECURITY.md)
|
|
139
|
+
- [Changelog](CHANGELOG.md)
|
|
140
|
+
- [Report issues](https://github.com/tbaur/homebridge-mynest/issues)
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
Copyright 2026 tbaur
|
|
145
|
+
|
|
146
|
+
Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) file for details.
|
package/RELEASING.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Releasing
|
|
2
|
+
|
|
3
|
+
Releases are fully automated with [release-please](https://github.com/googleapis/release-please). Versions, `CHANGELOG.md`, git tags, GitHub Releases, and `npm publish` are all derived from commit messages — none are edited or run by hand.
|
|
4
|
+
|
|
5
|
+
## Flow
|
|
6
|
+
|
|
7
|
+
1. A branch is created and changes are committed.
|
|
8
|
+
2. A PR is opened with a **Conventional Commit title**. The title determines the next version when the PR is squash-merged into `main`:
|
|
9
|
+
|
|
10
|
+
| PR title prefix | Example | Version bump (pre-1.0) |
|
|
11
|
+
| --- | --- | --- |
|
|
12
|
+
| `fix:` | `fix: rate-limit REST subscribe success path` | patch (0.1.0 → 0.1.1) |
|
|
13
|
+
| `feat:` | `feat: thermostat write path behind confirm` | patch (0.1.0 → 0.1.1) |
|
|
14
|
+
| `feat!:` / `fix!:` or a `BREAKING CHANGE:` footer | `feat!: drop Node 20` | minor (0.1.0 → 0.2.0) |
|
|
15
|
+
| `chore:`, `docs:`, `refactor:`, `test:`, `ci:` | `docs: fix typo` | no release |
|
|
16
|
+
|
|
17
|
+
The bumps above are damped while the version is below `1.0.0`, because `release-please-config.json` sets `bump-minor-pre-major` and `bump-patch-for-minor-pre-major`. Once `1.0.0` ships, the same prefixes resume their normal meaning.
|
|
18
|
+
|
|
19
|
+
3. The **Tests** workflow runs on the PR (matrix: Node 20, 22, 24, plus a security audit). The PR is squash-merged to `main`.
|
|
20
|
+
4. **release-please** opens or updates a **Release PR** titled `chore(main): release X.Y.Z`.
|
|
21
|
+
5. Merging the Release PR triggers `release.yml`, which creates the `vX.Y.Z` tag, publishes a GitHub Release, and runs `npm publish` with provenance on Node 24.
|
|
22
|
+
|
|
23
|
+
## Branch protection
|
|
24
|
+
|
|
25
|
+
`main` is protected with settings chosen to be compatible with the automated flow above:
|
|
26
|
+
|
|
27
|
+
- **Require a pull request before merging** (0 required approvals) — keeps direct pushes off `main` without blocking a solo maintainer.
|
|
28
|
+
- **Block force-pushes and deletions.**
|
|
29
|
+
- **No required status checks.** The Tests workflow runs on every code PR and is visible there, but it is intentionally *not* a hard merge gate. The Release PR is opened by the built-in `GITHUB_TOKEN`, and GitHub does not trigger workflows for such PRs (loop prevention), so a required check would leave every Release PR permanently unmergeable. The `publish` job re-runs build → lint → test before `npm publish`, so releases are still gated on a green build.
|
|
30
|
+
|
|
31
|
+
## Publishing authentication
|
|
32
|
+
|
|
33
|
+
Publishing uses **npm Trusted Publishing (OIDC)** — there is no `NPM_TOKEN` secret. Link the package to this repo's `release.yml` workflow on npmjs.com before the first Release PR is merged:
|
|
34
|
+
|
|
35
|
+
- Package → **Settings → Trusted Publisher**
|
|
36
|
+
- GitHub Actions publisher: organization/user `tbaur`, repository `homebridge-mynest`, workflow `release.yml`, no environment.
|
|
37
|
+
|
|
38
|
+
This link only needs to exist before the first Release PR is merged; it does not need to be reconfigured per release.
|
|
39
|
+
|
|
40
|
+
## Notes
|
|
41
|
+
|
|
42
|
+
- **PR titles drive releases.** With squash merges, the PR title becomes the commit release-please reads. `chore:`/`docs:`/`ci:` titles intentionally produce no release.
|
|
43
|
+
- **The Release PR does not re-run the Tests workflow.** GitHub does not trigger workflows for PRs opened by the built-in token (loop prevention). The code was already tested on its own PR, and the `publish` job builds, lints, and tests again before publishing, so nothing ships untested.
|
|
44
|
+
- **Do not hand-edit** `CHANGELOG.md` or the `package.json` version after the first public release; release-please owns both. Version source of truth is `.release-please-manifest.json`.
|
|
45
|
+
- **`dist/` is committed** so `npm install` from git works. CI fails if `dist/` drifts from `src/`.
|
|
46
|
+
|
|
47
|
+
## Manual fallback
|
|
48
|
+
|
|
49
|
+
Manual publishing is rarely needed and bypasses CI provenance and manifest syncing. If unavoidable:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm run clean && npm run build && npm run lint && npm test
|
|
53
|
+
npm publish --dry-run # verify contents
|
|
54
|
+
npm publish # requires npm login + OTP
|
|
55
|
+
```
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
| Version | Supported |
|
|
6
|
+
| ------- | ----------------- |
|
|
7
|
+
| 0.1.x | ✅ Active support |
|
|
8
|
+
|
|
9
|
+
While the plugin is pre-1.0, only the most recent release is supported. Fixes are shipped forward rather than backported.
|
|
10
|
+
|
|
11
|
+
## Reporting a Vulnerability
|
|
12
|
+
|
|
13
|
+
If you discover a security vulnerability, please report it responsibly:
|
|
14
|
+
|
|
15
|
+
1. **Do NOT open a public issue**
|
|
16
|
+
2. Email the maintainer directly or use GitHub's [private vulnerability reporting](https://github.com/tbaur/homebridge-mynest/security/advisories/new)
|
|
17
|
+
3. Include:
|
|
18
|
+
- Description of the vulnerability
|
|
19
|
+
- Steps to reproduce
|
|
20
|
+
- Potential impact
|
|
21
|
+
- Any suggested fixes
|
|
22
|
+
|
|
23
|
+
## The Nest Account access token
|
|
24
|
+
|
|
25
|
+
How to capture the token is in [docs/AUTH.md](docs/AUTH.md). This section is the threat model.
|
|
26
|
+
|
|
27
|
+
Nest publishes no consumer API. This plugin authenticates with a Nest Account `access_token` copied from `https://home.nest.com/session`. Understand what that token is before you configure the plugin:
|
|
28
|
+
|
|
29
|
+
- **It is account-scoped Nest credentials**, not a HomeKit pairing code. Anyone who has it can act as the Nest web app for that account.
|
|
30
|
+
- **It is stored in plaintext.** Homebridge keeps plugin configuration in `config.json` on disk, unencrypted. Anyone who can read that file — or a backup of it — holds a durable credential to the Nest home.
|
|
31
|
+
- **Google cookies and OAuth tokens are rejected on purpose.** They cover a broader Google identity than Nest Account access and are a different auth surface this plugin does not implement.
|
|
32
|
+
|
|
33
|
+
Treat the token as a password-equivalent credential. Do not paste it into issues, logs, screenshots, or chat.
|
|
34
|
+
|
|
35
|
+
**Revoking it.** Sign out Nest sessions / rotate Nest account credentials from Nest's account settings, then capture a fresh token and update Homebridge.
|
|
36
|
+
|
|
37
|
+
## Security Measures
|
|
38
|
+
|
|
39
|
+
This plugin implements:
|
|
40
|
+
|
|
41
|
+
- Nest Account tokens only — Google JWT / `ya29.` shapes are rejected at config validation
|
|
42
|
+
- Secret redaction in structured logs
|
|
43
|
+
- Transport URL host allowlisting before the session token is sent
|
|
44
|
+
- Read-only thermostat publication until a write path is proven against a live device
|
|
45
|
+
- No analytics or telemetry
|
|
46
|
+
|
|
47
|
+
## Scope limits
|
|
48
|
+
|
|
49
|
+
Cameras, doorbells, Yale locks, and Google-account-only homes are out of scope. Life-safety alarm state for Protects is only published while Nest REST can refresh it; Observe-only units and Protects whose REST feed is down do not keep a frozen all-clear.
|