fronzbot / blinkpy

A Python library for the Blink Camera system
MIT License
548 stars 114 forks source link

Blink doorbell - Recognize presses and handle as trigger event #649

Open thfranke opened 1 year ago

thfranke commented 1 year ago

Hi,

could you please add support for the Blink Doorbell.

Pressing the doorbell should be able to trigger an event in Home Assistant.

Thank you very much! Thorsten

fronzbot commented 1 year ago

Thanks for submitting this! It's helpful because I can pin it and hopefully get some more eyeballs on it.

The biggest issue with doorbell integration is, quite simply, that I don't have one. So I can't do any testing, etc. So there's a heavy reliance on the community to find the API endpoints and implement code to test. Just wanted to be transparent about why the doorbells seem to lack features in this library

gonfalon commented 1 year ago

@fronzbot I've got a doorbell and interest in getting it to work with Home Assistant. Only problem is I haven't been able to successfully override my HA integration with changes for testing. Do you have any tips for getting that set up?

MarkusKress commented 1 year ago

You can use the door bell trigger as a trigger in an Alexa Routine. Is it possible to turn on a smart plug, wait 5 seconds and turn it off again.

There are also some arduino projects which emulates an smart home device (for example Espalexa libraray on a esp microcontroller).

Or there are commerical home automatisation tools, which offers an virtual smarthome device.

But I didn't know an other methods which works "out of the box" to trigger something in your home.

MarkusKress commented 1 year ago

I've working hard to find a solution. I've actually using IOBroker with an Commerical Account, which is able to create virtual devices for alexa and set it's status in IOBroker as a datapoint. Without IOBroker I found a solution for an ESP8266 Microcontroller, but not with Espalexa which seems not working anymore. I tried FauxmoESP (https://github.com/vintlabs/fauxmoESP) and this works in a Alexa routine. FauxmoESP creates a virtal Lamp, which can be used in a Alexa routine. This routine is triggered by the doorbell, and turn on the virtual lamp, waiting 5 sec, and turn the virtual lamp off. With the ESP it's possible to send the doorbell signal using MQTT to an house automatisiation software or turn on/off a PIN of the Microcontroller and with an relais in between, an old doorbell.

gonfalon commented 1 year ago

I ended up using Node-Red to trigger HA via an Alexa routine and a Virtual Smart Home switch.

MarkusKress commented 1 year ago

I switched to espalexa, which is more or less the same as fauxmoesp. fauxmoesp seems to be a little bit outdated. The esp simulates a hue lamp which can be used in a alexa routine. The routine switches the virtual lamp on, waiting 5 sec and switched it off. The esp send a message via MQTT and switches a PIN on / off. The pin can be used for a old doorbell using a relay.

mkmer commented 1 year ago

In order to start receiving events, this API will need to subscribe to events and move to aiohttp.
This API is not easily converted to aiohttp. I have converted two other APIs (aka I have "some" experience), this one is not "friendly" to the conversion. Also, I haven't found documentation around the subscription endpoints for blink. Anyone finds them please drop a link. They must be there, as the phone apps update very quickly.

fronzbot commented 1 year ago

There is no documentation outside of what users post here and in other forums. The Blink API is not open.

abseward commented 1 year ago

I've been trying to solve this by running a script that polls the Sync Module's get_events method and looks for button presses, then raises events.

Unfortunately the get_events method isn't working right now - I've raised an issue #757

@MarkusKress's idea about getting Alexa to trigger something downstream is inspired! I'm going to have a play with that.

mkmer commented 11 months ago

I've been doing a bit of digging - it appears that the application uses FCM (Firebase cloud messaging) to receive these notifications. When the user logs in, an FCM key is shared that is used to register for notifications. Anyone with experience receiving push messages from FCM or can point me to a good library would be helpful.

mkmer commented 11 months ago

Discussion started here: https://github.com/fronzbot/blinkpy/discussions/770