Doorbell sound via Google Home speakers

@MatthiasK I have created a POC and it was relatively easy to add notification support to an existing (virtual) lock without even having to go through the publishing / certification again.

I’m using the Node.js client library for Actions on Google but it should be pretty similar for other languages:

//Extend attribute missing in current library
interface SmartHomeV1SyncDevices1 extends SmartHomeV1SyncDevices {
  notificationSupportedByAgent: boolean;
}
...
//Include attribute on sync and add ObjectDetection trait
    const device: SmartHomeV1SyncDevices1 = {
      id: ...,
      traits: [
        'action.devices.traits.LockUnlock',
        'action.devices.traits.ObjectDetection',
      ],
      notificationSupportedByAgent: true,
      ...
    }
...
//Trigger notification
    const reportStateRequest = {
      agentUserId: ...,
      eventId: ...,
      requestId: ...,
      payload: {
        devices: {
          notifications: {
            [deviceId]: {
              ObjectDetection: {
                priority: 0,
                detectionTimestamp: Date.now(),
                objects: {
                  unclassified: 1
                },
              },
            },
          },
        },
      },
    };
    const res = await homegraphClient.devices.reportStateAndNotification({
      requestBody: reportStateRequest
    });

If the user turns on voice notifications in the lock’s settings, there will be a broadcast to all Nest speakers/displays for each ObjectDetection notification: “Someone’s at [lock name]”

Looking forward to see this natively supported!

1 Like