- Install VS Code
- Install PlatformIO
- Create a new Project
- Use the Library Manager to add the library to your project or add
sinricpro/SinricPro
manually to yourlib_deps
inplatformio.ini
.
- Open Library Manager (Tools / Manage Libraries)
- Search for SinricPro and click Install
- Repeat step 2 for all dependent libraries!
- Open example in ArduinoIDE (File / Examples / SinricPro / ...)
- ArduinoJson by Benoit Blanchon (minimum Version 7.0.3)
- WebSockets by Markus Sattler (minimum Version 2.4.0)
Please see here for full user documentation
See examples on GitHub
#include <SinricPro.h>
#include <SinricProSwitch.h>
#define APP_KEY "YOUR-APP-KEY" // Should look like "de0bxxxx-1x3x-4x3x-ax2x-5dabxxxxxxxx"
#define APP_SECRET "YOUR-APP-SECRET" // Should look like "5f36xxxx-x3x7-4x3x-xexe-e86724a9xxxx-4c4axxxx-3x3x-x5xe-x9x3-333d65xxxxxx"
#define SWITCH_ID "YOUR-DEVICE-ID" // Should look like "5dc1564130xxxxxxxxxxxxxx"
bool onPowerState(const String &deviceId, bool &state) {
Serial.printf("device %s turned %s\r\n", deviceId.c_str(), state?"on":"off");
return true; // indicate that callback handled correctly
}
// create and add a switch to SinricPro
SinricProSwitch& mySwitch = SinricPro[SWITCH_ID];
// set callback function
mySwitch.onPowerState(onPowerState);
// startup SinricPro
SinricPro.begin(APP_KEY, APP_SECRET);
SinricPro.handle();
Syntax is
DeviceType& myDevice = SinricPro[DEVICE_ID];
Example
SinricProSwitch& mySwitch = SinricPro["YOUR-SWITCH-ID-HERE"];
Syntax is
DeviceType& myDevice = SinricPro[DEVICE_ID];
Example
SinricProDoorbell& myDoorbell = SinricPro["YOUR-DOORBELL-ID-HERE"];
myDoorbell.sendDoorbellEvent();
SinricProSwitch& mySwitch = SinricPro[SWITCH_ID];
mySwitch.sendPushNotification("Hello SinricPro!");
- Switch
- Dimmable Switch
- Light
- TV
- Speaker
- Thermostat
- Fan
- Lock
- Doorbell
- Temperature Sensor
- Motion Sensor
- Contact Sensor
- Windows Air Conditioner
- Blinds
- Garage Door
- Custom devices
- Camera
- The Arduino IDE is developed and maintained by the Arduino team. The IDE is licensed under GPL.
- ArduinoJson is licensed under the MIT.
- WebSockets is licensed under the GNU LGPL.
- The PlatformIO is developed and maintained by the PlatformIO team. The Core is licensed under Apache License 2.0.
https://github.com/sinricpro/arduino-variants-sdk
Join us on our Official Discord Server!