让你的小方/大方摄像头在HA里彻底不卡
之前有个帖[经验分享] 让你的小方/大方摄像头在HA里不那么卡分享了另一种大方接入HA的方法(一共两种)
两种我都试了,最好的效果也就是1秒1~2帧的样子
升级HA到0.90,多了一种流的接入方式,这下可以不卡看视频了!
stream:
camera:
- platform: generic
name: DaFang3
username: root
password: ismart12
authentication: basic
still_image_url: https://dafangIP/cgi-bin/currentpic.cgi
verify_ssl: false
stream_source: rtsp://dafangIP:8554/unicast
这次是真·视频 不卡了~
另外提供了新的服务可以调用
附上官方调用效果
https://youtu.be/l9eBRNBf5Zg
本帖最后由 chiunownow 于 2019-4-15 05:55 编辑
感谢,已经用上了。附上一段我的摄像头额外配置,算是做一点小参考
````yaml
timer:
motion_record_disable:
duration: '00:00:30'
shell_command:
rclone_sync_dafang_onedrive: rclone sync /home/chiunownow/DCIM/ dafang-onedrive:DAFANG-CAM
group:
motion_record:
name: 动作记录
icon: mdi:camera-enhance
entities:
- automation.motion_record_20s
- automation.motion_snapshot
automation:
- alias: motion_record_20s
trigger:
entity_id: binary_sensor.dafang_motion_sensor
platform: state
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: timer.motion_record_disable
state: 'idle'
action:
- service: script.toggle
entity_id: script.motion_record_v2
- delay: 00:00:40
- service: shell_command.rclone_sync_dafang_onedrive
- alias: motion_snapshot
trigger:
entity_id: binary_sensor.dafang_motion_sensor
platform: state
from: 'off'
to: 'on'
action:
- service: timer.start
entity_id: timer.motion_record_disable
- service: camera.snapshot
data:
entity_id: camera.dafangcgi
filename: "/home/chiunownow/DCIM/Picture/{{ now().strftime('%y%m%d-%H%M%S') }}.jpg"
- alias: turn_on_motion_record
trigger:
entity_id: group.device_tracker
platform: state
from: 'home'
to: 'not_home'
for:
minutes: 5
action:
- service: homeassistant.turn_on
entity_id: group.motion_record
- data:
message: 监测到屋主不在家,打开动作记录
service: notify.ios_nownows_iphone
- alias: turn_off_motion_record
trigger:
entity_id: group.device_tracker
platform: state
from: 'not_home'
to: 'home'
action:
- service: homeassistant.turn_off
entity_id: group.motion_record
- data:
message: 监测到屋主到家,关闭动作记录
service: notify.ios_nownows_iphone
script:
motion_record_v2:
sequence:
- service: camera.record
data_template:
entity_id: camera.dafang3
filename: "/home/chiunownow/DCIM/Video/{{ now().strftime('%y%m%d-%H%M%S') }}.mp4"
duration: "20"
lookback: "10"
````
ha监测到大方的动作传感器off-on时,录视频+快照,通过 rclone 同步到 OneDrive,再用 ifttt 监测 OneDrive 的图片和视频文件夹,新增文件时推送到 telegram
要不要说明一哈跟以前的方法的区别 同问,原来怎么接的,好像是rtsp接的:lol 终于等到不卡了,以前真的惨不忍睹。 静待新玩法! 唯一遗憾是家里有只小兴看看不能rtsp 是不是只有升级到0.90才能使用这个方法啊! 本帖最后由 新生活 于 2019-3-24 21:41 编辑
这么好,赞:)请问ffmpeg的rtsp可以这样使用吗?
情非殇 发表于 2019-3-24 17:54
要不要说明一哈跟以前的方法的区别
camera:
- platform: ffmpeg
name: DaFang3
input: -rtsp_transport tcp -i rtsp://dafang:8554/unicast
- platform: generic
name: DaFang3
username: root
password: ismart12
authentication: basic
still_image_url: https://dafang/cgi-bin/currentpic.cgi
verify_ssl: false
scan_interval: 5
第一种貌似是把视频通过ffmpeg转成图片显示出来,目测1~2帧/秒
第二种是大方自己提供的图,更新周期大概也是每秒1~2帧,并且这种方式对大方资源消耗更少(可能对HA的宿主机也好一点,毕竟不用转图了)
现在的话在缩略图下还是更新的慢,大概几秒一图
但是点进去就直接调用视频流了 tom663 发表于 2019-3-24 21:31
是不是只有升级到0.90才能使用这个方法啊!
是的,这个版本之后 0.90.1也可
从0.90版本加入的新特性 新生活 发表于 2019-3-24 21:39
这么好,赞请问ffmpeg的rtsp可以这样使用吗?
每太理解你的需求
0.90加入的这个特性,支持通用摄像头,只要有rtsp应该就可以
注意是- platform: generic不是- platform: ffmpeg