al-one / hass-xiaomi-miot

Automatic integrate all Xiaomi devices to HomeAssistant via miot-spec, support Wi-Fi, BLE, ZigBee devices. 小米米家智能家居设备接入Hass集成
https://miot-spec.com
Apache License 2.0
4.63k stars 659 forks source link

Video stream does't work for Xiaomi Smart doorbell 3 #803

Open remark1973 opened 2 years ago

remark1973 commented 2 years ago

Hi, Device Xiaomi Smart doorbell 3 madv.cateye.mowl3g video stream is not working I tried different options in customize file with no success Preview images are available though image

remark1973 commented 2 years ago

I managed to whatch m3u8 play list for doorbell camera stream by using last VLC version 3.0.16 in Windows 10 In HA I see errors in log: Error from stream worker: Error demuxing stream: [Errno 1094995529] Invalid data found when processing input: 'https://xxx'; last error log: [mov,mp4,m4a,3gp,3g2,mj2] stream 0, offset 0x80a: partial file 7:43:42 PM – (ERROR) stream - message first occurred at 7:31:15 PM and shows up 12 times Found duplicated MOOV Atom. Skipped it 7:43:42 PM – (WARNING) components/stream/worker.py - message first occurred at 7:31:15 PM and shows up 24 times Audio stream not found 7:43:39 PM – (WARNING) stream - message first occurred at 7:31:12 PM and shows up 12 times

Another way to see m3u8 camera stream by command ffmpeg -allowed_extensions ALL -protocol_whitelist file,http,https,tcp,tls,crypto -i "1664201078084.m3u8" -c:v copy -c:a copy -f mp4 "1664201078084.mp4"

Hope it will help to solve the issue in the integration

al-one commented 2 years ago

There's nothing I can do for video stream.

remark1973 commented 2 years ago

Now I understand the reason. TUTK SDK needs to use in order to get P2P live stream from camera. I analyzed IP traffic to understand how it works. Will try to find recent SDK and learn how to use it Currently I automate event of door bell buttom push to show m3u8 on android tv VLC player. Thank you for your work!

al-one commented 2 years ago

Share with me if you have any progress, thanks!

jzmdjinn commented 1 year ago

Now I understand the reason. TUTK SDK needs to use in order to get P2P live stream from camera. I analyzed IP traffic to understand how it works. Will try to find recent SDK and learn how to use it Currently I automate event of door bell buttom push to show m3u8 on android tv VLC player. Thank you for your work!

Hi. I'm also using this doorbell in Home Assistant. You were mentioning that you automate the "event of doorbell button push". How do you get the event? In sensors I only have Battery Level, Motion Detection and Video Doorbell.

Another question, what is the link for the video stream (m3u8)?

Thanks

Screenshot 2022-12-19 at 21 05 58
jzmdjinn commented 1 year ago

Now I understand the reason. TUTK SDK needs to use in order to get P2P live stream from camera. I analyzed IP traffic to understand how it works. Will try to find recent SDK and learn how to use it Currently I automate event of door bell buttom push to show m3u8 on android tv VLC player. Thank you for your work!

Hi. I'm also using this doorbell in Home Assistant. You were mentioning that you automate the "event of doorbell button push". How do you get the event? In sensors I only have Battery Level, Motion Detection and Video Doorbell.

Another question, what is the link for the video stream (m3u8)?

Thanks

Screenshot 2022-12-19 at 21 05 58

@remark1973

mo1seev commented 1 year ago

Join to the question. @remark1973 please, can you tell us how to capture m3u8 stream from this doorbell?

mo1seev commented 1 year ago

@al-one hi! in the logs i see captured video in the cloud

its like: en.business.smartcamera.api.io.mi.com/common/app/m3u8?data=

Also in the Xiaomi app i cant watch real-time footage. Maybe is it possible to grab this video from cloud source and put stream to hassio?

xelemorf commented 1 year ago

Not sure if this helps but found this: https://miot-spec.org/miot-spec-v2/spec/service?type=urn:miot-spec-v2:service:p2p-stream:00007881 Parent link: https://home.miot-spec.com/s/madv.cateye.mowl3g

Chris-8318 commented 1 year ago

I had the same problem and could not see any video stream on my Xiaomie Smart Doorbell 3. I found a solution.

The problem was with my Cisco modem. In the Cisco modem wireless advanced settings CTS protection mode had to be set to “Disable”

Go to Wireless Settings/Advanced settings/ CTS Protection Mode DISABLE/Save settings and exit.

Now the video stream works fine.

Other brands of modem /router may have a similar setting that needs to be disabled.

I hope this information may be able to help someone else.

Kind regards Chris

eskrasic commented 1 year ago

Hi everyone, I tried to add my Xiaomi Doorbell today with this integration and it now exposes the new entity (in red rect): image

This new entity allows to enable automations based on doorbell events such as a doorbell ring, motion detection, doorbell movement. image

That's how the entity state looks for me: image the message in Russian says that somebody ringed the doorbell

xelemorf commented 1 year ago

Well it was a good idea, I have tried with the doorbell button pressed event.

Unfortunately it's very unrealiable and updates very slowly. In most of the cases it can take several minutes to update if it does the update at all. One of my first tries were instant, subsequent tries were delayed with several minutes, the last few just simply never got logged. I have a very decent WiFi and connection with device, that's not the issue.

The event looks like this image

We would basically need the "Title" attribute and it's content "Someone rang the doorbell." It seems I might be missing something, or it just doesn't work.

Tried these:

image

I cannot use the entity purely for this purpose (unless debugging) meaning without message filtering because I have a couple Xiaomi devices which also generate messages (like User is watching the livesteam).

eskrasic commented 1 year ago

Hi @xelemorf, i am not sure what are the causes of long responses but everything works like a charm in my case. Perhaps, it depends on a region selected in Mi Home app, but it is just a guess.

As for the filtering of a particular event, i use Conditions instead of specifying the filter in the Trigger: image The title here is "Someone rang the doorbell."

I have only one Xiaomi device and cannot try per-device filtering but i suspect one more condition will help here too.

Hope this will help for you

remark1973 commented 1 year ago

Dooirbell_ring.txt

Hi. I'm also using this doorbell in Home Assistant. You were mentioning that you automate the "event of doorbell button push". How do you get the event? In sensors I only have Battery Level, Motion Detection and Video Doorbell.

Another question, what is the link for the video stream (m3u8)?

Thanks

Hi, Here is my automation. I use helper datetime "data_videozvonka" to check if it is a new message Link to the video stream is in attribute "stream_address"

alias: Door bell ring
description: Show doorbell video call on TV
trigger:
  - platform: state
    entity_id:
      - camera.madv_mowl3g_383c_video_doorbell
condition:
  - condition: template
    value_template: >-
      {{ states('input_datetime.data_videozvonka') 

      < state_attr("camera.madv_mowl3g_383c_video_doorbell",
      "motion_video_time") }}
action:
  - service: androidtv.adb_command
    data:
      command: >-
        adb shell am start -a android.intent.action.VIEW  -t video/mp4 -d
        "{{state_attr("camera.madv_mowl3g_383c_video_doorbell",
        "stream_address")}}"
    target:
      entity_id: media_player.android_tv_xxx
  - service: input_datetime.set_datetime
    data:
      datetime: >-
        {{ state_attr("camera.madv_mowl3g_383c_video_doorbell",
        "motion_video_time") }}
    target:
      entity_id: input_datetime.data_videozvonka
mode: single
pidzi92 commented 12 months ago

How are you getting all those sensors? All I get are these. image