frelev
October 30, 2017, 8:24pm
21
I saw that this has just been merged to dev:
home-assistant:dev
← home-assistant:snapshot-camera
opened 12:20PM - 29 Oct 17 UTC
It contains snapshot but documentation also mention motion detection service.
Does this mean that HASS can handle motion detection from any camera?
Would be really nice in that case…
EDIT: seems not to be the case
EDIT2: tried the new snapshot service but I get:
2017-10-30 22:07:00 ERROR (MainThread) [homeassistant.components.camera] Can’t write /tmp/, no access to path!
Tried home dir for HASS too, same error
Anyone succeeded?
arsaboo
(Arsaboo)
October 30, 2017, 9:11pm
22
DO you have the /tmp directory in the .homeassistant
folder? Check permissions to make sure it has the right owner.
frelev
October 30, 2017, 9:25pm
23
Yes, the folder is there and everything has owner pi. Chmod 777 too just to be sure
arsaboo
(Arsaboo)
October 30, 2017, 9:29pm
24
I think it should be owner homeassistant
. Check the owner of the other files?
frelev
October 30, 2017, 9:32pm
25
I run HASS with pi so it should be OK I guess, I´m not in virtual env either.
arsaboo
(Arsaboo)
October 30, 2017, 9:33pm
26
Well, it is not working, so something is not right
In my experience, HA does not behave well if permissions are not set properly.
frelev
October 30, 2017, 9:34pm
27
I agree, I´ll wait for someone else to try it
Appears that on my pi images are saved in the folder /home/pi/Desktop/hass-cam
. However whenever I create a folder tmp
and assign write permissions to it I still get the error:
2017-11-05 07:04:16 ERROR (MainThread) [homeassistant.components.camera] Can't write /tmp/test.jpg, no access to path!
Have raised an issue
mu3
(Jason)
November 5, 2017, 3:38pm
30
The docs have also been updated.
cheers
for those who use newer versions from foscam my foscam app also has the option to take a snapshot and save it in a predefined directory.
I believe this could be closed now
ViperRNMC
(Viper Rnmc)
November 9, 2017, 9:11am
34
Yes, it works great.
Is it possible to do this feature also for capture a movie for x seconds?
1 Like
If there isn’t a feature request for that then I would add one For the raspberry pi camera this is feasible, not sure about all other cameras.
Cheers
ViperRNMC
(Viper Rnmc)
November 9, 2017, 3:11pm
36
I use an rtsp stream, with ffmpeg I could capture now, but full integration would be nicer
1 Like
I created my config according to @mikenolet ’s answer: ffmpeg_motion binary sensor as trigger with automation taking 3 snapshots and then sending it via Telegram. This is using a Reolink IP cam.
binary_sensor:
- name: cam01
platform: ffmpeg_motion
input: rtsp://[user]:[password]@[ip]:554/h264Preview_01_sub
reset: 120
shell_command (to take the snapshots):
camera_take_snapshot: >
/usr/bin/wget http://[ip]/cgi-bin/api.cgi?cm[user]&channel=0&rs=1234567890&user=[user]&password=[password] -O {{filename}}
And finally
automation:
- alias: 'Motion Notify'
hide_entity: True
trigger:
- platform: state
entity_id: binary_sensor.cam01
to: 'on'
action:
- service: shell_command.camera_take_snapshot
data:
filename: /home/user/.homeassistant/data/camera_snapshots/snap1.jpg
- delay:
seconds: 5
- service: shell_command.camera_take_snapshot
data:
filename: /home/user/.homeassistant/data/camera_snapshots/snap2.jpg
- delay:
seconds: 5
- service: shell_command.camera_take_snapshot
data:
filename: /home/user/.homeassistant/data/camera_snapshots/snap3.jpg
- delay:
seconds: 1
- service: notify.telegram
data:
message: 'cam01 Motion!'
data:
photo:
- file: /home/user/.homeassistant/data/camera_snapshots/snap1.jpg
caption: cam01
- file: /home/user/.homeassistant/data/camera_snapshots/snap2.jpg
- file: /home/user/.homeassistant/data/camera_snapshots/snap3.jpg
1 Like
I create my own proyect, if you want ideas, and before notification, you can see all motions, not only three.
I create my own gallery for image/video motion detection in my home, i use this proyect “motion” for write images and video when motion is detected
Then i create a image/video gallery for show all motion detection as a custom panel in Home Assistant
Its possible to use only for show images in raspberry local disk through hass apps and interfaces.
if you know how to, you can try it and help me with some ideas.
In my repository you can see visualization´s examples
Thanks and sorry for my …
pembo
July 6, 2018, 4:56pm
39
I do similar but rather than have a script to capture the cam image, I do it like this:
notifyalarm:
alias: Notify Alarm Trip
sequence:
- service: telegram_bot.send_message
data:
message: "Alarm Tripped"
target: [xxxxxxxxx, yyyyyyyyy]
#send cam
- service: telegram_bot.send_photo
data:
url: 'http://<ip>:8123/api/camera_proxy/<entityname>?token=zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'
target: [xxxxxxxxxx, yyyyyyyyy]
You can grab the image url from the HASS interface, but you’ll need to change it to camera_proxy rather than the stream and then it’ll grab a still straight from HASS.
1 Like
I couldn’t get yours to work and gave up.