Hacking the XiaomiFang Wifi camera

where can I set the date and time? because it doesn’t sync…

Which firmware are you using? What time should it say (today is 3 October 2018).

What is the output of the

 date

Comnand?

I’m sorry, I mean set time… Cz my position at UTC+7 not UTC-8

Please answer my questions.

anyone know if it’s possible to consume cgi-bin/getpicture from the camera in Home Assistant?
FFMPEG & RTSP is proving unreliable for me, but the feed on the camera web interface is more than adequate - I noticed that just pulls the latest snapshot from “getpicture.cgi” on a 1 second timer.

Could something like this be done in HA (lovelace) to allow viewing the images without any ffmpeg reliance?
I tried to hit the URL from a page with credentials embedded (ie. http://user:pass@<cam_ip>/cgi=bin/getpicture.cgi) but Chrome has disabled this.

1 Like

This is pretty mych what I am intersted in. Have you uploaded to github?

Hoping this will be able for hassio! https://github.com/home-assistant/home-assistant/pull/17795

This can actually be done with a simple shell script. I have this running on another server, which grabs the camera image and sends it to the Pi running Hass.io via samba. It’s not very pretty, but it does the trick

Something like this:

#!/bin/sh
while sleep 1; do
curl --insecure https://root:[email protected]/cgi-bin/currentpic.cgi --output camcapture.jpg
smbclient \\your.pi.ip.here\config\www -U smbuser%smbpass-c ‘put ./camcapture.jpg camcapture.jpg’

Then set up the camera as a local file in configuration.yaml:

camera:
  - platform: local_file
    name: Inngangsparti
    file_path: /config/www/inngangsparti.jpg

@lolouk44 Hi , the Dafang cameras connect to motion , could you please let me know the resolution , bitrate and frames/sec you use in the Dafang-Hacks ? Thanks

I used all default options in the hacks. I set it up > 6 months ago I don’t remember the specifics I’m afraid

Thanks.I will download the last repo and try as it is.

Hi,

thanks for your interest. I made my sources available here:

Let me know what you think !

Lars

1 Like

Thanks will look into it!

HI,

I have a xiaofang 720p using in my HA bu Synology. I want create an automation that when doors is opened, send me a notification with an image by telegram.

Someone did this?

Please help!

thanks

Running hassio so seems it is not something I can use unfortunately. But this has been merged so hopefully the dafang with custom fw can be used with that. https://github.com/home-assistant/home-assistant/pull/17795

Do you have a door sensor, or do you want the camera to detect that the door has opened?

Hi, i have door sensor.

But i want see also how synology uses motion detection :slight_smile:

So, I want to send every snapshot taken on motion by dafang to a telegram group. Telegram is all set.

I dont want to send as link. How do I save locally and then send?

Something like this:

- alias: Send motion image
  trigger:
    platform: state
    entity_id: binary_sensor.dafang_motion_sensor
    from: 'off'
    to: 'on'
  action:
    - service: camera.snapshot
      data:
        entity_id: camera.dafang
        filename: '/config/www/snapshot.jpg'
    -  service: notify.telegram
       data:
         title: Send image
         message: "Motion detected"
         data:
           photo:
             - file: '/config/www/snapshot.jpg'
               caption: Snapshot
3 Likes

Thank you very much. Seems to work!

I have the motion mqtt message on. Can I use that as well ie camera.dafang_motion_snapshot to copy in some way to config/www/ or should I turn it off?

I guess I can add actions with delay between and take 2 more pictures and save as snapshot1.jpg and snapshot2.jpg and send?

What service to use to copy entity_id: camera.dafang_motion_snapshot?

Are you thinking about using the motion snapshot mqtt message changing as a trigger and send that? Because that would absolutely be the ideal solution. Unfortunately, as I tried this in another scenario earlier, I encountered a bug (https://github.com/home-assistant/home-assistant/issues/16004) that makes this impossible for now.

Your idea of sequential numbering would work.