Skip to content

hhb1994/homebridge-sensor-th

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

实现传感器接到树莓派,并接入 homebridge 的功能.

可以获取到当前传感器的温度和湿度数据:

img

img

参数

支持的传感器(type)

Adafruit_Python_DHT 支持三种传感器:

  • DHT11(type=11)
  • DHT22(type=22)
  • AM2302(type=22)

通过 homebridge config.json 中的 type 进行选择(默认为 11)

引脚(source)

传感器信号源接到树莓派上的引脚.

通过 homebridge config.json 中的 source 进行选择,遵循 GPIO/BCM 方式(默认为 4)

检测类型 (dataType)

通过 homebridge config.json 中的 dataType 进行选择,默认为 0(温度)

  • 0 温度

  • 1 湿度

使用方法

安装 homebridge-sensor-th

# 使用 npm

npm i -g homebridge-sensor-th

配置 homebridge 的 config.json中的 accessories

如下:

{
  "accessories": [
    {
      "accessory": "SensorPlugin",
      "name": "湿度检测",
      "dataType": 1,
      "source": "选填,默认为 4",
      "type": "选填,可选值 11 | 22 | 2302 默认为 11"
    },
    {
      "accessory": "SensorPlugin",
      "name": "温度检测",
      "dataType": 0,
      "source": "选填,但是与上面的配置必须相同",
      "type": "选填,但是与上面的配置必须相同"
    }
  ]
}

About

树莓派连接 DHT11/22 传感器接入 homebridge

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published