openhab-google-assistant icon indicating copy to clipboard operation
openhab-google-assistant copied to clipboard

[Feature Request] Doorbell support (and other device types)

Open Joecorleone opened this issue 3 years ago • 6 comments

Hi,

while looking for support for the new device types in Google, I came across the extensive refactoring by @michikrug https://github.com/openhab/openhab-google-assistant/pull/175 . I am excited to seeing it deployed (I am not running my own cloud, yet). As part of the refactoring new device types such as TV, TemperatureSensor and Sensor have been added already. I was curious if there is any planned support for other device types, e.g. door bell (https://developers.google.com/assistant/smarthome/guides/doorbell). If I have missed it in the commits or if there is a different way to implement such, I would appreciate a pointer and please feel free to close this issue. Thanks

Edit: Just some reasoning behind my request. I am using a DoorWindow Contact sensor placed at the bell to detect the ringing of the doorbell. This seems to be relatively common, if you are looking for a non-permanent and cheap alternative. After adding a timeout in openHab it works quite reliably and using the cloud, one can even get notifications on the smartphone. Still, having the GA integration would be a nice bonus, especially for members in the household not using the openHab app.

Joecorleone avatar May 03 '21 10:05 Joecorleone

Hello and thanks for reaching out. I just took a look at the documentation. To implement this properly with notifications, we would need to use the State Reporting API. This is not possible because we cannot distinguish between individual users connected to the openHAB Google Assistant integration. openHAB Cloud does not transmit a unique identifier that could be used as an "agentId" for Google.

Unless someone else can prove me wrong, I have to say that this is not considered possible.

michikrug avatar May 08 '21 19:05 michikrug

Hei, thanks a lot for checking the feasibility of my request. Well, if that's a limitation with openHAB Cloud, it cannot be helped. Is that something I should bother the people at openHAB Cloud repo with?

Joecorleone avatar May 14 '21 16:05 Joecorleone

@Joecorleone could be an option

I already tried to implement a workaround in openHAB cloud and succeeded by passing the user's email in an extra header field in the HTTP response.

It is still uncertain if this use-case will ever be possible with openHAB, as the item state change is not actively pushed to either the openHAB cloud or the Google Assistant integration.

So it would require a "real add-on" to openHAB that listens to state changes and somehow notifies and updates the Google Smarthome Graph.

michikrug avatar May 16 '21 19:05 michikrug

Okay, thank you very much for clarifying.

Joecorleone avatar May 17 '21 20:05 Joecorleone

@Joecorleone FYI, I sat down today and hacked a working doorbell in my setup.

Unfortunately, this requires a lot of custom configurations like:

  • the already mentioned modified openHAB cloud instance that sends user information
  • a script invoked on every item change at the openHAB system itself that pushes the updated state to this Google integration (I wrote a small python one that can be called by rules)
  • a custom instance of this integration with Google Homegraph integration

For everyone interested in the code, have a look at my state-reporting branch.

[EDIT] Also tried it with a fake Sensor device. Works quite nice.

michikrug avatar May 21 '21 20:05 michikrug

@michikrug Wow, okay, that's awesome. I guess it is time to set up my own openHAB cloud instance. Excited to see it in action. Thanks again

Joecorleone avatar May 23 '21 16:05 Joecorleone