Is it possible? Binary_sensor to trigger 5 camera snapshots, turn to gif and push to ios?

I’m very, very green and trying to work this out step by step but I’m on day 6 and going nowhere.

I have a teen with aspergers and ADHD so impulse control is something we struggle with.

For example, I have a wyze contact sensor on our electronic cabinet where electronics are put up after 8PM.
I have a camera inside the cabinet.
I use motioneye to manage cameras.
I can’t set Motioneye up for motion recording, because the cabinet is glass and records everytime someone walks by, so I need it to be triggered when the binary sensor is “on”
I would prefer that it take a series of snapshots, instead of video because the videos are very large.
I would then like it to take those 5 snapshots, put them in my /www/gallery/ folder and turn them into a .gif or something similar, and then either email them or somehow push them to my husband’s and my own IOS devices - If needed I can even host an album on my server and push that link.

I hope this all makes sense, if not I can try to explain further. Thanks in advance!

I push multiple snapshots to email without turning them into a gif if that helps.

- id: drive_camera_motion
  alias: 'Drive Camera Motion'
  initial_state: true
  trigger:
    platform: state
    entity_id:
    - binary_sensor.pir_drive
    from: 'off'
    to: 'on'
  condition:
  - condition: template # only every 5 minutes at most
    value_template:  "{{ (( as_timestamp(now()) - as_timestamp(state_attr('automation.drive_camera_motion', 'last_triggered')) | int(0) ) / 60 ) > 5 }}"
  action:
  - delay: 00:00:01 # first delay is allow time to move closer to camera, you can remove it
  - service: camera.snapshot
    data:
      entity_id: camera.front
      filename: '/config/www/snapshots/drive1.jpg'
  - delay: 00:00:01
  - service: camera.snapshot
    data:
      entity_id: camera.front
      filename: '/config/www/snapshots/drive2.jpg'
  - delay: 00:00:01
  - service: camera.snapshot
    data:
      entity_id: camera.front
      filename: '/config/www/snapshots/drive3.jpg'
  - service: notify.email
    data:
      title: 'Drive Movement'
      message: 'Drive movement detected'
      data:
        images:
          - /config/www/snapshots/drive1.jpg
          - /config/www/snapshots/drive2.jpg
          - /config/www/snapshots/drive3.jpg

So you use HA’s automation, right?
and you have your cameras set up in your config or camera.yaml, I assume?
Motioneye allows me to add them to my configuration but since it also allows commands/webhooks, I just assumed there’s some way to do it directly, but I’m too dumb to figure it out.
I have everything set up in node-red but with this, I can probably cobble something together, I just needed some kind of direction, so thank you for pointing me in a direction!

Yeah, I’ve never had the need to lean NodeRed and yes the cameras are configured in home assistant.

- platform: generic
  name: Front
  username: !secret camera_user
  password: !secret camera_password
  still_image_url: http://10.1.1.20/cgi-bin/viewer/video.jpg

So do you want help doing this in node red?

Preferably, which is why I posted in the Node-Red forum but I’m open to alternatives.

1 Like

I use PushBullet to send Images to my phone, so you could do something super simple like this. I am just using an Inject Node to force this for testing but you can just change that to a state node for motion.

[{"id":"be924799.49b558","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"b0d8646d.fface8","type":"inject","z":"be924799.49b558","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":180,"wires":[["f4dc234f.550bf"]]},{"id":"f4dc234f.550bf","type":"api-call-service","z":"be924799.49b558","name":"Snap","server":"d277d7e0.b4f288","version":1,"service_domain":"camera","service":"snapshot","entityId":"camera.motioneye","data":"{\"filename\":\"/config/www/camera_snapshot/Garage1.jpg\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":210,"y":240,"wires":[["a42911d0.17329"]]},{"id":"ecb45bbf.f4ed58","type":"delay","z":"be924799.49b558","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":360,"y":340,"wires":[["90bd71b8.58db4"]]},{"id":"a42911d0.17329","type":"api-call-service","z":"be924799.49b558","name":"","server":"d277d7e0.b4f288","version":1,"service_domain":"notify","service":"pb_notifier","entityId":"","data":"{\"message\":\"Stuff\",\"data\":{\"file\":\"/config/www/camera_snapshot/Garage1.jpg\"}}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":320,"y":280,"wires":[["ecb45bbf.f4ed58"]]},{"id":"90bd71b8.58db4","type":"api-call-service","z":"be924799.49b558","name":"Snap2","server":"d277d7e0.b4f288","version":1,"service_domain":"camera","service":"snapshot","entityId":"camera.motioneye","data":"{\"filename\":\"/config/www/camera_snapshot/Garage2.jpg\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":430,"y":380,"wires":[["c96caab3.c7d938"]]},{"id":"78e0fe87.8c23a","type":"api-call-service","z":"be924799.49b558","name":"Snap3","server":"d277d7e0.b4f288","version":1,"service_domain":"camera","service":"snapshot","entityId":"camera.motioneye","data":"{\"filename\":\"/config/www/camera_snapshot/Garage3.jpg\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":590,"y":520,"wires":[["1d9489b7.5ae896"]]},{"id":"568c5c97.a4c3f4","type":"delay","z":"be924799.49b558","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":560,"y":460,"wires":[["78e0fe87.8c23a"]]},{"id":"c96caab3.c7d938","type":"api-call-service","z":"be924799.49b558","name":"","server":"d277d7e0.b4f288","version":1,"service_domain":"notify","service":"pb_notifier","entityId":"","data":"{\"message\":\"Stuff\",\"data\":{\"file\":\"/config/www/camera_snapshot/Garage2.jpg\"}}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":560,"y":420,"wires":[["568c5c97.a4c3f4"]]},{"id":"1d9489b7.5ae896","type":"api-call-service","z":"be924799.49b558","name":"","server":"d277d7e0.b4f288","version":1,"service_domain":"notify","service":"pb_notifier","entityId":"","data":"{\"message\":\"Stuff\",\"data\":{\"file\":\"/config/www/camera_snapshot/Garage3.jpg\"}}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":720,"y":580,"wires":[[]]},{"id":"d277d7e0.b4f288","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]
2 Likes

So, I ended up getting something I liked going with pushbullet and motioneye’s “emulate_motion” commands and it all worked fabulously.
For a day.

Now, the mp4s that Node-red pushes to pushbullet wont play.
If I play them locally, they’re fine.
If I push to pushbullet via a service call in developer tools, they play.
But if Node-red pushes them, they wont play and it’s driving me mad. There is nothing in any error log indicating a problem.
Hopefully I can figure out what in the world is going on.