Giter VIP home page Giter VIP logo

ezviz_alarm_to_baidu's Introduction

README

该插件用于HOMEASSISTANT,采用了萤石的HTTP接口和百度人脸识别V3接口,通过轮询萤石的警告列表中的人体感应消息,来获取图像,然后把图像通过百度人脸识别接口进行人脸识别


安装步骤:

  1. 下载ezviz_alarm_to_baidu目录放到HOMEASSISTANT的config/custom_components目录下
  2. 申请萤石开发平台网站百度开发者网站 的账户并创建应用拿到key,完善以下内容,并创建百度人脸库,然后在人脸库中添加人脸
sensor:
  - platform: ezviz_alarm_to_baidu
    ezviz:
      appKey: xxxxxxx  #萤石开放平台的apikey
      appSecret: xxxxxxx  #萤石开放平台的appSecret
      devices:
        - 设备序列号1
        - 设备序列号2
        #以此类推,可以添加多个,序列号可以在机身标签或软件内找到
    baidu:
      clientid: XXXXXX  #百度开发者的client_id
      clientSecret: xxxxxxxxx   #百度开发者的clientSecret
      facesgroup: group1,group2 #对应百度人脸库用户组id,用逗号分隔,上限10个
    scan_interval: 60  #间隔轮询的时间(单位秒),好像萤石的免费版有次数限制,每天1万次
  1. 把上面完善的内容加入config目录里的configuration.yml文件里
  2. 重启HOMEASSISTANT

在自动化获取信息方法:

插件在检测到人脸后,会在改变状态为True 如果检测到人脸,会在userInfo中显示json 格式为

{
  "用户组1":["用户1","用户2"],
  "用户组2":["用户3"],
  "no_user":[3]//值为list,值为识别到人脸,但是未添加到人脸库人的数量
  //.....
}

根据识别图片中人物数量显示用户组和用户名数量,用户组为人脸库的用户组id,用户为人脸库的用户id(百度好像不能在网页端进行userinfo的信息输入) 如果检测到多人,只有一部分在人脸库中,会显示"no_user",里面是人员的数量,如果检测到都不在人脸库中,者无信息 在自动化和脚本中可以用语句{{ state_attr('sensor.--实体id--', 'userInfo') }}拿到 拿到后可以循环TTS或其他用途了,具体可以参考这里

一个省请求数量的方法

可以在自动化中增加规则,什么时候开启检测,示例比如每天早上8点开启检测,晚上10点关闭检测:

#[automations.yaml]

#关闭萤石获取数据
- alias: 'disabled_change_ezviz_update_shown'
  trigger:
    platform: time
    #在每天晚上22点
    at: '22:00:00'
  action:
    service: binary_sensor.change_ezviz_is_update
    data:
      status: False

#开启萤石获取数据
- alias: 'enabled _change_ezviz_update_shown'
  trigger:
    platform: time
    #在每天早上8点
    at: '8:00:00'
  action:
    service: binary_sensor.change_ezviz_is_update
    data:
      status: True

只有给binary_sensor.change_ezviz_is_update服务发送{"status":True}就开启,False关闭

界面预览:

界面图

参考的地方

ezviz_alarm_to_baidu's People

Contributors

acdxxx177 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.