项目作者: aaronhktan

项目描述 :
A Homebridge plugin for an analog soil moisture sensor. Sensor <--> Arduino Dock <--UART--> Omega2 <--MQTT--> Raspberry Pi. JavaScript, Python, and the Arduino Language.
高级语言: JavaScript
项目地址: git://github.com/aaronhktan/homebridge-soil-moisture.git
创建时间: 2019-12-13T02:38:55Z
项目社区:https://github.com/aaronhktan/homebridge-soil-moisture

开源协议:MIT License

下载


Homebridge Plugin for Analog Soil Moisture Sensor

This is a Homebridge plugin for an analog soil moisture sensor, working on the Raspberry Pi 3.

The actual sensor values are read in by an Arduino, communicated to an Onion Omega2 over UART, and then sent over MQTT to a Raspberry Pi.

Configuration

Field name Description Type / Unit Default value Required?
name Name of the accessory string Y
maxAnalogReading Maximum analog reading (i.e. reading when soil is wet) int 1024 N
minAnalogReading Minimum analog reading (i.e. reading when soil is dry) int 0 N
moistureThreshold Threshold at which to notify that plant is too dry int 25 N
timeout Time since last data received until setting “Not responding” status int (min) 5 N
enableFakeGato Enable storing data in Eve Home app bool false N
fakeGatoStoragePath Path to store data for Eve Home app string (fakeGato default) N
mqttConfig Object containing some config for MQTT object N

The mqttConfig object is defined as follows:

Field name Description Type / Unit Default value Required?
url URL of the MQTT server, must start with mqtt:// string Y
soilMoistureTopic MQTT topic to which soil moisture data is received from Onion string soil_humidity N

Example Configuration

  1. {
  2. "bridge": {
  3. "name": "Homebridge",
  4. "username": "XXXX",
  5. "port": XXXX
  6. },
  7. "accessories": [
  8. {
  9. "accessory": "Soil Moisture Sensor",
  10. "name": "Pothos",
  11. "maxAnalogReading": 800,
  12. "minAnalogReading": 200,
  13. "moistureThreshold": 25,
  14. "timeout": 5,
  15. "enableFakeGato": true,
  16. "mqtt": {
  17. "url": "mqtt://192.168.0.38",
  18. "soilMoistureTopic": "plants/soilmoisture"
  19. }
  20. },
  21. ]
  22. }

Project Layout

  • All things required by Node are located at the root of the repository (i.e. package.json and index.js).
  • The rest of the code is in src, further split up by language.
    • arduino contains code that runs on the Arduino and reads in an analog value from a pin and transmits that data over UART to the Onion.
    • python contains code that runs on the Onion, reading data over UART from the Arduino and transmitting that data over MQTT to the Raspberry Pi.