sinricpro/esp8266-esp32-sdk
关于
Library for https://sinric.pro - simple way to connect your device to Alexa, Google Home, SmartThings and cloud
开发工具实测星标增长
- 24小时
- 0
- 7天
- +1
- 15天
- +2
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文SinricPro (ESP8266 / ESP32 / RP2040)
Installation
VS Code & PlatformIO:
- Install VS Code
- Install PlatformIO
- Create a new Project and use the Library Manager to add the library to your project or add
sinricpro/SinricPromanually to yourlib_depsinplatformio.ini. - Complete
platformio.iniis available here

ArduinoIDE
- 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 / ...)

Dependencies
- Arduino core 3.x
- ArduinoJson by Benoit Blanchon (minimum Version 7.0.3)
- WebSockets by Markus Sattler (minimum Version 2.4.0)
Full user documentation
Please see here for full user documentation
Getting started
- How to control an ESP32 or ESP8266 with Alexa and Google Home (also in Deutsch, Italiano, Español)
- How to install the Sinric Pro library in Arduino IDE and PlatformIO
- Quickstart tutorials: switches, lights, sensors, cameras and more
- Amazon Alexa · Google Home · Home Assistant
See examples on GitHub
Usage
Include SinricPro-Library (SinricPro.h) and SinricPro-Device-Libraries (eg. SinricProSwitch.h)
#include <SinricPro.h>
#include <SinricProSwitch.h>
Define your credentials from SinricPro-Portal (portal.sinric.pro)
#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"
Define callback routine(s)
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
}
In setup()
// 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);
In loop()
SinricPro.handle();
How to add a device?
Syntax is
DeviceType& myDevice = SinricPro[DEVICE_ID];
Example
SinricProSwitch& mySwitch = SinricPro["YOUR-SWITCH-ID-HERE"];
How to retrieve a device for sending an event?
Syntax is
DeviceType& myDevice = SinricPro[DEVICE_ID];
Example
SinricProDoorbell& myDoorbell = SinricPro["YOUR-DOORBELL-ID-HERE"];
myDoorbell.sendDoorbellEvent();
How to send a push notification?
SinricProSwitch& mySwitch = SinricPro[SWITCH_ID];
mySwitch.sendPushNotification("Hello SinricPro!");
Device Types
- 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
Other
Local Control (LAN/UDP)
Starting with SDK v5.0.0, SinricPro devices can be controlled directly on the
local network without a cloud round-trip. Commands arrive over UDP, are
verified with the same HMAC-SHA256 credentials as cloud commands, and are
dispatched through the same capability callbacks — so existing sketches need no
changes. Disable both UDP local control and mDNS discovery with
-DSINRICPRO_NO_LOCAL_CONTROL, or disable only the mDNS announcement with
-DSINRICPRO_NOMDNS. These flags can also be defined before including SinricPro.h.
See CHANGELOG.md for the protocol and network details.
Licensing and Credits
- 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.
Support for other boards
https://github.com/sinricpro/arduino-variants-sdk
Join the community!
Join us on our Official Discord Server!
探索相关项目
加载中…