-
Notifications
You must be signed in to change notification settings - Fork 1
/
DoorLock.ino
44 lines (31 loc) · 1 KB
/
DoorLock.ino
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
#include "HomeSpan.h"
#include "Doorbell.h"
#include "Lock.h"
int doorbellPin = 15; //input pin from doorbell, the other cable must go to GND
int relayPin = 22; // choose a pin to control the relay
void setup()
{
Serial.begin(115200);
homeSpan.setLogLevel(1);
homeSpan.setPairingCode("11122333");
homeSpan.setQRID("111-22-333");
homeSpan.setWifiCredentials("WIFI_NAME","WIFI_PASSWORD"); // change credentials
homeSpan.begin(Category::Other,"Intercom");
// set pins as dry contact
pinMode(relayPin, OUTPUT);
new SpanAccessory();
new Service::AccessoryInformation();
new Characteristic::Identify();
new Characteristic::Name("Doorbell");
new DoorBell(doorbellPin);
new SpanAccessory();
new Service::AccessoryInformation();
new Characteristic::Identify();
new Characteristic::Name("Lock Button");
new DoorLock(relayPin);
} // end of setup()
//////////////////////////////////////
void loop()
{
homeSpan.poll();
}