GithubHelp home page GithubHelp logo

fadymaher24 / esp8266-esp32-sdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ahmedosama07/esp8266-esp32-sdk

0.0 0.0 0.0 5.86 MB

Library for https://sinric.pro - simple way to connect your device to Alexa, Google Home, SmartThings and cloud

Home Page: https://sinric.pro

C++ 98.64% C 1.36%

esp8266-esp32-sdk's Introduction

SinricPro (ESP8266 / ESP32 / RP2040)

arduino-library-badge PlatformIO Registry

Platform ESP8266 Platform ESP32

Framework

GitHub release (latest by date)

Build

Note

  1. Use the latest ESP8226/ESP32/RP2040 Arduino Core!
  2. Use the latest WebSocktes library!
  3. Use the latest ArduinoJson library!

Installation

VS Code & PlatformIO:

  1. Install VS Code
  2. Install PlatformIO
  3. Install SinricPro library by using Library Manager
  4. Use included platformio.ini file from examples to ensure that all dependent libraries will installed automaticly.

sinricpro library manager

ArduinoIDE

  1. Open Library Manager (Tools / Manage Libraries)
  2. Search for SinricPro and click Install
  3. Repeat step 2 for all dependent libraries!
  4. Open example in ArduinoIDE (File / Examples / SinricPro / ...)

ArduinoIDE Library Manager


Dependencies

ArduinoJson by Benoit Blanchon (minimum Version 6.12.0)
WebSockets by Markus Sattler (minimum Version 2.4.0)


Full user documentation

Please see here for full user documentation


Examples

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"];

Example 2 (alternatively)

  SinricProSwitch& mySwitch = SinricPro.add<SinricProSwitch>("YOUR-SWITCH-ID-HERE");

How to retrieve a device for sending an event?

Syntax is

  DeviceType& myDevice = SinricPro[DEVICE_ID];

Example 1

  SinricProDoorbell& myDoorbell = SinricPro["YOUR-DOORBELL-ID-HERE"];
  myDoorbell.sendDoorbellEvent();

Example 2 (alternatively)

  SinricPro["YOUR-DOORBELL-ID-HERE"].as<SinricProDoorbell>().sendDoorbellEvent();

How to send a push notification?

SinricProSwitch& mySwitch = SinricPro[SWITCH_ID];
mySwitch.sendPushNotification("Hello SinricPro!");

Devices

  • Switch
  • Dimmable Switch
  • Light
  • TV
  • Speaker
  • Thermostat
  • Fan (US and non US version)
  • Lock
  • Doorbell
  • Temperaturesensor
  • Motionsensor
  • Contactsensor
  • Windows Air Conditioner
  • Interior Blinds
  • Garage Door
  • Custom devices

esp8266-esp32-sdk's People

Contributors

sivar2311 avatar kakopappa avatar fngstudios avatar jpa-welten avatar italo-coelho avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.