IP Webcam binary sensor

I finally have it working, and it’s sending a picture using telegram to my phone when motion is detected.

I have an issue though, I can walk through the camera, and about 10 seconds later the image is taken and sent to me, but the image was taken after the fact and I’m not in it (10+ second delay).

I’m trying to play with the sensitivity, I would love to have 10-20 images snapped and sent to me frame by frame.

I’m not quite sure what I’m doing wrong.

These cameras are trying to detect animals that run around pretty quickly :frowning:

automation.yaml:

  • alias: Send Message On Motion
    trigger:
    platform: state
    entity_id: binary_sensor.billy_android_motion
    to: ‘on’
    action:
    • service: camera.snapshot
      data:
      entity_id: camera.billy_android
      filename: ‘/tmp/photo1.jpg’
    • service: notify.telegram_billy
      data:
      message: “HEY”
      data:
      photo:
      - file: ‘/tmp/photo1.jpg’
binary_sensor.yaml
  - platform: rest
  name: billy_android_motion
  sensor_class: motion
  resource: http://192.168.1.96:xxxx/sensors.json?sense=motion_active
  value_template: '{{ value_json.motion_active.data[0][1][0] | round(0) }}'

You current set up may work not the way you wanted.
There is a lot of delays built into your flow:
The delay when the app detects motion, when HA update the binary sensor, the action telling the phone to take a photo.
These all add up.

I faced the same dilemma, my cheap android phone/IP Webcam just not fast enough for such task.

There are couple of ways I tried to get a set of snapshots around detection if you are interested.

I started playing with it set to only 5 on motion, it is trigger as I type on the table, but only maybe once per minute.
Is there a polling that only updates one of the sensors every minute or so?

I have about 15 android phones all around the quality of Android S3, with the exception of my Note8.

I’m using the note8 for testing, it should be pretty good… so my configuration for sure is bad :frowning:

  1. Delay when app detects motion
  2. Delay when binary sensor detects motion
  3. Action to save a photo
  4. Action to message and upload the photo

The 4th would be OK, if I could have the first 3 in under a second or so.

By app, do you mean the Android Webcam IP app itself? can I increase polling?
is HA throttling my updates on the binary sensor ?

I’m no expert on HA but with S3, I think the main delays are from interaction between android/app and HA up to the point the camera takes a snapshot.

Yes, you can play with sensitivity in the IP Webcam app but be aware of false positives. The way I understand IP Webcam app since most android devices don’t have PIR type sensor, it compares images to detect ‘motion’. So it needs to ‘see’ at least an image with movement before it triggers the motion detection. If you try to capture a speeding car on a highway, probably you’ll never see a snapshot of the car.

My workaround for my much slower android devices is to have continuous images captured every x sec or continuous video feed which I can extract frames and then when motion is detected, I grab a set of snapshots, maybe 5 or even 10 sec before the detection, depending on your devices performance.
Since I’m using html5 and ios notification, I compile the set into animated gif for easy viewing.

Hope that helps.

I believe HA does polling at 30sec for binary sensors, you can change that setting, but it may affect performance. If I remember right I changed it to 10sec, but I still found that too long of a delay, any time there was motion and it took the picture, whatever caused the motion was usually gone.
What I did was install Tasker on the phone, and then used that to trigger on IP Webcam motion, and then push to HA using a Restful script, which turned on the record switch for the cam (or take a picture in your case), then another script to stop recording when motion cleared. Worked very well, no delay.

Anyone know what the http hook is for the accelerometer sensor in this app? or for the gyro or magnetic one?
it’s gotta be something along the lines of…

resource: http://192.168.1.70:8080/sensors.json?sense=

but I know it’s not called that, cos I tried and it lists nothing.
Also, in the sensors graph the accelerometer is split into 3 coordinates (Ax, Ay, Az)
and just typing that in at the end of the link doesn’t work either