Foscam Recording During Away Mode Only Using Pan/Tilt/Zoom Control and Motion Detection
Foscam Recording During Away Mode Only Using Pan/Tilt/Zoom Control and Motion Detection
OSC_KNIURp 发表于6个月前
Foscam Recording During Away Mode Only Using Pan/Tilt/Zoom Control and Motion Detection
  • 发表于 6个月前
  • 阅读 1
  • 收藏 0
  • 点赞 0
  • 评论 0

腾讯云 技术升级10大核心产品年终让利>>>   

This requires a Foscam IP Camera camera with PTZ (Pan, Tilt, Zoom) and CGI functionality (Source)

Foscam Cameras can be controlled by Home Assistant through a number of CGI commands. The following outlines examples of the switch, services, and scripts required to move between 2 preset destinations while controlling motion detection, but many other options of movement are provided in the Foscam CGI User Guide linked above.

The switch.foscam_motion will control whether the motion detection is on or off. This switch supports statecmd, which checks the current state of motion detection.

这需要具有PTZ(平移,倾斜,缩放)和CGI功能(源)的Foscam IP摄像机摄像头

Foscam相机可以由Home Assistant通过多个CGI命令来控制。 以下概述了在切换,服务和脚本控制运动检测时需要两个预设目的地的示例,但是在上面链接的Foscam CGI用户指南中还提供了许多其他运动选项。

switch.foscam_motion 将控制运动检测是否打开或关闭。 此开关支持 statecmd ,它检查运动检测的当前状态。

# Replace admin and password with an "Admin" privileged Foscam user
# Replace ipaddress with the local IP address of your Foscam
switch:
 platform: command_line
 switches:
   #Switch for Foscam Motion Detection
   foscam_motion:
     command_on: 'curl -k "https://ipaddress:443/cgi-bin/CGIProxy.fcgi?cmd=setMotionDetectConfig&isEnable=1&usr=admin&pwd=password"'
     command_off: 'curl -k "https://ipaddress:443/cgi-bin/CGIProxy.fcgi?cmd=setMotionDetectConfig&isEnable=0&usr=admin&pwd=password"'
     command_state: 'curl -k --silent "https://ipaddress:443/cgi-bin/CGIProxy.fcgi?cmd=getMotionDetectConfig&usr=admin&pwd=password" | grep -oP "(?<=isEnable>).*?(?=</isEnable>)"'
     value_template: '{{ value == "1" }}'

The service shell_command.foscam_turn_off sets the camera to point down and away to indicate it is not recording, and shell_command.foscam_turn_on sets the camera to point where I’d like to record. h of these services require preset points to be added to your camera. See source above for additional information.

shell_command.foscam_turn_off 服务设置相机指向并指示不录像,而 shell_command.foscam_turn_on 将相机设置为指向我要录像的位置。 这些服务的需要将预设点添加到您的相机。 有关其他信息,请参阅以上资料。

shell_command:
  #Created a preset point in Foscam Web Interface named Off which essentially points the camera down and away
  foscam_turn_off: 'curl -k "https://ipaddress:443/cgi-bin/CGIProxy.fcgi?cmd=ptzGotoPresetPoint&name=Off&usr=admin&pwd=password"'
  #Created a preset point in Foscam Web Interface named Main which points in the direction I would like to record
  foscam_turn_on: 'curl -k "https://ipaddress:443/cgi-bin/CGIProxy.fcgi?cmd=ptzGotoPresetPoint&name=Main&usr=admin&pwd=password"'

The script.foscam_off and script.foscam_on can be used to set the motion detection appropriately, and then move the camera. These scripts can be called as part of an automation with device_tracker triggers to set home and not_home modes for your Foscam and disable motion detection recording while home.

可以使用 script.foscam_offscript.foscam_on 来适当地设置运动检测,然后移动相机。 这些脚本可以作为自动化的一部分,使用 device_tracker 触发器来设置Foscam的 homenot_home 模式,并在 home 模式禁用运动检测记录。  

script:
 foscam_off:
   sequence:
   - service: switch.turn_off
     data:
       entity_id: switch.foscam_motion
   - service: shell_command.foscam_turn_off
 foscam_on:
   sequence:
   - service: switch.turn_off
     data:
       entity_id: switch.foscam_motion
   - service: shell_command.foscam_turn_on
   - service: switch.turn_on
     data:
       entity_id: switch.foscam_motion

To automate Foscam being set to “on” (facing the correct way with motion sensor on), I used the following simple automation:

为了使Foscam自动化设置为“开”(面向运动传感器的正确方式),我使用以下简单的自动化:

automation:
  - alias: Set Foscam to Away Mode when I leave home
    trigger:
      platform: state
      entity_id: group.family
      from: 'home'
    action:
      service: script.foscam_on
  - alias: Set Foscam to Home Mode when I arrive Home
    trigger:
      platform: state
      entity_id: group.family
      to: 'home'
    action:
      service: script.foscam_off
共有 人打赏支持
粉丝 0
博文 23
码字总数 17192
×
OSC_KNIURp
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: