-
Notifications
You must be signed in to change notification settings - Fork 11
/
README.md.orig.2020-10-18_064244
166 lines (115 loc) · 6.74 KB
/
README.md.orig.2020-10-18_064244
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
[![NPM Downloads](https://img.shields.io/npm/dm/homebridge-mcuiot.svg?style=flat)](https://npmjs.org/package/homebridge-mcuiot)
# NOTICE: I'm in the process of deprecating my usage of this plugin.
And in the process of migrating all my devices to the [Tasmota](https://tasmota.github.io/docs/) firmware and the [homebridge-tasmota](https://github.com/NorthernMan54/homebridge-tasmota) plugin. With the transition I'm not changing my devices, just flashing them with Tasmota.
If someone wants to take over ownership of this codebase, please let me know.
![MCUIOT](docs/1.jpg)
<!--ts-->
* [NOTICE: I'm in the process of deprecating my usage of this plugin.](#notice-im-in-the-process-of-deprecating-my-usage-of-this-plugin)
* [Introduction](#introduction)
* [Homekit Accessories Created](#homekit-accessories-created)
* [Installation](#installation)
* [Nodemcu Device build](#nodemcu-device-build)
* [Device management](#device-management)
* [Adding devices](#adding-devices)
* [Removing devices](#removing-devices)
* [Configuration](#configuration)
* [Optional parameters](#optional-parameters)
* [Optional - Enable access to Google to log data and store graphing data](#optional---enable-access-to-google-to-log-data-and-store-graphing-data)
* [Credits](#credits)
<!-- Added by: sgracey, at: -->
<!--te-->
# Introduction
This is a homebridge platform plugin, supporting multiple ESP8266 / nodemcu device's
configured as remote sensor module. Supported sensor's include DHT22, BME280
and YL-69 Soil Moisture Sensor. Included is also monitoring of a garage door position
sensor. Also supports auto device discovery using mDNS,
removing the need to manage devices via the config.json file. Historical display of temperature data is available via HomeKit apps thats support graphing.
Full build instructions are here in the [Wiki](https://github.com/NorthernMan54/homebridge-mcuiot/wiki/Instructions-for-Beginners)
Also the YL-69 Moisture sensor will create a phantom "Leak Sensor", and will
trigger a Leak event when the amount of moisture detected crosses a defined threshold.
# Homekit Accessories Created
- DHT - Combination Temperature / Humidity Sensor
- BME - Combination Temperature / Humidity / Barometric Pressure Sensor
- YL - Water Leak Sensor
- GD - Garage Door Opener - Only reporting on position
- BAT - Reads ADC pin, and displays as a battery level
# Installation
1. Install homebridge using: npm install -g homebridge
2. Install homebridge-mcuiot using: npm install -g homebridge-mcuiot
3. Update your configuration file, see sample-config.json in this directory.
4. Install nodemcu-dht-yl69-mdns on your Nodemcu devices, and connect a DHT22 or BME280
Temperature/Humidity and YL-69 Soil Moisture sensors. See
https://github.com/NorthernMan54/homebridge-mcuiot/tree/master/nodemcu for details on the
NodeMCU build and configuration.
# Nodemcu Device build
See
https://github.com/NorthernMan54/homebridge-mcuiot/tree/master/nodemcu for details on the
NodeMCU build and configuration.
# Device management
## Adding devices
Devices are auto discovered using mDNS, and will add new devices when they appear
on mDNS. In the event that devices are not discovered, restarting homebridge will
trigger a reconciliation between the plugin and mDNS, and add missing devices.
Missing devices are not removed during startup, see below for how to remove non-existent
devices.
## Removing devices
Devices are removed using the 'Identify Accessory' function. When you use the
function from your app, it checks to see if the device is truly not responding
then removes the device. The identity function is not available in the Home app, but in others.
# Configuration
```
"bridge": {
"name": "Bart",
"username": "CC:22:3D:E3:CD:39",
"port": 51826,
"pin": "031-45-154"
},
"description": "HomeBridge",
"platforms": [
{ "platform": "mcuiot",
"name": "MCUIOT",
"debug": false,
"aliases": {
"NODE-2BA4CB": "Front Porch",
"NODE-8F8FE": "Cold Cellar",
"NODE-DC4492": "Office",
"NODE-DC4492GD": "Garage Door"
} }
],
"accessories": [ ]
}
```
## Optional parameters
- refresh - Refresh rate in seconds for data, defaults to 60 seconds
- leak - Threshold for Moisture sensor to trigger leak detected, defaults to 10%
- port - Optional, port of web server to monitor devices, defaults to 8080
- battery - Optional - BAT, percentage to set battery low alert based on reading of ADC pin.
- storage - Storage of chart graphing data for history graphing, either fs or googleDrive, defaults to fs
- spreadsheetId ( optional ): Log data to a google sheet, this is part of the URL of your spreadsheet. ie the spreadsheet ID in the URL https://docs.google.com/spreadsheets/d/abc1234567/edit#gid=0 is "abc1234567".
- aliases - Friendly names for your nodemcu's
- debug - Enable debug logging ( This is the same as enabling via command line DEBUG=MCUIOT homebridge)
# Optional - Enable access to Google to log data and store graphing data
This presumes you already have a google account, and have access to google drive/sheets already
Step 1: Turn on the Drive API
a. Use this wizard ( https://console.developers.google.com/start/api?id=sheets.googleapis.com )
to create or select a project in the Google Developers Console and automatically turn on the API. Click Continue, then Go to credentials.
b. On the Add credentials to your project page, click the Cancel button.
c. At the top of the page, select the OAuth consent screen tab. Select an Email address, enter a Product name if not already set, and click the Save button. I used 'Sheets Data Logger'
d. Select the Credentials tab, click the Create credentials button and select OAuth client ID.
e. Select the application type Other, enter the name "Drive API Quickstart", and click the Create button.
f. Click OK to dismiss the resulting dialog.
g. Click the file_download (Download JSON) button to the right of the client ID.
h. Move this file to your .homebridge and rename it logger_client_secret.json.
Step 2: Authorize your computer to access your Drive Account
a. Change to the directory where the plugin is installed i.e.
cd /usr/lib/node_modules/homebridge-mcuiot/node_modules/mcuiot-logger
b. Run the authorization module
node quickstart.js
c. Browse to the provided URL in your web browser.
If you are not already logged into your Google account, you will be prompted to log in. If you are logged into multiple Google accounts, you will be asked to select one account to use for the authorization.
d. Click the Accept button.
e. Copy the code you're given, paste it into the command-line prompt, and press Enter.
# Credits
* Homebridge communityTypes - Homespun and SphtKr
* simont77 - History Service
* agruen - Simplified setup / installation instructions