『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 10021|回复: 10

[求助] 大方摄像头接入HA、homekit问题求解

[复制链接]

166

主题

620

帖子

3659

积分

论坛元老

Rank: 8Rank: 8

积分
3659
金钱
3034
HASS币
0
发表于 2018-12-14 19:56:19 | 显示全部楼层 |阅读模式
本帖最后由 ptlzx 于 2018-12-16 08:36 编辑

SD插电脑修改文件正常,但查到大方摄像头启动就显示是只读的,无法保存设置。
屏幕快照 2018-12-14 下午7.41.29.png


屏幕快照 2018-12-14 下午7.53.35.png
rtsp://dafang:8554/unicast访问正常,但HA里也显示不出实时图像
屏幕快照 2018-12-14 下午7.46.53.png
configuration.yaml:
mqtt:
  broker: 192.168.1.57
  port: 1883
  client_id: home-assistant
  keepalive: 60
  username: pi
  password: mqttpw
  discovery: true
  discovery_prefix: homeassistant
ffmpeg:
  ffmpeg_bin: /usr/bin/ffmpeg
camera:
  - platform: ffmpeg
    name: DaFang3
    input: -rtsp_transport tcp -i rtsp://dafang:8554/unicast



回复

使用道具 举报

0

主题

163

帖子

1017

积分

金牌会员

Rank: 6Rank: 6

积分
1017
金钱
854
HASS币
0
发表于 2018-12-14 21:10:27 | 显示全部楼层
我也是提示只读,换了内存卡就好了,我的卡有坏块
回复

使用道具 举报

6

主题

230

帖子

2126

积分

金牌会员

Rank: 6Rank: 6

积分
2126
金钱
1891
HASS币
20
发表于 2018-12-14 22:38:00 | 显示全部楼层
1、只读方式可能是卡的问题,换卡或者换到Windows下格式化并写入固件,我是重新写入最新的固件就解决了。
2、服务里面._开头的都是mac系统自动生成的,然后你的sd卡里面有了这些隐藏文件,这些是可以删除的,并没有什么用,这个页面往下拉一下,那些没有._开头的才是真正的服务,我是ssh登录dafang然后删除了sd卡中的._文件解决的。
3、HA网页上显示不出并不一定表示HA读取不了rtsp画面,只是网页上不显示而已,可以换个浏览器试试,或者看看大方的rtsp设置里面有没有账号密码啥的。

建议楼主可以换到Windows平台重新写下固件,或者ssh登录dafang,然后删除掉sd卡中._开头的所有文件,然后重启大方。
回复

使用道具 举报

166

主题

620

帖子

3659

积分

论坛元老

Rank: 8Rank: 8

积分
3659
金钱
3034
HASS币
0
 楼主| 发表于 2018-12-15 10:13:16 | 显示全部楼层
本帖最后由 ptlzx 于 2018-12-15 10:41 编辑
bilubin 发表于 2018-12-14 22:38
1、只读方式可能是卡的问题,换卡或者换到Windows下格式化并写入固件,我是重新写入最新的固件就解决了。
2 ...

你好,按你说的步骤现在可以保存设置,并且dafang的开关在ha中也显示出来(约莫13个开关这样),但是监控视频还是出不来。rtsp://dafang:8554/unicast又能正常看到,不知道问题出在哪?
安装ffmpeg我使用群晖docker的终端机里执行一下命令:
echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list
apt-get update
apt-get -t jessie-backports install ffmpeg
configuration.yaml代码内容如下,有错误吗?请扶正
mqtt:
  broker: 192.168.1.57
  port: 1883
  client_id: home-assistant
  keepalive: 60
  username: pi
  password: 7456869180
  discovery: true
  discovery_prefix: homeassistant
ffmpeg:
  ffmpeg_bin: /usr/bin/ffmpeg
camera:
  - platform: ffmpeg
    name: DaFang3
    input: -rtsp_transport tcp -i rtsp://root:ismart12@dafang:8554/unicast


错误信息有:
Timeout while waiting of FFmpeg
Timeout reading image.

回复

使用道具 举报

6

主题

230

帖子

2126

积分

金牌会员

Rank: 6Rank: 6

积分
2126
金钱
1891
HASS币
20
发表于 2018-12-15 10:56:42 | 显示全部楼层
ptlzx 发表于 2018-12-15 10:13
你好,按你说的步骤现在可以保存设置,并且dafang的开关在ha中也显示出来(约莫13个开关这样),但是监控 ...

将 rtsp://root:ismart12@dafang:8554/unicast修改成 rtsp://root:ismart12@你大方的IP地址:8554/unicast
回复

使用道具 举报

166

主题

620

帖子

3659

积分

论坛元老

Rank: 8Rank: 8

积分
3659
金钱
3034
HASS币
0
 楼主| 发表于 2018-12-15 12:57:42 | 显示全部楼层
bilubin 发表于 2018-12-15 10:56
将 rtsp://root:ismart12@dafang:8554/unicast修改成 rtsp://root:ismart12@你大方的IP地址:8554/unicast ...

OK了,HA出图像了,但是homekit里面没有出现相应的视频,只有一对没大用的控制开关。
屏幕快照 2018-12-15 下午12.54.11.png

IMG_0616.jpg
回复

使用道具 举报

123

主题

4626

帖子

1万

积分

管理员

囧死

Rank: 9Rank: 9Rank: 9

积分
16017
金钱
11306
HASS币
45
发表于 2018-12-15 14:40:50 | 显示全部楼层
ptlzx 发表于 2018-12-15 12:57
OK了,HA出图像了,但是homekit里面没有出现相应的视频,只有一对没大用的控制开关。

hass自带的homekit还不支持摄像头,摄像头接入暂时还得用homebridge。
回复

使用道具 举报

166

主题

620

帖子

3659

积分

论坛元老

Rank: 8Rank: 8

积分
3659
金钱
3034
HASS币
0
 楼主| 发表于 2018-12-15 17:03:53 | 显示全部楼层
本帖最后由 ptlzx 于 2018-12-15 17:09 编辑
Jones 发表于 2018-12-15 14:40
hass自带的homekit还不支持摄像头,摄像头接入暂时还得用homebridge。


尝试安装homebridge-dafang出现一下错误:

compilation terminated.
stdout

09:04:06
zmq.target.mk:95: recipe for target 'Release/obj.target/zmq/binding.o' failed
stdout

09:04:06
make: *** [Release/obj.target/zmq/binding.o] Error 1
stdout

09:04:06
make: Leaving directory '/usr/local/lib/node_modules/homebridge-dafang/node_modules/zmq/build'
stdout

09:04:06
gyp ERR! build error
stdout

09:04:06
gyp ERR! stack Error: `make` failed with exit code: 2
stdout

09:04:06
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
stdout

09:04:06
gyp ERR! stack     at ChildProcess.emit (events.js:180:13)
stdout

09:04:06
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
stdout

09:04:06
gyp ERR! System Linux 3.10.105
stdout

09:04:06
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
stdout

09:04:06
gyp ERR! cwd /usr/local/lib/node_modules/homebridge-dafang/node_modules/zmq
stdout

09:04:06
gyp ERR! node -v v9.8.0
stdout

09:04:06
gyp ERR! node-gyp -v v3.6.2
stdout

09:04:06
gyp ERR! not ok
stdout

09:04:07
[            ......] / postinstall:homebridge-dafang: info lifecycle homebridge[            ......] - postinstall: info lifecycle [email protected]~postnpm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/homebridge-dafang/node_modules/zmq):
stdout

09:04:07
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp rebuild`
stdout

09:04:07
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
stdout

09:04:07

stdout

09:04:07
+ [email protected]
stdout

09:04:07
added 465 packages in 191.326s
stdout

09:04:07

stdout

09:04:07

stdout

09:04:07
   ╭─────────────────────────────────────╮
stdout

09:04:07
   │                                     │
stdout

09:04:07
   │   Update available 5.6.0 → 6.5.0    │
stdout

09:04:07
   │     Run npm i -g npm to update      │
stdout

09:04:07
   │                                     │
stdout

09:04:07
   ╰─────────────────────────────────────╯
stdout

09:04:07

stdout

09:04:08
npm ERR! path /root/.homebridge/package.json
stdout

09:04:08
npm ERR! code ENOENT
stdout

09:04:08
npm ERR! errno -2
stdout

09:04:08
npm ERR! syscall open
stdout

09:04:08
npm ERR! enoent ENOENT: no such file or directory, open '/root/.homebridge/package.json'
stdout

09:04:08
npm ERR! enoent This is related to npm not being able to find a file.
stdout

09:04:08
npm ERR! enoent



屏幕快照 2018-12-15 下午5.04.35.png

docker里安装了mqtt,sonoff使用正常,homebridge的config.json内容如下:
{
    "platforms": [
        {
            "platform": "Dafang",
            "mqtt": {
                "hostBroker": false,
                "port": 1883,
                "host": "192.168.1.57",
                "debug": true,
            },
            "cameras": [{
                "cameraName": "My Dafang",
                "cameraRTSPStreamUrl": "rtsp://root:[email protected]:8554/unicast",
                "mqttTopic": "myhome/dafang/#",
                "disableStream": false,
                "folder": "/Users/sahilchaddha/Sahil/Recordings/",
                "segmentLength": 60,
                "maxDirSize": 2048,
                "checkStorageSizeInterval": 300,
                "recordingDirectoryPathFormat": "MMM-D-YY",
                "recordingFilenameFormat": "M_D_YYYY_ h_mm_ss_a",
                "accessories": [
                                    {
                                        "name": "Living Room Motion Sensor",
                                        "type": "richMotionSensor",
                                        "threshold": 300000
                                    },
                                    {
                                        "name": "Living Room Auto Motion Tracking Switch",
                                        "type": "autoMotionTrackingSwitch"
                                    },
                                    {
                                        "name": "Living Room Night Vision Sensor",
                                        "type": "nightVisionSensor",
                                        "threshold": 0
                                    },
                                    {
                                        "name": "Living Room Night Vision Switch",
                                        "type": "nightVisionSwitch"
                                    },
                                    {
                                        "name": "Living Room Auto Night Vision Switch",
                                        "type": "autoNightVisionSwitch"
                                    },
                                    {
                                        "name": "Horizontal Left",
                                        "type": "moveCamera",
                                        "axis": "horizontal",
                                        "direction": "left"
                                    },
                                    {
                                        "name": "Horizontal Right",
                                        "type": "moveCamera",
                                        "axis": "horizontal",
                                        "direction": "right"
                                    },
                                    {
                                        "name": "Vertical Up",
                                        "type": "moveCamera",
                                        "axis": "vertical",
                                        "direction": "up"
                                    },
                                    {
                                        "name": "Vertical Down",
                                        "type": "moveCamera",
                                        "axis": "vertical",
                                        "direction": "down"
                                    },
                                    {
                                        "name": "Record Video",
                                        "type": "recordVideo"
                                    },
                                    {
                                        "name": "Record Audio",
                                        "type": "recordAudio"
                                    },
                                    {
                                        "name": "Capture Image",
                                        "type": "captureImage"
                                    },
                                    {
                                        "name": "RPi Storage Sensor",
                                        "type": "storageSensor"
                                    },
                                    {
                                        "name": "Clear Storage Switch",
                                        "type": "clearStorage"
                                    },
                                    {
                                        "name": "Reset Streaming",
                                        "type": "resetFFMPEG"
                                    },
                                    {
                                        "name": "Motion Detection Switch",
                                        "type": "motionDetection"
                                    },
                                    {
                                        "name": "RTSPSwitch",
                                        "type": "rtspSwitch"
                                    },
                                    {
                                        "name": "MJPEG Switch",
                                        "type": "mjpegSwitch"
                                    },
                                    {
                                        "name": "Recalibrate Switch",
                                        "type": "recalibrateSwitch"
                                    },
                                    {
                                        "name": "Restart Switch",
                                        "type": "restartSwitch"
                                    },
                                    {
                                        "name": "ReMount Switch",
                                        "type": "remountSwitch"
                                    },
                                    {
                                        "name": "Camera Brightness",
                                        "type": "brightness"
                                    }
                    ],
                    "videoConfig": {
                        "source": "-rtsp_transport tcp -i [url=rtsp://root:[email protected]:8554/unicast]rtsp://root:[email protected]:8554/unicast[/url]",
                        "stillImageSource": "-rtsp_transport http -i [url=rtsp://root:[email protected]:8554/unicast]rtsp://root:[email protected]:8554/unicast[/url] -vframes 1 -r 1",
                        "maxStreams": 5,
                        "maxWidth": 1280,
                        "maxHeight": 720,
                        "maxFPS": 25,
                        "vcodec": "h264",
                        "debug": true
                }
            },
            {
                "cameraName": "My Entrance Camera",
                "cameraRTSPStreamUrl": "rtsp://root:[email protected]:8554/unicast",
                "mqttTopic": "myhome/fang2/#",
                "folder": "/Users/sahilchaddha/Sahil/Recordings/",
                "accessories": [
                                    {
                                        "name": "Living Room Motion Sensor",
                                        "type": "richMotionSensor",
                                        "threshold": 300000
                                    }
                    ]
            }]
        }
    ]
}



大方的mqtt.conf内容如下:
USER=pi
PASS=pipw123
HOST=192.168.1.57
PORT=1883

LOCATION="myhome"
DEVICE_NAME="dafang"

TOPIC="$LOCATION/$DEVICE_NAME"

AUTODISCOVERY_PREFIX="homeassistant"

回复

使用道具 举报

123

主题

4626

帖子

1万

积分

管理员

囧死

Rank: 9Rank: 9Rank: 9

积分
16017
金钱
11306
HASS币
45
发表于 2018-12-15 17:04:52 | 显示全部楼层
ptlzx 发表于 2018-12-15 17:03
尝试安装homebridge-dafang出现一下错误:


homebridge就没必要dafang了吧,直接rtsp接入。具体别问我,搜论坛。
回复

使用道具 举报

166

主题

620

帖子

3659

积分

论坛元老

Rank: 8Rank: 8

积分
3659
金钱
3034
HASS币
0
 楼主| 发表于 2018-12-15 17:33:18 | 显示全部楼层
本帖最后由 ptlzx 于 2018-12-16 20:20 编辑
bilubin 发表于 2018-12-15 10:56
将 rtsp://root:ismart12@dafang:8554/unicast修改成 rtsp://root:ismart12@你大方的IP地址:8554/unicast ...

HA识别出来的有这些插件
    - camera.dafang3
    - switch.dafang_h264_rtsp_server
    - switch.dafang_mjpeg_rtsp_server
#    - sensor.dafang3
#    - device_tracker.dafang
    - sensor.dafang_light_sensor
    - switch.dafang_ir_filter
    - switch.dafang_ir_led
    - switch.dafang_night_mode
    - switch.dafang_night_mode_auto
    - switch.dafang_blue_led
    - switch.dafang_yellow_led
    - switch.dafang_motion_detection
    - switch.dafang_motion_tracking
    - camera.dafang_motion_snapshot
    - binary_sensor.dafang_motion_sensor
    - cover.dafang_move_leftright
    - cover.dafang_move_updown
    - switch.dafang_motion_send_mail

请教下automations.yaml文件有没有错
- alias: 'Motion detected' #运动检测
  trigger:
    payload: 'ON'
    platform: mqtt
    topic: myhome/mycamera/motion
  action:
    service: notify.ios__iphone
    data:
      title: "Motion"
      message: "detected."

- alias: 'Start motion detection when not at home' #不在家时开始运动检测
  trigger:
      platform: zone
      event: leave
      zone: zone.home
      entity_id: switch.dafang_motion_tracking
  action:
    service: switch.turn_on
    data:
      entity_id: switch.dafang_motion_detection

- alias: 'Stop motion detection when at home' #在家时停止运动检测
  trigger:
      platform: zone
      event: enter
      zone: zone.home
      entity_id: switch.dafang_motion_tracking
  action:
    service: switch.turn_off
    data:
      entity_id: switch.dafang_motion_detection


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-5-2 05:29 , Processed in 0.061493 second(s), 34 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表