In this section we’ll walk through creating a Smart Switch and controlling it using Amazon Alexa.
Step 1 : Create a Sinric Pro account
- Visit http://portal.sinric.pro/register and sign up for a new account
Step 2 : Link your Amazon Alexa account
- 2.1 Open your Amazon Alexa app.
- 2.2 Goto Skills & Games.
- 2.3 Search for Sinric Pro.
- 2.4 Click ENABLE TO USE.
- 2.5 Enter the credentails you created in step 1.
Step 3 : Create a new device: Switch
- 3.1 Login to your Sinric Pro account.
- 3.2 Go to Devices menu on your left.
- 3.3 Click Add Device button (On top left).
- 3.4 Enter the device name SwitchOne, description My First Switch and select the type as Switch.
- 3.5 Set the Device Access Key Room and Room to the default values. (default and Living Room, respectively)
- 3.6 Click Save to create the device
- 3.7 Copy Device Id
Once you click on the save button Alexa should automatically detect the device we just created (If you completed Step 2). You should see a push notification like below in your phone.
If you did not get the push notification, you can either ask, “Alexa, discover devices”, or use the Add Device workflow in the alexa app.
Step 4 : Build A smart switch
4.1 Example below assumes a WeMos D1 Mini and associated relay shield.
- Any MCU capable of running C++ code (NodeMCU, ESP-8266, ESP-32, Arduino) can be used.
- For this example power is provided via USB
- Details such as converting line voltage to 3.3V or 5V DC are not covered here.
Step 5 : Program your device.
- 5.1 SinricPro can be used from the Arduino IDE or any modern C/C++ IDE
- 5.2 SinricPro works with PlatformIO - tested on VSCode and Jetbrains CLion.
- 5.3 Visit htpps://portal.sinric.pro and sign in.
- 5.4 Select Credentials from the left menu.
- 5.5 Copy the App Key and App Secret
- Keep these values secure. Sharing them will likely suspend your account.
- 5.6 Download the demo code from here
- 5.7 Update the APP_KEY with your App Key from step 5.4.
- 5.8 Update the APP_SECRET with your App Secret from step 5.4.
- 5.9 Update the SWITCH_ID with your Device ID from step 3.7.
- 5.10 Upload the code to your ESP module.
- 5.11 Toggle ‘SwitchOne’ in your Alexa App.
- 5.12 Each time you toggle the switch you should hear the relay click.
This document is open source. See a typo? Please create an issue