However, I receive this error in log file when trigger the notification:
16-10-23 00:46:22 homeassistant.core: Invalid service data for notify.email: extra keys not allowed @ data['data_template']. Got {'images': '- /api/camera_proxy/camera.cam_hall?token=66294480'}
Does anyone know how to attach photo from the ffmpeg camera? Or what is wrong in my templating code?
where I’m passing the entity_id and the access token that is coming from the attributes.
the Script is getting that information and taking a snapshot, saving it in a folder (I want a local copy of it) and sending the notification with PushBullet. This is coming form here: https://pypi.python.org/pypi/pushbullet.py and I have adapted to fill my needs:
from pushbullet import Pushbullet
import urllib.request, os, time, sys,getopt
def main(argv):
url = ""
camera_url = ""
try:
opts, args = getopt.getopt(argv,"hu",["iurl="])
except getopt.GetoptError:
print ('pushbullet_notification.py -u <entity_picture_url>')
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print ('pushbullet_notification.py -u <entity_picture_url>')
sys.exit()
elif opt in ("-u", "--url"):
url = arg
print ("entity_picture_url is " + url)
camera_url = "HA address" + url
local_image = "/config/homeassistant/live/www/cam_captures/" + token
print ("Final URL is is " + camera_url)
pb = Pushbullet("o.glVrNbgmxHR0i0LJw9CFmjVc5pgO1rJ4")
urllib.request.urlretrieve (camera_url, local_image)
with open(local_image, "rb") as pic:
file_data = pb.upload_file(pic, "Notification from Home Assistant", "image/jpeg")
push = pb.push_file(**file_data)
if __name__ == "__main__":
main(sys.argv[1:])
Could you please explain a bit more how your script is dealing with entity_id and access_token? The script you shared below seems like looking for ‘-h’ and ‘-u’ option, but you are sending ‘-c’ and ‘-t’ and also variable token is never assigned.