Skip to content

Commit ab4cd4c

Browse files
committed
- changed SinricPro.begin() that it is not blocking
- added licence info
1 parent 75ec8da commit ab4cd4c

27 files changed

+210
-37
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ We recommend using [VS Code](https://code.visualstudio.com/) as code editor.
66

77
1. Install [VS Code](https://code.visualstudio.com/)
88
2. Install [platform.io](https://platformio.org/platformio-ide)
9-
3. Install library by using [Library Manager](https://docs.platformio.org/en/latest/librarymanager/)
9+
3. Install SinricPro library by using [Library Manager](https://docs.platformio.org/en/latest/librarymanager/)
1010
4. Follow Quickstart Instructions on [SinricPro](https://help.sinric.pro/pages/quickstart.html)
1111

1212
---
@@ -29,6 +29,9 @@ We recommend using [VS Code](https://code.visualstudio.com/) as code editor.
2929
#define signingKey "your-signing-key"
3030
#define myDeviceId "your-device-id"
3131
```
32+
*Note:*
33+
socketAuthToken may be named "APP KEY" in portal.sinric.pro
34+
signingKey may be named "APP SECRET" in portal.sinric.pro
3235
#### Define callback routine(s)
3336
```C++
3437
bool onPowerState(const String deviceId, bool &state) {

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"maintainer": true
1414
}
1515
],
16-
"version": "2.0.0.6",
16+
"version": "2.0.0.7",
1717
"frameworks": "arduino",
1818
"platforms": [
1919
"espressif8266",

src/SinricPro.h

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/*
2+
* Copyright (c) 2019 Sinric. All rights reserved.
3+
* Licensed under Creative Commons Attribution-Share Alike (CC BY-SA)
4+
*
5+
* This file is part of the Sinric Pro (https://github.com/sinricpro/)
6+
*/
7+
18
#ifndef _SINRIC_H_
29
#define _SINRIC_H_
310

@@ -147,18 +154,15 @@ void SinricProClass::handleSendQueue() {
147154
}
148155

149156
void SinricProClass::connect() {
150-
String deviceList;
151-
int i = 0;
152-
for (auto& device : devices) {
153-
if (i>0) deviceList += ";";
154-
deviceList += String(device->getDeviceId());
155-
i++;
156-
}
157+
String deviceList;
158+
int i = 0;
159+
for (auto& device : devices) {
160+
if (i>0) deviceList += ";";
161+
deviceList += String(device->getDeviceId());
162+
i++;
163+
}
157164

158-
_websocketListener.begin(serverURL, socketAuthToken, deviceList.c_str(), &receiveQueue);
159-
while (_websocketListener.isConnected() == false) { DEBUG_SINRIC("."); delay(250); }
160-
DEBUG_SINRIC("\r\n");
161-
_udpListener.begin(&receiveQueue);
165+
_websocketListener.begin(serverURL, socketAuthToken, deviceList.c_str(), &receiveQueue);
162166
}
163167

164168

@@ -175,7 +179,7 @@ bool SinricProClass::isConnected() {
175179

176180
void SinricProClass::reconnect() {
177181
DEBUG_SINRIC("SinricProClass.reconnect(): disconnecting\r\n");
178-
disconnect();
182+
stop();
179183
DEBUG_SINRIC("SinricProClass.reconnect(): wait 1second\r\n");
180184
delay(1000);
181185
DEBUG_SINRIC("SinricProClass.reconnect(): connecting\r\n");

src/SinricProConfig.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/*
2+
* Copyright (c) 2019 Sinric. All rights reserved.
3+
* Licensed under Creative Commons Attribution-Share Alike (CC BY-SA)
4+
*
5+
* This file is part of the Sinric Pro (https://github.com/sinricpro/)
6+
*/
7+
18
#ifndef __SINRICPRO_CONFIG_H__
29
#define __SINRICPRO_CONFIG_H__
310

src/SinricProContactsensor.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/*
2+
* Copyright (c) 2019 Sinric. All rights reserved.
3+
* Licensed under Creative Commons Attribution-Share Alike (CC BY-SA)
4+
*
5+
* This file is part of the Sinric Pro (https://github.com/sinricpro/)
6+
*/
7+
18
#ifndef _SINRICCONTACTSENSOR_H_
29
#define _SINRICCONTACTSENSOR_H_
310

src/SinricProDebug.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/*
2+
* Copyright (c) 2019 Sinric. All rights reserved.
3+
* Licensed under Creative Commons Attribution-Share Alike (CC BY-SA)
4+
*
5+
* This file is part of the Sinric Pro (https://github.com/sinricpro/)
6+
*/
7+
18
#ifndef __SINRICPRODEBUG_H__
29
#define __SINRICPRODEBUG_H__
310

src/SinricProDevice.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/*
2+
* Copyright (c) 2019 Sinric. All rights reserved.
3+
* Licensed under Creative Commons Attribution-Share Alike (CC BY-SA)
4+
*
5+
* This file is part of the Sinric Pro (https://github.com/sinricpro/)
6+
*/
7+
18
#ifndef _SINRICDEVICE_H_
29
#define _SINRICDEVICE_H_
310

src/SinricProDimSwitch.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/*
2+
* Copyright (c) 2019 Sinric. All rights reserved.
3+
* Licensed under Creative Commons Attribution-Share Alike (CC BY-SA)
4+
*
5+
* This file is part of the Sinric Pro (https://github.com/sinricpro/)
6+
*/
7+
18
#ifndef _SINRICDIMSWITCH_H_
29
#define _SINRICDIMSWITCH_H_
310

src/SinricProDoorbell.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/*
2+
* Copyright (c) 2019 Sinric. All rights reserved.
3+
* Licensed under Creative Commons Attribution-Share Alike (CC BY-SA)
4+
*
5+
* This file is part of the Sinric Pro (https://github.com/sinricpro/)
6+
*/
7+
18
#ifndef _SINRICDOORBELL_H_
29
#define _SINRICDOORBELL_H_
310

src/SinricProEventSender.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/*
2+
* Copyright (c) 2019 Sinric. All rights reserved.
3+
* Licensed under Creative Commons Attribution-Share Alike (CC BY-SA)
4+
*
5+
* This file is part of the Sinric Pro (https://github.com/sinricpro/)
6+
*/
7+
18
#ifndef _EVENTSENDER_H_
29
#define _EVENTSENDER_H_
310

0 commit comments

Comments
 (0)