Yep, blink changed the endpoints again I don’t have any videos past May 13th with the current endpoint, but I’ve had success with the following (albeit, fields have changed which is very annoying):
Thanks @fronzbot. Unfortunately I’m seeing Cannot obtain new token for server auth. and then None is returned. I’ll do some more digging when I get some time.
Hey guys. I just made a pre-release for this fix. If you can test it locally to make sure it’s working, it would be HUGELY appreciated. Just install it with the following command:
Thanks. I’m still receiving same error. I’m on 0.90.2. It was working fine before until, as mentioned, they changed the endpoint
2019-06-04 15:40:11 ERROR (Thread-4) [blinkpy.helpers.util] Endpoint https://rest.u002.immedia-semi.com/api/v3/accounts/None/homescreen failed. Possible issue with Blink servers.
2019-06-04 15:40:11 ERROR (MainThread) [homeassistant.setup] Error during setup of component blink
[blinkpy.helpers.util] Cannot connect to server with url https://rest.u002.immedia-semi.com/api/v3/accounts/None/homescreen.
2019-06-04 15:40:10 INFO (Thread-4) [blinkpy.helpers.util] Auth token expired, attempting reauthorization.
2019-06-04 15:40:10 INFO (Thread-4) [blinkpy.blinkpy] Attempting login with https://prod.immedia-semi.com/api/v2/login
2019-06-04 15:40:10 INFO (MainThread) [homeassistant.setup] Setup of domain notify took 14.7 seconds.
2019-06-04 15:40:11 INFO (Thread-4) [blinkpy.helpers.util] Cannot connect to server with url https://rest.u002.immedia-semi.com/api/v3/accounts/None/homescreen.
2019-06-04 15:40:11 ERROR (Thread-4) [blinkpy.helpers.util] Endpoint https://rest.u002.immedia-semi.com/api/v3/accounts/None/homescreen failed. Possible issue with Blink servers.
2019-06-04 15:40:11 ERROR (MainThread) [homeassistant.setup] Error during setup of component blink
2019-06-12 10:33:05 INFO (SyncWorker_7) [blinkpy.blinkpy] Attempting login with https://prod.immedia-semi.com/login
2019-06-12 10:33:05 INFO (SyncWorker_7) [blinkpy.blinkpy] Attempting login with https://rest.piri.immedia-semi.com/login
2019-06-12 10:33:05 INFO (SyncWorker_7) [blinkpy.helpers.util] Cannot connect to server with url https://rest.piri.immedia-semi.com/login.
2019-06-12 10:33:05 INFO (SyncWorker_7) [blinkpy.helpers.util] Auth token expired, attempting reauthorization.
I got the error on 0.94.0. I updated to 0.94.2 and still get the error. Can anyone help?
OK so without being aware of this thread I implemented exactly the same solution, but instead of using a shell_command to call a python script that is accessing the HA API, I am using a python_script called from an automation. Some people might find this avoids some issues they have been having with python installations and API permissions.
"""
Capture a timestamped camera image using the service camera.snapshot.
"""
BLINK_SLEEP_TIME = 7 # seconds to wait for Blink
HA_SLEEP_TIME = 3 # seconds to wait for HA
CAMERA_ENTITY_ID = 'camera.blink_living_room'
CAMERA_NAME = 'Living_room'
now = datetime.datetime.now()
time_str = "{}_{}_{}_{}_{}_{}_{}".format(
now.year, now.month, now.day, now.hour,
now.minute, now.second, now.microsecond)
# Trigger a capture now
hass.services.call(
'blink', 'trigger_camera',
{'name': CAMERA_NAME})
time.sleep(BLINK_SLEEP_TIME)
# Update representation in HA
hass.services.call(
'blink', 'blink_update')
time.sleep(HA_SLEEP_TIME)
# Save using snapshot
folder = '/config/www/blink_{}_'.format(CAMERA_NAME)
filename = folder + time_str + '.jpg'
hass.services.call(
'camera', 'snapshot',
{'entity_id': CAMERA_ENTITY_ID,
'filename': filename})
## We need to wait for this file to be created before sending to notify pushbullet
time.sleep(HA_SLEEP_TIME)
hass.services.call(
'notify', 'pushbullet_robin', {
"message": "File saved : " + filename,
"title": "blink {} notification".format(CAMERA_NAME),
"data": {"file": filename}
})
Note that in my case the blink camera is behind a glass window, so I am not triggering off the blink PIR sensor, but actually from an independent PIR sensor on the porch
Thank you so much @fronzbot for the update to handle the changes to authorisation! I updated Home Assistant, clicked accept in the email Blink sent me and everything just works again .
In regards to my doorbell script, I was able to exec into my Home Assistant docker container to run the script manually, I clicked accept in the email, skipped the code prompt in the console and the script completed ok. As expected, if I run it again it no longer prompts for a code (as it’s been authorised previously).
I’m not sure what identifier has been authorized here and there’s the possibility that whatever it is might change. So I’m thinking I should call the Blink class with no_prompt=True. Then, my presumption is that, if the identifier does change I’ll just get another email, the script will fail that run but will be ok on the next run. Does this logic sound correct to you?
I’m not sure what identifier has been authorized here and there’s the possibility that whatever it is might change.
The identifier that they (Blink) seem to be keying off of is the device_id property. There is a uuid field that Blink also expects at login so I assume in the future THAT will be used, but so far it looks like it’s ignored.
So I’m thinking I should call the Blink class with no_prompt=True. Then, my presumption is that, if the identifier does change I’ll just get another email, the script will fail that run but will be ok on the next run. Does this logic sound correct to you?
Yep, that sounds right to me!
EDIT- worth mentioning, since you’re initializing a Blink object in your script, you could always initialize it with your own device_id so that you have control over the identifier. It’s not required but might be helpful?