google_nest_sdm

Library for using the Google Nest SDM API.

See https://developers.google.com/nest/device-access/api for the documentation on how to use the API.

The primary components in this library are:

  • auth: You need to implement AbstractAuth to provide credentials.
  • google_nest_subscriber: A wrapper around the pub/sub system for efficiently listening to changes in device state.
  • device_manager: Holds local state for devices, populated by the subscriber.
  • device: Holds device traits and current device state
  • event_media: For media related to camera or doorbell events.

Example usage:

    subscriber = GoogleNestSubscriber(
        auth_impl, # Your credential provider
        # Follow nest developer API docs to obtain these
        DEVICE_ACCESS_PROJECT_ID,
        SUBSCRIBER_ID,
    )
    unsub = await subscriber.start_async()
    device_manager = await subscriber.async_get_device_manager()

    for device in device_manager.devices.values():
        if device.temperature:
            temp = device.temperatureambient_temperature_celsius
            print("Device temperature: {temp:0.2f}")

    unsub()  # Unsubscribe when done
 1"""Library for using the Google Nest SDM API.
 2
 3See https://developers.google.com/nest/device-access/api for the documentation
 4on how to use the API.
 5
 6The primary components in this library are:
 7- `auth`: You need to implement `AbstractAuth` to provide credentials.
 8- `google_nest_subscriber`: A wrapper around the pub/sub system for efficiently
 9  listening to changes in device state.
10- `device_manager`: Holds local state for devices, populated by the subscriber.
11- `device`: Holds device traits and current device state
12- `event_media`: For media related to camera or doorbell events.
13
14Example usage:
15```
16    subscriber = GoogleNestSubscriber(
17        auth_impl, # Your credential provider
18        # Follow nest developer API docs to obtain these
19        DEVICE_ACCESS_PROJECT_ID,
20        SUBSCRIBER_ID,
21    )
22    unsub = await subscriber.start_async()
23    device_manager = await subscriber.async_get_device_manager()
24
25    for device in device_manager.devices.values():
26        if device.temperature:
27            temp = device.temperatureambient_temperature_celsius
28            print("Device temperature: {temp:0.2f}")
29
30    unsub()  # Unsubscribe when done
31```
32"""
33
34__all__ = [
35    "google_nest_subscriber",
36    "device_manager",
37    "device",
38    "camera_traits",
39    "device_traits",
40    "doorbell_traits",
41    "thermostat_traits",
42    "structure",
43    "auth",
44    "event_media",
45    "event",
46    "exceptions",
47    "diagnostics",
48]