SinricPro_Generic
Table of Contents
- Changelog
- Prerequisites
- Installation
- Packages' Patches
- 1. For Adafruit nRF52840 and nRF52832 boards
- 2. For Teensy boards
- 3. For Arduino SAM DUE boards
- 4. For Arduino SAMD boards
- 5. For Adafruit SAMD boards
- 6. For Seeeduino SAMD boards
- 7. For STM32 boards
- 8. For RP2040-based boards using Earle Philhower arduino-pico core
- 9. For Portenta_H7 boards using Arduino IDE in Linux
- 10. For RTL8720DN boards using AmebaD core
- Libraries' Patches
- HOWTO Use analogRead() with ESP32 running WiFi and/or BlueTooth (BT/BLE)
- Important Notes
- Full user documentation
- Important Notes
- Examples
- HOWTO Usage
- HOWTO Add a device
- How to retrieve a device for sending an event?
- Example SAMD_WiFiNINA_Switch
- Debug Terminal Output Samples
- 1. SAMD_WiFiNINA_TV on NANO_33_IOT
- 2. SAMD_WiFiNINA_Light on NANO_33_IOT
- 3. Generic_Ethernet_Blinds on nRF52 NRF52840_ITSYBITSY with W5500 Ethernet
- 4. Generic_Ethernet_Blinds on Seeeduino SEEED_XIAO_M0 with W5500 Ethernet
- 5. Generic_Ethernet_Blinds on Arduino SAMD_NANO_33_IOT with WiFiNINA
- 6. Generic_Ethernet_Blinds on Adafruit nRF52 NRF52840_FEATHER with W5500 Ethernet
- 7. Generic_Ethernet_Blinds on STM32F7 Nucleo-144 NUCLEO_F767ZI with W5500 Ethernet
- 8. WIOT_MultiSwitch_LCD on SeeedStudio SAMD51 WIO Terminal
- 9. Generic_WiFiNINA_Blinds on MBED NANO_RP2040_CONNECT
- 10. RP2040_WiFiNINA_Blinds on MBED NANO_RP2040_CONNECT
- 11. Blinds on WT32-ETH01 with ETH_PHY_LAN8720
- Devices
- Debug
- Troubleshooting
- Releases
- Issues
- TO DO
- DONE
- Contributions and Thanks
- Contributing
- License
- Copyright
Prerequisites
-
ESP32 Core 2.0.1+
for ESP32-based boards. -
ESP8266 Core 3.0.2+
for ESP8266-based boards. . To use ESP8266 core 2.7.1+ for LittleFS. -
Arduino AVR core 1.8.3+
for Arduino (Use Arduino Board Manager) for AVR boards. -
Teensy core v1.55+
for Teensy (4.1, 4.0, 3.6, 3.5, 3,2, 3.1, 3.0) boards.. -
Arduino SAM DUE core v1.6.12+
for SAM DUE ARM Cortex-M3 boards. -
Arduino SAMD core 1.8.12+
for SAMD ARM Cortex-M0+ boards. -
Adafruit SAMD core 1.7.5+
for SAMD ARM Cortex-M0+ and M4 boards (Nano 33 IoT, etc.). -
Seeeduino SAMD core 1.8.2+
for SAMD21/SAMD51 boards (XIAO M0, Wio Terminal, etc.). -
Adafruit nRF52 v1.2.0+
for nRF52 boards such as Adafruit NRF52840_FEATHER, NRF52832_FEATHER, NRF52840_FEATHER_SENSE, NRF52840_ITSYBITSY, NRF52840_CIRCUITPLAY, NRF52840_CLUE, NRF52840_METRO, NRF52840_PCA10056, PARTICLE_XENON, NINA_B302_ublox, etc. -
Arduino Core for STM32 v2.1.0+
for STM32F/L/H/G/WB/MP1 boards. -
Arduino mbed_rp2040 core 2.6.1+
for Arduino RP2040-based boards, such as Arduino Nano RP2040 Connect, RASPBERRY_PI_PICO, etc.. -
Earle Philhower's arduino-pico core v1.9.7+
for RP2040-based boards such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, etc. -
WebSockets_Generic v2.11.0+
. To install. check -
For built-in LAN8742A Ethernet:
STM32Ethernet library v1.2.0+
for built-in LAN8742A Ethernet on (Nucleo-144, Discovery).LwIP library v2.1.2+
for built-in LAN8742A Ethernet on (Nucleo-144, Discovery).
- For W5x00 Ethernet:
Ethernet library v2.0.0+
for W5100, W5200 and W5500.EthernetLarge library v2.0.0+
for W5100, W5200 and W5500.Ethernet2 library v1.0.4+
for W5500.Ethernet3 library v1.5.5+
for W5500/WIZ550io/WIZ850io/USR-ES1 with Wiznet W5500 chip.
- For ENC28J60 Ethernet:
EthernetENC library v2.0.1+
for ENC28J60. . New and BetterUIPEthernet library v2.0.10+
for ENC28J60.
-
WiFiNINA_Generic library v1.8.14-1+
. To install. check if using WiFiNINA for boards such as Nano 33 IoT, nRF52, Teensy, etc. -
Seeed_Arduino_rpcWiFi library v1.0.5+
for WIO-Terminal or boards using Realtek RTL8720DN WiFi. . To be used withSeeed_Arduino_rpcUnified library v2.1.3+
. . -
WebServer_WT32_ETH01 library v1.4.1+
to use WT32_ETH01 (ESP32 + LAN8720). To install, check .
Installation
Use Arduino Library Manager
The best and easiest way is to use Arduino Library Manager
. Search for SinricPro_Generic, then select / install the latest version.
You can also use this link for more detailed instructions.
Manual Install
Another way to install is to:
- Navigate to SinricPro_Generic page.
- Download the latest release
SinricPro_Generic-master.zip
. - Extract the zip file to
SinricPro_Generic-master
directory - Copy whole
SinricPro_Generic-master
folder to Arduino libraries' directory such as~/Arduino/libraries/
.
VS Code & PlatformIO:
- Install VS Code
- Install PlatformIO
- Install SinricPro_Generic library by using Library Manager. Search for SinricPro_Generic in Platform.io Author's Libraries
- Use included platformio.ini file from examples to ensure that all dependent libraries will installed automatically. Please visit documentation for the other options and examples at Project Configuration File
Packages' Patches
1. For Adafruit nRF52840 and nRF52832 boards
To be able to compile, run and automatically detect and display BOARD_NAME on nRF52840/nRF52832 boards, you have to copy the whole nRF52 Packages_Patches directory into Adafruit nRF52 directory (~/.arduino15/packages/adafruit/hardware/nrf52/1.2.0).
Supposing the Adafruit nRF52 version is 1.2.0. These files must be copied into the directory:
~/.arduino15/packages/adafruit/hardware/nrf52/1.2.0/platform.txt
~/.arduino15/packages/adafruit/hardware/nrf52/1.2.0/boards.txt
~/.arduino15/packages/adafruit/hardware/nrf52/1.2.0/cores/nRF5/Udp.h
~/.arduino15/packages/adafruit/hardware/nrf52/1.2.0/cores/nRF5/Print.h
~/.arduino15/packages/adafruit/hardware/nrf52/1.2.0/cores/nRF5/Print.cpp
~/.arduino15/packages/adafruit/hardware/nrf52/1.2.0/variants/NINA_B302_ublox/variant.h
~/.arduino15/packages/adafruit/hardware/nrf52/1.2.0/variants/NINA_B302_ublox/variant.cpp
~/.arduino15/packages/adafruit/hardware/nrf52/1.2.0/variants/NINA_B112_ublox/variant.h
~/.arduino15/packages/adafruit/hardware/nrf52/1.2.0/variants/NINA_B112_ublox/variant.cpp
~/.arduino15/packages/adafruit/hardware/nrf52/1.2.0/cores/nRF5/Udp.h
Whenever a new version is installed, remember to copy these files into the new version directory. For example, new version is x.yy.z These files must be copied into the directory:
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/platform.txt
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/boards.txt
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/cores/nRF5/Udp.h
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/cores/nRF5/Print.h
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/cores/nRF5/Print.cpp
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/variants/NINA_B302_ublox/variant.h
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/variants/NINA_B302_ublox/variant.cpp
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/variants/NINA_B112_ublox/variant.h
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/variants/NINA_B112_ublox/variant.cpp
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/cores/nRF5/Udp.h
2. For Teensy boards
To be able to compile and run on Teensy boards, you have to copy the files in Packages_Patches for Teensy directory into Teensy hardware directory (./arduino-1.8.16/hardware/teensy/avr/boards.txt).
Supposing the Arduino version is 1.8.16. These files must be copied into the directory:
./arduino-1.8.16/hardware/teensy/avr/boards.txt
./arduino-1.8.16/hardware/teensy/avr/cores/teensy/Stream.h
./arduino-1.8.16/hardware/teensy/avr/cores/teensy3/Stream.h
./arduino-1.8.16/hardware/teensy/avr/cores/teensy4/Stream.h
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz These files must be copied into the directory:
./arduino-x.yy.zz/hardware/teensy/avr/boards.txt
./arduino-x.yy.zz/hardware/teensy/avr/cores/teensy/Stream.h
./arduino-x.yy.zz/hardware/teensy/avr/cores/teensy3/Stream.h
./arduino-x.yy.zz/hardware/teensy/avr/cores/teensy4/Stream.h
3. For Arduino SAM DUE boards
To be able to compile and run on SAM DUE boards, you have to copy the whole SAM DUE directory into Arduino sam directory (~/.arduino15/packages/arduino/hardware/sam/1.6.12).
Supposing the Arduino SAM core version is 1.6.12. This file must be copied into the directory:
~/.arduino15/packages/arduino/hardware/sam/1.6.12/platform.txt
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied into the directory:
~/.arduino15/packages/arduino/hardware/sam/x.yy.zz/platform.txt
4. For Arduino SAMD boards
To be able to compile, run and automatically detect and display BOARD_NAME on Arduino SAMD (Nano-33-IoT, etc) boards, you have to copy the whole Arduino SAMD Packages_Patches directory into Arduino SAMD directory (~/.arduino15/packages/arduino/hardware/samd/1.8.12).
For core version v1.8.10+
Supposing the Arduino SAMD version is 1.8.12. Now only one file must be copied into the directory:
~/.arduino15/packages/arduino/hardware/samd/1.8.12/platform.txt
Whenever a new version is installed, remember to copy this files into the new version directory. For example, new version is x.yy.zz
This file must be copied into the directory:
~/.arduino15/packages/arduino/hardware/samd/x.yy.zz/platform.txt
For core version v1.8.9-
Supposing the Arduino SAMD version is 1.8.9. These files must be copied into the directory:
~/.arduino15/packages/arduino/hardware/samd/1.8.9/platform.txt
~/.arduino15/packages/arduino/hardware/samd/1.8.9/cores/arduino/Arduino.h
Whenever a new version is installed, remember to copy these files into the new version directory. For example, new version is x.yy.z
These files must be copied into the directory:
~/.arduino15/packages/arduino/hardware/samd/x.yy.z/platform.txt
~/.arduino15/packages/arduino/hardware/samd/x.yy.z/cores/arduino/Arduino.h
This is mandatory to fix the notorious Arduino SAMD compiler error. See Improve Arduino compatibility with the STL (min and max macro)
...\arm-none-eabi\include\c++\7.2.1\bits\stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
Whenever the above-mentioned compiler error issue is fixed with the new Arduino SAMD release, you don't need to copy the Arduino.h
file anymore.
5. For Adafruit SAMD boards
To be able to compile, run and automatically detect and display BOARD_NAME on Adafruit SAMD (Itsy-Bitsy M4, etc) boards, you have to copy the whole Adafruit SAMD Packages_Patches directory into Adafruit samd directory (~/.arduino15/packages/adafruit/hardware/samd/1.7.5).
Supposing the Adafruit SAMD core version is 1.7.5. This file must be copied into the directory:
~/.arduino15/packages/adafruit/hardware/samd/1.7.5/platform.txt
~/.arduino15/packages/adafruit/hardware/samd/1.7.5/cores/arduino/Print.h
~/.arduino15/packages/adafruit/hardware/samd/1.7.5/cores/arduino/Print.cpp
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied into the directory:
~/.arduino15/packages/adafruit/hardware/samd/x.yy.zz/platform.txt
~/.arduino15/packages/adafruit/hardware/samd/x.yy.zz/cores/arduino/Print.h
~/.arduino15/packages/adafruit/hardware/samd/x.yy.zz/cores/arduino/Print.cpp
6. For Seeeduino SAMD boards
To be able to compile, run and automatically detect and display BOARD_NAME on Seeeduino SAMD (XIAO M0, Wio Terminal, etc) boards, you have to copy the whole Seeeduino SAMD Packages_Patches directory into Seeeduino samd directory (~/.arduino15/packages/Seeeduino/hardware/samd/1.8.2).
Supposing the Seeeduino SAMD core version is 1.8.2. This file must be copied into the directory:
~/.arduino15/packages/Seeeduino/hardware/samd/1.8.2/platform.txt
~/.arduino15/packages/Seeeduino/hardware/samd/1.8.2/cores/arduino/Arduino.h
~/.arduino15/packages/Seeeduino/hardware/samd/1.8.2/cores/arduino/Print.h
~/.arduino15/packages/Seeeduino/hardware/samd/1.8.2/cores/arduino/Print.cpp
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied into the directory:
~/.arduino15/packages/Seeeduino/hardware/samd/x.yy.zz/platform.txt
~/.arduino15/packages/Seeeduino/hardware/samd/x.yy.zz/cores/arduino/Arduino.h
~/.arduino15/packages/Seeeduino/hardware/samd/x.yy.zz/cores/arduino/Print.h
~/.arduino15/packages/Seeeduino/hardware/samd/x.yy.zz/cores/arduino/Print.cpp
7. For STM32 boards
7.1 For STM32 boards to use LAN8720
To use LAN8720 on some STM32 boards
- Nucleo-144 (F429ZI, NUCLEO_F746NG, NUCLEO_F746ZG, NUCLEO_F756ZG)
- Discovery (DISCO_F746NG)
- STM32F4 boards (BLACK_F407VE, BLACK_F407VG, BLACK_F407ZE, BLACK_F407ZG, BLACK_F407VE_Mini, DIYMORE_F407VGT, FK407M1)
you have to copy the files stm32f4xx_hal_conf_default.h and stm32f7xx_hal_conf_default.h into STM32 stm32 directory (~/.arduino15/packages/STM32/hardware/stm32/2.1.0/system) to overwrite the old files.
Supposing the STM32 stm32 core version is 2.1.0. These files must be copied into the directory:
~/.arduino15/packages/STM32/hardware/stm32/2.1.0/system/STM32F4xx/stm32f4xx_hal_conf_default.h
for STM32F4.~/.arduino15/packages/STM32/hardware/stm32/2.1.0/system/STM32F7xx/stm32f7xx_hal_conf_default.h
for Nucleo-144 STM32F7.
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz, theses files must be copied into the corresponding directory:
~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/system/STM32F4xx/stm32f4xx_hal_conf_default.h
- `~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/system/STM32F7xx/stm32f7xx_hal_conf_default.h
7.2 For STM32 boards to use Serial1
To use Serial1 on some STM32 boards without Serial1 definition (Nucleo-144 NUCLEO_F767ZI, Nucleo-64 NUCLEO_L053R8, etc.) boards, you have to copy the files STM32 variant.h into STM32 stm32 directory (~/.arduino15/packages/STM32/hardware/stm32/2.1.0). You have to modify the files corresponding to your boards, this is just an illustration how to do.
Supposing the STM32 stm32 core version is 2.1.0. These files must be copied into the directory:
~/.arduino15/packages/STM32/hardware/stm32/2.1.0/variants/STM32F7xx/F765Z(G-I)T_F767Z(G-I)T_F777ZIT/NUCLEO_F767ZI/variant.h
for Nucleo-144 NUCLEO_F767ZI.~/.arduino15/packages/STM32/hardware/stm32/2.1.0/variants/STM32L0xx/L052R(6-8)T_L053R(6-8)T_L063R8T/NUCLEO_L053R8/variant.h
for Nucleo-64 NUCLEO_L053R8.
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz, theses files must be copied into the corresponding directory:
~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/variants/STM32F7xx/F765Z(G-I)T_F767Z(G-I)T_F777ZIT/NUCLEO_F767ZI/variant.h
~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/variants/STM32L0xx/L052R(6-8)T_L053R(6-8)T_L063R8T/NUCLEO_L053R8/variant.h
Earle Philhower arduino-pico core
8. For RP2040-based boards using8.1 To use BOARD_NAME
To be able to automatically detect and display BOARD_NAME on RP2040-based boards (RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040, GENERIC_RP2040, etc) boards, you have to copy the file RP2040 platform.txt into rp2040 directory (~/.arduino15/packages/rp2040/hardware/rp2040/1.4.0).
Supposing the rp2040 core version is 1.4.0. This file must be copied into the directory:
~/.arduino15/packages/rp2040/hardware/rp2040/1.4.0/platform.txt
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied into the directory:
~/.arduino15/packages/rp2040/hardware/rp2040/x.yy.zz/platform.txt
With core after v1.5.0, this step is not necessary anymore thanks to the PR Add -DBOARD_NAME="{build.board}" #136.
8.2 To avoid compile error relating to microsecondsToClockCycles
Some libraries, such as Adafruit DHT-sensor-library, require the definition of microsecondsToClockCycles(). To be able to compile and run on RP2040-based boards, you have to copy the files in RP2040 Arduino.h into rp2040 directory (~/.arduino15/packages/rp2040/hardware/rp2040/1.4.0).
Supposing the rp2040 core version is 1.4.0. This file must be copied to replace:
~/.arduino15/packages/rp2040/hardware/rp2040/1.4.0/cores/rp2040/Arduino.h
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied to replace:
~/.arduino15/packages/rp2040/hardware/rp2040/x.yy.zz/cores/rp2040/Arduino.h
With core after v1.5.0, this step is not necessary anymore thanks to the PR Add defs for compatibility #142.
9. For Portenta_H7 boards using Arduino IDE in Linux
To be able to upload firmware to Portenta_H7 using Arduino IDE in Linux (Ubuntu, etc.), you have to copy the file portenta_post_install.sh into mbed_portenta directory (~/.arduino15/packages/arduino/hardware/mbed_portenta/2.6.1/portenta_post_install.sh).
Then run the following command using sudo
$ cd ~/.arduino15/packages/arduino/hardware/mbed_portenta/2.6.1
$ chmod 755 portenta_post_install.sh
$ sudo ./portenta_post_install.sh
This will create the file /etc/udev/rules.d/49-portenta_h7.rules
as follows:
# Portenta H7 bootloader mode UDEV rules
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="035b", GROUP="plugdev", MODE="0666"
Supposing the ArduinoCore-mbed core version is 2.6.1. Now only one file must be copied into the directory:
~/.arduino15/packages/arduino/hardware/mbed_portenta/2.6.1/portenta_post_install.sh
Whenever a new version is installed, remember to copy this files into the new version directory. For example, new version is x.yy.zz
This file must be copied into the directory:
~/.arduino15/packages/arduino/hardware/mbed_portenta/x.yy.zz/portenta_post_install.sh
10. For RTL8720DN boards using AmebaD core
To avoid compile error relating to PROGMEM, you have to copy the file Realtek AmebaD core pgmspace.h into Realtek AmebaD directory (~/.arduino15/packages/realtek/hardware/AmebaD/3.0.10/cores/arduino/avr/pgmspace.h).
Supposing the Realtek AmebaD core version is 3.0.10. This file must be copied into the directory:
~/.arduino15/packages/realtek/hardware/AmebaD/3.0.10/cores/arduino/avr/pgmspace.h
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied into the directory:
~/.arduino15/packages/realtek/hardware/AmebaD/x.yy.zz/cores/arduino/avr/pgmspace.h
Libraries' Patches
1. For application requiring 2K+ HTML page
If your application requires 2K+ HTML page, the current Ethernet library
must be modified if you are using W5200/W5500 Ethernet shields. W5100 is not supported for 2K+ buffer. If you use boards requiring different CS/SS pin for W5x00 Ethernet shield, for example ESP32, ESP8266, nRF52, etc., you also have to modify the following libraries to be able to specify the CS/SS pin correctly.
2. For Ethernet library
To fix Ethernet library
, just copy these following files into the Ethernet library
directory to overwrite the old files:
3. For EthernetLarge library
To fix EthernetLarge library
, just copy these following files into the EthernetLarge library
directory to overwrite the old files:
4. For Ethernet2 library
To fix Ethernet2 library
, just copy these following files into the Ethernet2 library
directory to overwrite the old files:
To add UDP Multicast support, necessary for the UPnP_Generic library:
5. For Ethernet3 library
- To fix
Ethernet3 library
, just copy these following files into theEthernet3 library
directory to overwrite the old files:
6. For UIPEthernet library
To be able to compile and run on nRF52 boards with ENC28J60 using UIPEthernet library, you have to copy these following files into the UIPEthernet utility
directory to overwrite the old files:
7. For fixing ESP32 compile error
To fix ESP32 compile error
, just copy the following file into the ESP32
cores/esp32 directory (e.g. ./arduino-1.8.13/hardware/espressif/cores/esp32) to overwrite the old file:
8. For fixing ESP8266 compile error
To fix ESP8266 compile error
such as
error: 'class EthernetClass' has no member named 'init'
Ethernet.init (USE_THIS_SS_PIN);
just rename the following file in ./arduino-1.8.13/hardware/esp8266com/esp8266/libraries/Ethernet directory
- From
Ethernet.h
toEthernet_ESP8266.h
HOWTO Use analogRead() with ESP32 running WiFi and/or BlueTooth (BT/BLE)
Please have a look at ESP_WiFiManager Issue 39: Not able to read analog port when using the autoconnect example to have more detailed description and solution of the issue.
1. ESP32 has 2 ADCs, named ADC1 and ADC2
2. ESP32 ADCs functions
- ADC1 controls ADC function for pins GPIO32-GPIO39
- ADC2 controls ADC function for pins GPIO0, 2, 4, 12-15, 25-27
3.. ESP32 WiFi uses ADC2 for WiFi functions
Look in file adc_common.c
In ADC2, there're two locks used for different cases:
lock shared with app and Wi-Fi: ESP32: When Wi-Fi using the ADC2, we assume it will never stop, so app checks the lock and returns immediately if failed. ESP32S2: The controller's control over the ADC is determined by the arbiter. There is no need to control by lock.
lock shared between tasks: when several tasks sharing the ADC2, we want to guarantee all the requests will be handled. Since conversions are short (about 31us), app returns the lock very soon, we use a spinlock to stand there waiting to do conversions one by one.
adc2_spinlock should be acquired first, then adc2_wifi_lock or rtc_spinlock.
- In order to use ADC2 for other functions, we have to acquire complicated firmware locks and very difficult to do
- So, it's not advisable to use ADC2 with WiFi/BlueTooth (BT/BLE).
- Use ADC1, and pins GPIO32-GPIO39
- If somehow it's a must to use those pins serviced by ADC2 (GPIO0, 2, 4, 12, 13, 14, 15, 25, 26 and 27), use the fix mentioned at the end of ESP_WiFiManager Issue 39: Not able to read analog port when using the autoconnect example to work with ESP32 WiFi/BlueTooth (BT/BLE).
Important Notes
-
Code is restructured to provide flexibility to make it easy to support many more WiFi/Ethernet modules/shields in the future. Please delete the *.cpp files, replaced by *.hpp files, in the src directory, if *.cpp files still exist after installing new version.
-
For Adafruit nRF52, use the SPI's pin as follows:
- SS/CS = 10
- SPI_MOSI = MO(SI)
- SPI_MISO = MI(SO)
- SPI_SCK = SCK
- For Adafruit SAMD21/SAMD51, use the SPI's CS/SS pin as follows:
- Itsy-Bitsy M0/M4, Feather M0 (Express), Hallowing M0 Express, Zero, Metro M0 => use CS = 16 = pin A2
- Feather M4 (SAMD51) => use SS/CS = 9
- Grand Central M4 => use SS/CS = 53
- Hallowing M4 => use SS/CS = 10
- Metro M4 AirLift => use SS/CS = 36
To know the default CS/SS pins of not listed boards, check the related variant.h
files in
~/.arduino15/packages/adafruit/hardware/samd/x.y.zz/variants/board_name/variant.h
- For Arduino SAM DUE, use the SPI's pin as follows:
- SS/CS = 10
- SPI_MOSI = 75 ( pin 4 @ ICSP connector )
- SPI_MISO = 74 ( pin 1 @ ICSP connector )
- SPI_SCK = 76 ( pin 3 @ ICSP connector )
Full user documentation
Please see here for Full User Documentation
Examples
See Many examples on GitHub
Examples for ESP32/ESP8266
ESP32/ESP8266 examples
- AirQualitySensor
- AirQualitySensor_GP2Y1014AU0F
- Blinds
- Camera
- ContactSensor
- DimSwitch
- DoorBell
- Fan
- GarageDoor
- Light
- Light_FastLED_WS2812. New.
- RGB_LED_Stripe_5050. New.
- Lock
- Lock_with_feedback
- MotionSensor
- PowerSensor
- Speaker
- MultiSwitch_advance
- MultiSwitch_beginner
- MultiSwitch_intermediate
- Switch
- WeMosD1_mini_relay_shield
- TemperatureSensor
- Thermostat
- TV
Examples for Generic Boards (SAMD, nRF52, STM32, SAM DUE, etc.)
Generic Boards examples
Each item is a directory containing many examples designed for different kinds of boards (SAMD, nRF52, STM32, SAM DUE, etc.) and shields/modules (Ethernet/WiFiNINA)
- AirQualitySensor
- Blinds
- ContactSensor
- DimSwitch
- DoorBell
- Fan
- GarageDoor
- Light
- Lock
- MotionSensor
- PowerSensor
- Speaker
- Generic_Ethernet_Switch
- Generic_WiFiNINA_Switch
- nRF52_Ethernet_Switch
- nRF52_WiFiNINA_Switch
- SAMD_Ethernet_Switch
- SAMD_WiFiNINA_Switch
- WIO_Terminal. <===== New from v2.7.4
- TemperatureSensor
- Thermostat
- TV
Examples for WT32_ETH01
- Blinds
- GarageDoor
- Light
- Light_FastLED_WS2812.
- RGB_LED_Stripe_5050.
- Lock
- Lock_with_feedback
- MotionSensor
- PowerSensor
- Speaker
- Switch
- TemperatureSensor
- Thermostat
- TV
HOWTO Usage
Include SinricPro-Library (SinricPro_Generic.h) and SinricPro-Device-Libraries (eg. SinricProSwitch.h)
#include <SinricPro_Generic.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();
HOWTO 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();
SAMD_WiFiNINA_Switch
ExamplePlease take a look at other examples, as well.
SAMD_WiFiNINA_Switch.ino
1. File// STM32 Boards supported: Nucleo-144, Nucleo-64, Nucleo-32, Discovery, STM32F1, STM32F3, STM32F4, STM32H7, STM32L0, etc.
// SAM DUE
// Teensy 4.1, 4.0, 3.6, 3.5, 3.2/3.1, 3.0
#include "defines.h"
#include "SinricPro_Generic.h"
#include "SinricProSwitch.h"
bool myPowerState = false;
unsigned long lastBtnPress = 0;
/* bool onPowerState(String deviceId, bool &state)
Callback for setPowerState request
parameters
String deviceId (r)
contains deviceId (useful if this callback used by multiple devices)
bool &state (r/w)
contains the requested state (true:on / false:off)
must return the new state
return
true if request should be marked as handled correctly / false if not
*/
bool onPowerState(const String &deviceId, bool &state)
{
Serial.print("Device ");
Serial.print(deviceId.c_str());
Serial.print(state ? " turned on" : " turn off");
Serial.println(" (via SinricPro)");
myPowerState = state;
digitalWrite(LED_PIN, myPowerState ? LOW : HIGH);
return true; // request handled properly
}
void handleButtonPress()
{
unsigned long actualMillis = millis(); // get actual millis() and keep it in variable actualMillis
if (digitalRead(BUTTON_PIN) == LOW && actualMillis - lastBtnPress > 1000)
{
// is button pressed (inverted logic! button pressed = LOW) and debounced?
if (myPowerState)
{
// flip myPowerState: if it was true, set it to false, vice versa
myPowerState = false;
}
else
{
myPowerState = true;
}
digitalWrite(LED_PIN, myPowerState ? LOW : HIGH); // if myPowerState indicates device turned on: turn on led (builtin led uses inverted logic: LOW = LED ON / HIGH = LED OFF)
// get Switch device back
SinricProSwitch& mySwitch = SinricPro[SWITCH_ID];
// send powerstate event
mySwitch.sendPowerStateEvent(myPowerState); // send the new powerState to SinricPro server
Serial.print("Device ");
Serial.print(mySwitch.getDeviceId().toString());
Serial.print(myPowerState ? "turned on" : "turn off");
Serial.println(" (manually via flashbutton)");
lastBtnPress = actualMillis; // update last button press variable
}
}
// setup function for WiFi connection
void setupWiFi()
{
Serial.println("\n[Wifi]: Connecting");
WiFi.begin(WIFI_SSID, WIFI_PASS);
while (WiFi.status() != WL_CONNECTED)
{
Serial.print(".");
delay(250);
}
Serial.print("\n[WiFi]: IP-Address is ");
Serial.println(WiFi.localIP());
}
// setup function for SinricPro
void setupSinricPro()
{
// add device to SinricPro
SinricProSwitch& mySwitch = SinricPro[SWITCH_ID];
// set callback function to device
mySwitch.onPowerState(onPowerState);
// setup SinricPro
SinricPro.onConnected([]()
{
Serial.println("Connected to SinricPro");
});
SinricPro.onDisconnected([]()
{
Serial.println("Disconnected from SinricPro");
});
SinricPro.begin(APP_KEY, APP_SECRET);
}
// main setup function
void setup()
{
pinMode(BUTTON_PIN, INPUT_PULLUP); // GPIO 0 as input, pulled high
pinMode(LED_PIN, OUTPUT); // define LED GPIO as output
digitalWrite(LED_PIN, HIGH); // turn off LED on bootup
Serial.begin(BAUD_RATE);
while (!Serial);
Serial.println("\nStarting SAMD_WiFiNINA_Switch on " + String(BOARD_NAME));
Serial.println("Version : " + String(SINRICPRO_VERSION_STR));
setupWiFi();
setupSinricPro();
}
void loop()
{
handleButtonPress();
SinricPro.handle();
}
defines.h
2. File#ifndef defines_h
#define defines_h
#define WEBSOCKETS_NETWORK_TYPE NETWORK_WIFININA
#if defined(ESP8266) || defined(ESP32)
#error This code is not intended to run on the ESP32/ESP8266 boards ! Please check your Tools->Board setting.
#endif
#define SRP_DEBUG_PORT Serial
// Debug Level from 0 to 4
#define _SRP_LOGLEVEL_ 1
// Uncomment the following line to enable serial debug output
#define ENABLE_DEBUG true
#if ENABLE_DEBUG
#define DEBUG_PORT Serial
#define NODEBUG_WEBSOCKETS
#define NDEBUG
#endif
#if ( defined(ARDUINO_SAMD_ZERO) || defined(ARDUINO_SAMD_MKR1000) || defined(ARDUINO_SAMD_MKRWIFI1010) \
|| defined(ARDUINO_SAMD_NANO_33_IOT) || defined(ARDUINO_SAMD_MKRFox1200) || defined(ARDUINO_SAMD_MKRWAN1300) || defined(ARDUINO_SAMD_MKRWAN1310) \
|| defined(ARDUINO_SAMD_MKRGSM1400) || defined(ARDUINO_SAMD_MKRNB1500) || defined(ARDUINO_SAMD_MKRVIDOR4000) || defined(__SAMD21G18A__) \
|| defined(ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS) || defined(__SAMD21E18A__) || defined(__SAMD51__) || defined(__SAMD51J20A__) || defined(__SAMD51J19A__) \
|| defined(__SAMD51G19A__) || defined(__SAMD51P19A__) || defined(__SAMD21G18A__) )
#if defined(WIFININA_USE_SAMD)
#undef WIFININA_USE_SAMD
#endif
#define WIFININA_USE_SAMD true
#endif
#if ( defined(NRF52840_FEATHER) || defined(NRF52832_FEATHER) || defined(NRF52_SERIES) || defined(ARDUINO_NRF52_ADAFRUIT) || \
defined(NRF52840_FEATHER_SENSE) || defined(NRF52840_ITSYBITSY) || defined(NRF52840_CIRCUITPLAY) || defined(NRF52840_CLUE) || \
defined(NRF52840_METRO) || defined(NRF52840_PCA10056) || defined(PARTICLE_XENON) || defined(NINA_B302_ublox) || defined(NINA_B112_ublox) )
#if defined(WIFININA_USE_NRF528XX)
#undef WIFININA_USE_NRF528XX
#endif
#define WIFININA_USE_NRF528XX true
#endif
#if ( defined(ARDUINO_SAM_DUE) || defined(__SAM3X8E__) )
#if defined(WIFININA_USE_SAM_DUE)
#undef WIFININA_USE_SAM_DUE
#endif
#define WIFININA_USE_SAM_DUE true
#endif
#if ( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \
defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \
defined(STM32WB) || defined(STM32MP1) )
#if defined(WIFININA_USE_STM32)
#undef WIFININA_USE_STM32
#endif
#define WIFININA_USE_STM32 true
#endif
#if defined(WIFININA_USE_SAMD)
// For SAMD
#if ( defined(ARDUINO_SAMD_ZERO) && !defined(SEEED_XIAO_M0) )
#define BOARD_TYPE "SAMD Zero"
#elif defined(ARDUINO_SAMD_MKR1000)
#define BOARD_TYPE "SAMD MKR1000"
#elif defined(ARDUINO_SAMD_MKRWIFI1010)
#define BOARD_TYPE "SAMD MKRWIFI1010"
#elif defined(ARDUINO_SAMD_NANO_33_IOT)
#define BOARD_TYPE "SAMD NANO_33_IOT"
#elif defined(ARDUINO_SAMD_MKRFox1200)
#define BOARD_TYPE "SAMD MKRFox1200"
#elif ( defined(ARDUINO_SAMD_MKRWAN1300) || defined(ARDUINO_SAMD_MKRWAN1310) )
#define BOARD_TYPE "SAMD MKRWAN13X0"
#elif defined(ARDUINO_SAMD_MKRGSM1400)
#define BOARD_TYPE "SAMD MKRGSM1400"
#elif defined(ARDUINO_SAMD_MKRNB1500)
#define BOARD_TYPE "SAMD MKRNB1500"
#elif defined(ARDUINO_SAMD_MKRVIDOR4000)
#define BOARD_TYPE "SAMD MKRVIDOR4000"
#elif defined(ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS)
#define BOARD_TYPE "SAMD ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS"
#elif defined(ADAFRUIT_FEATHER_M0_EXPRESS)
#define BOARD_TYPE "SAMD21 ADAFRUIT_FEATHER_M0_EXPRESS"
#elif defined(ADAFRUIT_METRO_M0_EXPRESS)
#define BOARD_TYPE "SAMD21 ADAFRUIT_METRO_M0_EXPRESS"
#elif defined(ADAFRUIT_CIRCUITPLAYGROUND_M0)
#define BOARD_TYPE "SAMD21 ADAFRUIT_CIRCUITPLAYGROUND_M0"
#elif defined(ADAFRUIT_GEMMA_M0)
#define BOARD_TYPE "SAMD21 ADAFRUIT_GEMMA_M0"
#elif defined(ADAFRUIT_TRINKET_M0)
#define BOARD_TYPE "SAMD21 ADAFRUIT_TRINKET_M0"
#elif defined(ADAFRUIT_ITSYBITSY_M0)
#define BOARD_TYPE "SAMD21 ADAFRUIT_ITSYBITSY_M0"
#elif defined(ARDUINO_SAMD_HALLOWING_M0)
#define BOARD_TYPE "SAMD21 ARDUINO_SAMD_HALLOWING_M0"
#elif defined(ADAFRUIT_METRO_M4_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_METRO_M4_EXPRESS"
#elif defined(ADAFRUIT_GRAND_CENTRAL_M4)
#define BOARD_TYPE "SAMD51 ADAFRUIT_GRAND_CENTRAL_M4"
#elif defined(ADAFRUIT_FEATHER_M4_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_FEATHER_M4_EXPRESS"
#elif defined(ADAFRUIT_ITSYBITSY_M4_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_ITSYBITSY_M4_EXPRESS"
#elif defined(ADAFRUIT_TRELLIS_M4_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_TRELLIS_M4_EXPRESS"
#elif defined(ADAFRUIT_PYPORTAL)
#define BOARD_TYPE "SAMD51 ADAFRUIT_PYPORTAL"
#elif defined(ADAFRUIT_PYPORTAL_M4_TITANO)
#define BOARD_TYPE "SAMD51 ADAFRUIT_PYPORTAL_M4_TITANO"
#elif defined(ADAFRUIT_PYBADGE_M4_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_PYBADGE_M4_EXPRESS"
#elif defined(ADAFRUIT_METRO_M4_AIRLIFT_LITE)
#define BOARD_TYPE "SAMD51 ADAFRUIT_METRO_M4_AIRLIFT_LITE"
#elif defined(ADAFRUIT_PYGAMER_M4_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_PYGAMER_M4_EXPRESS"
#elif defined(ADAFRUIT_PYGAMER_ADVANCE_M4_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_PYGAMER_ADVANCE_M4_EXPRESS"
#elif defined(ADAFRUIT_PYBADGE_AIRLIFT_M4)
#define BOARD_TYPE "SAMD51 ADAFRUIT_PYBADGE_AIRLIFT_M4"
#elif defined(ADAFRUIT_MONSTER_M4SK_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_MONSTER_M4SK_EXPRESS"
#elif defined(ADAFRUIT_HALLOWING_M4_EXPRESS)
#define BOARD_TYPE "SAMD51 ADAFRUIT_HALLOWING_M4_EXPRESS"
#elif defined(SEEED_WIO_TERMINAL)
#define BOARD_TYPE "SAMD SEEED_WIO_TERMINAL"
#elif defined(SEEED_FEMTO_M0)
#define BOARD_TYPE "SAMD SEEED_FEMTO_M0"
#elif defined(SEEED_XIAO_M0)
#define BOARD_TYPE "SAMD SEEED_XIAO_M0"
#define USE_THIS_SS_PIN A1
#warning define SEEED_XIAO_M0 USE_THIS_SS_PIN == A1
#elif defined(Wio_Lite_MG126)
#define BOARD_TYPE "SAMD SEEED Wio_Lite_MG126"
#elif defined(WIO_GPS_BOARD)
#define BOARD_TYPE "SAMD SEEED WIO_GPS_BOARD"
#elif defined(SEEEDUINO_ZERO)
#define BOARD_TYPE "SAMD SEEEDUINO_ZERO"
#elif defined(SEEEDUINO_LORAWAN)
#define BOARD_TYPE "SAMD SEEEDUINO_LORAWAN"
#elif defined(SEEED_GROVE_UI_WIRELESS)
#define BOARD_TYPE "SAMD SEEED_GROVE_UI_WIRELESS"
#elif defined(__SAMD21E18A__)
#define BOARD_TYPE "SAMD21E18A"
#elif defined(__SAMD21G18A__)
#define BOARD_TYPE "SAMD21G18A"
#elif defined(__SAMD51G19A__)
#define BOARD_TYPE "SAMD51G19A"
#elif defined(__SAMD51J19A__)
#define BOARD_TYPE "SAMD51J19A"
#elif defined(__SAMD51J20A__)
#define BOARD_TYPE "SAMD51J20A"
#elif defined(__SAM3X8E__)
#define BOARD_TYPE "SAM3X8E"
#elif defined(__CPU_ARC__)
#define BOARD_TYPE "CPU_ARC"
#elif defined(__SAMD51__)
#define BOARD_TYPE "SAMD51"
#else
#define BOARD_TYPE "SAMD Unknown"
#endif
#elif (WIFININA_USE_SAM_DUE)
#define BOARD_TYPE "SAM DUE"
#elif (WIFININA_USE_NRF528XX)
#if defined(NRF52840_FEATHER)
#define BOARD_TYPE "NRF52840_FEATHER"
#elif defined(NRF52832_FEATHER)
#define BOARD_TYPE "NRF52832_FEATHER"
#elif defined(NRF52840_FEATHER_SENSE)
#define BOARD_TYPE "NRF52840_FEATHER_SENSE"
#elif defined(NRF52840_ITSYBITSY)
#define BOARD_TYPE "NRF52840_ITSYBITSY"
#elif defined(NRF52840_CIRCUITPLAY)
#define BOARD_TYPE "NRF52840_CIRCUITPLAY"
#elif defined(NRF52840_CLUE)
#define BOARD_TYPE "NRF52840_CLUE"
#elif defined(NRF52840_METRO)
#define BOARD_TYPE "NRF52840_METRO"
#elif defined(NRF52840_PCA10056)
#define BOARD_TYPE "NRF52840_PCA10056"
#elif defined(NINA_B302_ublox)
#define BOARD_TYPE "NINA_B302_ublox"
#elif defined(NINA_B112_ublox)
#define BOARD_TYPE "NINA_B112_ublox"
#elif defined(PARTICLE_XENON)
#define BOARD_TYPE "PARTICLE_XENON"
#elif defined(ARDUINO_NRF52_ADAFRUIT)
#define BOARD_TYPE "ARDUINO_NRF52_ADAFRUIT"
#else
#define BOARD_TYPE "nRF52 Unknown"
#endif
#elif ( defined(CORE_TEENSY) )
#if defined(__IMXRT1062__)
// For Teensy 4.1/4.0
#define BOARD_TYPE "TEENSY 4.1/4.0"
#elif defined(__MK66FX1M0__)
#define BOARD_TYPE "Teensy 3.6"
#elif defined(__MK64FX512__)
#define BOARD_TYPE "Teensy 3.5"
#elif defined(__MKL26Z64__)
#define BOARD_TYPE "Teensy LC"
#elif defined(__MK20DX256__)
#define BOARD_TYPE "Teensy 3.2" // and Teensy 3.1 (obsolete)
#elif defined(__MK20DX128__)
#define BOARD_TYPE "Teensy 3.0"
#elif defined(__AVR_AT90USB1286__)
#error Teensy 2.0++ not supported yet
#elif defined(__AVR_ATmega32U4__)
#error Teensy 2.0 not supported yet
#else
// For Other Boards
#define BOARD_TYPE "Unknown Teensy Board"
#endif
#elif (WIFININA_USE_STM32)
#if defined(STM32F0)
#define BOARD_TYPE "STM32F0"
#elif defined(STM32F1)
#define BOARD_TYPE "STM32F1"
#elif defined(STM32F2)
#define BOARD_TYPE "STM32F2"
#elif defined(STM32F3)
#define BOARD_TYPE "STM32F3"
#elif defined(STM32F4)
#define BOARD_TYPE "STM32F4"
#elif defined(STM32F7)
#define BOARD_TYPE "STM32F7"
#elif defined(STM32L0)
#define BOARD_TYPE "STM32L0"
#elif defined(STM32L1)
#define BOARD_TYPE "STM32L1"
#elif defined(STM32L4)
#define BOARD_TYPE "STM32L4"
#elif defined(STM32H7)
#define BOARD_TYPE "STM32H7"
#elif defined(STM32G0)
#define BOARD_TYPE "STM32G0"
#elif defined(STM32G4)
#define BOARD_TYPE "STM32G4"
#elif defined(STM32WB)
#define BOARD_TYPE "STM32WB"
#elif defined(STM32MP1)
#define BOARD_TYPE "STM32MP1"
#else
#define BOARD_TYPE "STM32 Unknown"
#endif
#else
// For Mega
#define BOARD_TYPE "AVR Mega"
#endif
#ifndef BOARD_NAME
#define BOARD_NAME BOARD_TYPE
#endif
#include "WiFiNINA_Generic.h"
// Select the IP address according to your local network
IPAddress ip(192, 168, 2, 222);
#define WIFI_SSID "YOUR-WIFI-SSID"
#define WIFI_PASS "YOUR-WIFI-PASSWORD"
#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 BAUD_RATE 115200 // Change baudrate to your need
#define BUTTON_PIN 0 // GPIO for BUTTON (inverted: LOW = pressed, HIGH = released)
#define LED_PIN 2 // GPIO for LED (inverted)
#endif //defines_h
Debug Terminal Output Samples
SAMD_WiFiNINA_TV on NANO_33_IOT
1.This is the terminal output when running SAMD_WiFiNINA_TV on NANO_33_IOT
Starting SAMD_WiFiNINA_TV on SAMD NANO_33_IOT
SinricPro_Generic (v2.8.4)
12 channels configured
[Wifi]: Connecting
WiFi-begin: return1 = 3
WiFi-begin: return2 = 3
[WiFi]: IP-Address is 192.168.2.46
Connected to SinricPro
TV turned off
TV turned on
Volume set to: 50
TV volume is unmuted
TV volume is muted
TV turned on
Volume set to: 65
TV turned on
MediaControl: play
MediaControl: pause
TV turned off
TV turned on
TV turned on
TV volume is unmuted
TV turned off
SAMD_WiFiNINA_Light on NANO_33_IOT
2.This is the terminal output when running SAMD_WiFiNINA_Light on NANO_33_IOT
Starting SAMD_WiFiNINA_Light on SAMD NANO_33_IOT
SinricPro_Generic (v2.8.4)
Setup color temperature lookup table
colorTemperatureIndex[2200] = 0
colorTemperatureIndex[2700] = 1
colorTemperatureIndex[4000] = 2
colorTemperatureIndex[5500] = 3
colorTemperatureIndex[7000] = 4
[Wifi]: ConnectingWiFi-begin: return1 = 3
WiFi-begin: return2 = 3
[WiFi]: IP-Address is 192.168.2.46
Connected to SinricPro
Device **** turned on (via SinricPro)
Device **** turn off (via SinricPro)
Device **** brightness level changed to 70
Device **** brightness level changed to 25
Device **** color changed to 160, 112, 112(RGB)
Device **** color changed to 218, 23, 23(RGB)
Device **** color changed to 236, 214, 214(RGB)
Device **** turn off (via SinricPro)
Device **** turned on (via SinricPro)
Device**** brightness level changed to 65
Generic_Ethernet_Blinds on nRF52 NRF52840_ITSYBITSY with W5500 Ethernet
3.This is the terminal output when running terminal output when running Generic_Ethernet_Blinds on nRF52 NRF52840_ITSYBITSY with W5500 Ethernet using "patched" Ethernet2 Library
Starting Generic_Ethernet_Blinds on NRF52840_ITSYBITSY
SinricPro_Generic (v2.8.4)
[SRP] =========== USE_ETHERNET2 ===========
[SRP] Default SPI pinout:
[SRP] MOSI: 24
[SRP] MISO: 23
[SRP] SCK: 25
[SRP] SS: 5
[SRP] =========================
[SRP] Use default CS/SS pin : 10
Index = 0
Ethernet Connected!. IP-Address is: 192.168.2.165
[SRP] Creating new device. No Device= _deviceID
[SRP] add(): Adding device with id= _deviceID
[SRP] Websocket: Connecting to WebSocket Server: ws.sinric.pro
[SRP] Websocket: headers:
appkey:APP_KEY
deviceids:_deviceID
restoredevicestates:false
ip:192.168.2.165
mac:DE:AD:BE:EF:FE:01
platform:NRF52840_ITSYBITSY
version:2.5.1
[SRP] Websocket: connected
Connected to SinricPro
[SRP] Websocket: receiving data
[SRP] handleReceiveQueue(): Message(s) in receiveQueue= 1
[SRP] handleReceiveQueue(): Valid Signature. Processing message...
[SRP] extractTimestamp(): Got Timestamp= 1596497923
Generic_Ethernet_Blinds on Seeeduino SEEED_XIAO_M0 with W5500 Ethernet
4.This is the terminal output when running terminal output when running Generic_Ethernet_Blinds on Seeeduino SEEED_XIAO_M0 with W5500 Ethernet using "patched" Ethernet3 Library
Starting Generic_Ethernet_Blinds on SEEED_XIAO_M0
SinricPro_Generic (v2.8.4)
[SRP] =========== USE_ETHERNET3 ===========
[SRP] Default SPI pinout:
[SRP] MOSI: 10
[SRP] MISO: 9
[SRP] SCK: 8
[SRP] SS: 4
[SRP] =========================
[SRP] Use default CS/SS pin : 1
Index = 11
Ethernet3 W5500 init, using SPI_CS = 1, number of sockets = 4
Ethernet Connected!. IP-Address is: 192.168.2.164
[SRP] Creating new device. No Device= _deviceID
[SRP] add(): Adding device with id= _deviceID
[SRP] Websocket: Connecting to WebSocket Server: ws.sinric.pro
[SRP] Websocket: headers:
appkey:APP_KEY
deviceids:_deviceID
restoredevicestates:false
ip:192.168.2.164
mac:DE:AD:BE:EF:BE:0C
platform:SEEED_XIAO_M0
version:2.5.1
[SRP] Websocket: connected
Connected to SinricPro
[SRP] Websocket: receiving data
[SRP] handleReceiveQueue(): Message(s) in receiveQueue= 1
[SRP] handleReceiveQueue(): Valid Signature. Processing message...
[SRP] extractTimestamp(): Got Timestamp= 1596499807
Generic_Ethernet_Blinds on Arduino SAMD_NANO_33_IOT with WiFiNINA
5.This is the terminal output when running terminal output when running Generic_Ethernet_Blinds on Arduino SAMD_NANO_33_IOT with WiFiNINA using "patched" Arduino.h
Starting SAMD_WiFiNINA_Blinds on SAMD_NANO_33_IOT
SinricPro_Generic (v2.8.4)
[Wifi]: Connecting[WiFi]: IP-Address is 192.168.2.105
[SRP] Creating new device. No Device= _deviceID
[SRP] add(): Adding device with id= _deviceID
[SRP] Websocket: Connecting to WebSocket Server: ws.sinric.pro
[SRP] Websocket: headers:
appkey:APP_KEY
deviceids:_deviceID
restoredevicestates:false
ip:192.168.2.105
mac:74:7A:C9:AE:11:4C
platform:SAMD_NANO_33_IOT
version:2.5.1
[SRP] Websocket: connected
Connected to SinricPro
[SRP] Websocket: receiving data
[SRP] handleReceiveQueue(): Message(s) in receiveQueue= 1
[SRP] handleReceiveQueue(): Valid Signature. Processing message...
[SRP] extractTimestamp(): Got Timestamp= 1596518895
Generic_Ethernet_Blinds on Adafruit nRF52 NRF52840_FEATHER with W5500 Ethernet
6.This is the terminal output when running terminal output when running Generic_Ethernet_Blinds on Adafruit nRF52 NRF52840_FEATHER with W5500 Ethernet using EthernetLarge Library with (SRP_LOGLEVEL = 3)
Starting Generic_Ethernet_Blinds on NRF52840_FEATHER
SinricPro_Generic (v2.8.4)
[SRP] =========== USE_ETHERNET_LARGE ===========
[SRP] Default SPI pinout:
[SRP] MOSI: 25
[SRP] MISO: 24
[SRP] SCK: 26
[SRP] SS: 5
[SRP] =========================
[SRP] Use default CS/SS pin : 10
Index = 6
_pinCS = 0
W5100 init, using SS_PIN_DEFAULT = 10, new ss_pin = 10, W5100Class::ss_pin = 10
W5100::init: W5500, SSIZE =8192
Connected!
[Ethernet]: IP-Address is 192.168.2.97
[SRP] Creating new device. No Device = 123456789012345678901234
[SRP] add(): Adding DeviceId = 123456789012345678901234
[SRP] begin(): App-Key = 12345678-1234-1234-1234-123456789012
[SRP] begin(): App-Secret = 12345678-1234-1234-1234-123456789012-12345678-1234-1234-1234-123456789012
[SRP] Websocket: Connecting to WebSocket Server: ws.sinric.pro
Websocket: headers:
appkey:12345678-1234-1234-1234-123456789012
deviceids:123456789012345678901234
restoredevicestates:false
ip:192.168.2.87
mac:DE:AD:BE:EF:FE:0B
platform:NRF52840_FEATHER
version:2.7.0
Connected to SinricPro
[SRP] handleReceiveQueue(): Message(s) in receiveQueue = 1
[SRP] handleReceiveQueue(): Valid Signature. Processing message...
[SRP] extractTimestamp(): Got Timestamp = 1601877066
[SRP] handleReceiveQueue(): Message(s) in receiveQueue = 1
[SRP] handleReceiveQueue(): Valid Signature. Processing message...
[SRP] extractTimestamp(): Got Timestamp = 1601877184
[SRP] handleRequest(): handling request
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "sinricpro-web",
"createdAt": 1601877184,
"deviceAttributes": [],
"deviceId": "123456789012345678901234",
"replyToken": "1068f321-1ad6-4750-a089-f73e56502044",
"type": "request",
"value": {
"state": "Off"
}
},
"signature": {
"HMAC": "/3hvMknpWRtzgNcD41s94YMLzPrA/gj1BIUihcRajjk="
}
}
Device 123456789012345678901234 power turned off
[SRP] handleSendQueue(): Sending Number of Message(s) in sendQueue = 1
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "sinricpro-web",
"createdAt": 1601877184,
"deviceId": "123456789012345678901234",
"message": "OK",
"replyToken": "1068f321-1ad6-4750-a089-f73e56502044",
"success": true,
"type": "response",
"value": {
"state": "Off"
}
},
"signature": {
"HMAC": "DS4Lby1xXXiM7OBe3cphs2G+1HaN6Z9T8crcRRA4avc="
}
}
[SRP] handleSendQueue: Sending to WebSocket
[SRP] handleSendQueue(): Message sent.
Generic_Ethernet_Blinds on STM32F7 Nucleo-144 NUCLEO_F767ZI with W5500 Ethernet
7.This is the terminal output when running terminal output when running Generic_Ethernet_Blinds on STM32F7 Nucleo-144 NUCLEO_F767ZI with W5500 Ethernet using Ethernet2 Library with (SRP_LOGLEVEL = 3)
Starting Generic_Ethernet_Speaker on NUCLEO_F767ZI
SinricPro_Generic (v2.8.4)
Index = 0
Connected!
[Ethernet]: IP-Address is 192.168.2.84
[SRP] Creating new device. No current DeviceId = 123456789012345678901234
[SRP] add(): Adding DeviceId = 123456789012345678901234
[SRP] begin(): App-Key = 12345678-1234-1234-1234-123456789012
[SRP] begin(): App-Secret = 12345678-1234-1234-1234-123456789012-12345678-1234-1234-1234-123456789012
[SRP] Websocket: Connecting to WebSocket Server: ws.sinric.pro
Websocket: headers:
appkey:12345678-1234-1234-1234-123456789012
deviceids:123456789012345678901234
restoredevicestates:false
ip:192.168.2.84
mac:DE:AD:BE:EF:FE:01
platform:NUCLEO_F767ZI
version:2.7.0
Connected to SinricPro
[SRP] handleReceiveQueue(): Message(s) in receiveQueue = 1
[SRP] handleReceiveQueue(): Valid Signature. Processing message...
[SRP] extractTimestamp(): Got Timestamp = 1601879732
[SRP] handleReceiveQueue(): Message(s) in receiveQueue = 1
[SRP] handleReceiveQueue(): Valid Signature. Processing message...
[SRP] extractTimestamp(): Got Timestamp = 1601879782
[SRP] handleRequest(): handling request
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setVolume",
"clientId": "sinricpro-web",
"createdAt": 1601879782,
"deviceAttributes": [],
"deviceId": "123456789012345678901234",
"replyToken": "7c989b3f-84aa-4462-8f3d-1a29c04c7df0",
"type": "request",
"value": {
"volume": 45
}
},
"signature": {
"HMAC": "J27eUYEZJ+pQyzG5uC1+w/2jz8SKGU4LcP5snSb0KF4="
}
}
Volume set to: 45
[SRP] handleSendQueue(): Sending Number of Message(s) in sendQueue = 1
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setVolume",
"clientId": "sinricpro-web",
"createdAt": 1601879782,
"deviceId": "123456789012345678901234",
"message": "OK",
"replyToken": "7c989b3f-84aa-4462-8f3d-1a29c04c7df0",
"success": true,
"type": "response",
"value": {
"volume": 45
}
},
"signature": {
"HMAC": "mYoFZxZ//yKd3BU/TWs56rKoM+lcdZsxVs1ql0/1XM4="
}
}
[SRP] handleSendQueue: Sending to WebSocket
[SRP] handleSendQueue(): Message sent.
[SRP] handleReceiveQueue(): Message(s) in receiveQueue = 1
[SRP] handleReceiveQueue(): Valid Signature. Processing message...
[SRP] extractTimestamp(): Got Timestamp = 1601879790
[SRP] handleRequest(): handling request
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "sinricpro-web",
"createdAt": 1601879790,
"deviceAttributes": [],
"deviceId": "123456789012345678901234",
"replyToken": "0069ff67-31ee-4e6e-a647-a054617a2061",
"type": "request",
"value": {
"state": "Off"
}
},
"signature": {
"HMAC": "kx6ZtXl1DUNMIXCmlcBO5ni8NN9w1CLaM8hSIESM9fM="
}
}
Speaker turned off
[SRP] handleSendQueue(): Sending Number of Message(s) in sendQueue = 1
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "sinricpro-web",
"createdAt": 1601879790,
"deviceId": "123456789012345678901234",
"message": "OK",
"replyToken": "0069ff67-31ee-4e6e-a647-a054617a2061",
"success": true,
"type": "response",
"value": {
"state": "Off"
}
},
"signature": {
"HMAC": "qiI38SI0ulIJKXR/R/Zm9n6Uhd3HlNmX2vto9DkDah8="
}
}
[SRP] handleSendQueue: Sending to WebSocket
[SRP] handleSendQueue(): Message sent.
[SRP] handleReceiveQueue(): Message(s) in receiveQueue = 1
[SRP] handleReceiveQueue(): Valid Signature. Processing message...
[SRP] extractTimestamp(): Got Timestamp = 1601879793
[SRP] handleRequest(): handling request
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "sinricpro-web",
"createdAt": 1601879793,
"deviceAttributes": [],
"deviceId": "123456789012345678901234",
"replyToken": "d4d1d50c-9c44-40fa-943c-84c40c0d7550",
"type": "request",
"value": {
"state": "On"
}
},
"signature": {
"HMAC": "49poW0mpG3CZUs8UJ48EF6eAw8mz09jcfGRy2Xob86w="
}
}
Speaker turned on
[SRP] handleSendQueue(): Sending Number of Message(s) in sendQueue = 1
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "sinricpro-web",
"createdAt": 1601879793,
"deviceId": "123456789012345678901234",
"message": "OK",
"replyToken": "d4d1d50c-9c44-40fa-943c-84c40c0d7550",
"success": true,
"type": "response",
"value": {
"state": "On"
}
},
"signature": {
"HMAC": "msDcqzA0tGgzJOB0uAeaiIEFvPSQ3ACTZPmk+lMty5o="
}
}
[SRP] handleSendQueue: Sending to WebSocket
[SRP] handleSendQueue(): Message sent.
WIOT_MultiSwitch_LCD on SeeedStudio SAMD51 WIO Terminal
8.This is the terminal output when running terminal output when running WIOT_MultiSwitch_LCD on SeeedStudio SAMD51 WIO Terminal with (SRP_LOGLEVEL = 3)
Starting WIOT_MultiSwitch_LCD on WIO_TERMINAL
SinricPro_Generic (v2.8.4)
[Wifi]: Connecting
[WiFi]: IP-Address is 192.168.2.150
Connected to SinricPro
SinricPro Connected
isSinricConnected Connected
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "sinricpro-web",
"createdAt": 1606952787,
"deviceAttributes": [],
"deviceId": "5ec47b****************",
"replyToken": "bbab5988-ffae-45ca-b1c2-fb13be4d0a48",
"type": "request",
"value": {
"state": "On"
}
},
"signature": {
"HMAC": "efnmLaucg7UvjHSZiUyv9U1pzbTJqwgBPnX+yziNPAg="
}
}
=======================================
Device 1 turned ON
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "sinricpro-web",
"createdAt": 1606952787,
"deviceId": "5ec47b****************",
"message": "OK",
"replyToken": "bbab5988-ffae-45ca-b1c2-fb13be4d0a48",
"success": true,
"type": "response",
"value": {
"state": "On"
}
},
"signature": {
"HMAC": "O0Hc0p2sxD5FzbOPCmw+Ex9NnjVxkMDo9HkNicChoZU="
}
}
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "sinricpro-web",
"createdAt": 1606952787,
"deviceAttributes": [],
"deviceId": "5ec47b****************",
"replyToken": "be743078-60ad-4eb8-a6f8-05b13e9509c5",
"type": "request",
"value": {
"state": "On"
}
},
"signature": {
"HMAC": "a9E1hS2dY7GDE+KCLZFXhcaMwZtMk5YH7yvsVDsPmoQ="
}
}
=======================================
Device 3 turned ON
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "sinricpro-web",
"createdAt": 1606952787,
"deviceId": "5ec47b****************",
"message": "OK",
"replyToken": "be743078-60ad-4eb8-a6f8-05b13e9509c5",
"success": true,
"type": "response",
"value": {
"state": "On"
}
},
"signature": {
"HMAC": "NouzX0HUbxAh2/ATHPMpqMrKGfydHEFScu7cU7Qboec="
}
}
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "sinricpro-web",
"createdAt": 1606952787,
"deviceAttributes": [],
"deviceId": "5ec47b****************",
"replyToken": "dcbe67e7-6add-44b9-820c-955c7efab625",
"type": "request",
"value": {
"state": "On"
}
},
"signature": {
"HMAC": "d2T7p0jEUbm0jLs8GOTmqvwpkwSBA27q0UhAVjZ7v28="
}
}
=======================================
Device 2 turned ON
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "sinricpro-web",
"createdAt": 1606952787,
"deviceId": "5ec47b****************",
"message": "OK",
"replyToken": "dcbe67e7-6add-44b9-820c-955c7efab625",
"success": true,
"type": "response",
"value": {
"state": "On"
}
},
"signature": {
"HMAC": "kFuxIwc5RZr1xAs5oLK66r1dYl4YrbDUcxS804cWQ+k="
}
}
Device 1 with deviceID :5ec47b9276b86a477f5df3d0turned OFF (manually via flashbutton)
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"cause": {
"type": "PHYSICAL_INTERACTION"
},
"createdAt": 1606952915,
"deviceId": "5ec47b****************",
"replyToken": "fc3e0648-7535-4765-85b4-f054bc3b2f01",
"type": "event",
"value": {
"state": "Off"
}
},
"signature": {
"HMAC": "0A0OmM/2k6AtUhfb3358c2rohjVHQKOVpu/qid7+A7U="
}
}
and the LCD screenshots
Generic_WiFiNINA_Blinds on MBED NANO_RP2040_CONNECT
9.This is the terminal output when running terminal output when running Generic_WiFiNINA_Blinds on Arduino MBED NANO_RP2040_CONNECT
Starting Generic_WiFiNINA_Blinds on MBED NANO_RP2040_CONNECT
SinricPro_Generic (v2.8.4)
[Wifi]: Connecting[WiFi]: IP-Address is 192.168.2.153
Connected to SinricPro
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "portal",
"createdAt": 1622610381,
"deviceId": "123456789012345678901234",
"replyToken": "cef0abba-0fe3-44c1-9fad-426766e4c23e",
"type": "request",
"value": {
"state": "On"
}
},
"signature": {
"HMAC": "CBksKuwCU3WagwFP0xyqmUqnaEl1+PI91OvBwQnt7pw="
}
}Device 123456789012345678901234 power turned on
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "portal",
"createdAt": 1622610381,
"deviceId": "123456789012345678901234",
"message": "OK",
"replyToken": "cef0abba-0fe3-44c1-9fad-426766e4c23e",
"success": true,
"type": "response",
"value": {
"state": "On"
}
},
"signature": {
"HMAC": "0TTkm+eAa/QmnkiF1239idHJS/uYcwhWVmGQ+Yo+7Ag="
}
}
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "portal",
"createdAt": 1622610383,
"deviceId": "123456789012345678901234",
"replyToken": "059fa67e-1ecb-4378-8c49-83693441d9b6",
"type": "request",
"value": {
"state": "Off"
}
},
"signature": {
"HMAC": "fx7mxcIADdO7/l/HnfiZtUwya+nC0B1+mXSKwIOevMs="
}
}Device 123456789012345678901234 power turned off
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "portal",
"createdAt": 1622610383,
"deviceId": "123456789012345678901234",
"message": "OK",
"replyToken": "059fa67e-1ecb-4378-8c49-83693441d9b6",
"success": true,
"type": "response",
"value": {
"state": "Off"
}
},
"signature": {
"HMAC": "/LQtlMLeej6ev665US/o+USwaV/3lx81KX+AhHa/+Yw="
}
}
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setRangeValue",
"clientId": "portal",
"createdAt": 1622610386,
"deviceId": "123456789012345678901234",
"replyToken": "5e986c43-da36-40e0-83f7-a8ec4d4cac9f",
"type": "request",
"value": {
"rangeValue": 100
}
},
"signature": {
"HMAC": "VPDM+vx74ILz0OzKdjhKDr/E31s6Zztg/UrZgKLf+5w="
}
}Device 123456789012345678901234 set position to 100
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setRangeValue",
"clientId": "portal",
"createdAt": 1622610386,
"deviceId": "123456789012345678901234",
"message": "OK",
"replyToken": "5e986c43-da36-40e0-83f7-a8ec4d4cac9f",
"success": true,
"type": "response",
"value": {
"rangeValue": 100
}
},
"signature": {
"HMAC": "hrmCNpSS8X90FPmmJE86tHWYfCTqIpIGNE7JFoTpdVY="
}
}
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setRangeValue",
"clientId": "portal",
"createdAt": 1622610388,
"deviceId": "123456789012345678901234",
"replyToken": "b3af6342-bf52-4a7a-8919-c318bf9b9b3f",
"type": "request",
"value": {
"rangeValue": 0
}
},
"signature": {
"HMAC": "oaAgz3MT50kVviDcqLyanwiNuZ/KVTslMSncg9veDnA="
}
}Device 123456789012345678901234 set position to 0
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setRangeValue",
"clientId": "portal",
"createdAt": 1622610388,
"deviceId": "123456789012345678901234",
"message": "OK",
"replyToken": "b3af6342-bf52-4a7a-8919-c318bf9b9b3f",
"success": true,
"type": "response",
"value": {
"rangeValue": 0
}
},
"signature": {
"HMAC": "HT6U+Q+rfdeE6lzqdUAtehOexNi5us17B5j1FKHS1dM="
}
}
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setRangeValue",
"clientId": "portal",
"createdAt": 1622610394,
"deviceId": "123456789012345678901234",
"replyToken": "059e38ca-fce5-4188-99ab-7dba8863cb4f",
"type": "request",
"value": {
"rangeValue": 40
}
},
"signature": {
"HMAC": "7Nz3oiW+zHVtNh8gokRHzNGdYu/Y7F4beJkAfJpgGGg="
}
}Device 123456789012345678901234 set position to 40
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setRangeValue",
"clientId": "portal",
"createdAt": 1622610394,
"deviceId": "123456789012345678901234",
"message": "OK",
"replyToken": "059e38ca-fce5-4188-99ab-7dba8863cb4f",
"success": true,
"type": "response",
"value": {
"rangeValue": 40
}
},
"signature": {
"HMAC": "nV7UpnelVTTWMrYJvBZBhnd2zV3tEOanhseYVeQcIMA="
}
}
RP2040_WiFiNINA_Blinds on MBED NANO_RP2040_CONNECT
10.This is the terminal output when running terminal output when running Generic_WiFiNINA_Blinds on Arduino MBED NANO_RP2040_CONNECT
Starting RP2040_WiFiNINA_Blinds on MBED NANO_RP2040_CONNECT
SinricPro_Generic (v2.8.4)
[Wifi]: Connecting[WiFi]: IP-Address is 192.168.2.153
[SRP] Creating new device. No current DeviceId = 123456789012345678901234
[SRP] add(): Adding DeviceId = 123456789012345678901234
[SRP] begin(): App-Key = 12345678-1234-1234-1234-123456789012
[SRP] begin(): App-Secret = 12345678-1234-1234-1234-123456789012-12345678-1234-1234-1234-123456789012
[SRP] Websocket: Connecting to WebSocket Server: ws.sinric.pro
Websocket: headers:
appkey:12345678-1234-1234-1234-123456789012
deviceids:123456789012345678901234
restoredevicestates:false
ip:192.168.2.153
mac:98:1F:2E:A8:CC:84
platform:MBED NANO_RP2040_CONNECT
version:2.8.0
Connected to SinricPro
[SRP] handleReceiveQueue(): Message(s) in receiveQueue = 1
[SRP] handleReceiveQueue(): Valid Signature. Processing message...
[SRP] extractTimestamp(): Got Timestamp = 1622609861
[SRP] handleReceiveQueue(): Message(s) in receiveQueue = 1
[SRP] handleReceiveQueue(): Valid Signature. Processing message...
[SRP] extractTimestamp(): Got Timestamp = 1622609961
[SRP] handleRequest(): handling request
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "portal",
"createdAt": 1622609961,
"deviceId": "123456789012345678901234",
"replyToken": "d2b469d3-aa7a-4fe8-a726-21f64fbf838e",
"type": "request",
"value": {
"state": "On"
}
},
"signature": {
"HMAC": "4S+9TcRml7dUdapV9tbJnMmqz/bm7MTe4Kfqyo2bnjs="
}
}
Device 123456789012345678901234 power turned on
[SRP] handleSendQueue(): Sending Number of Message(s) in sendQueue = 1
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "portal",
"createdAt": 1622609961,
"deviceId": "123456789012345678901234",
"message": "OK",
"replyToken": "d2b469d3-aa7a-4fe8-a726-21f64fbf838e",
"success": true,
"type": "response",
"value": {
"state": "On"
}
},
"signature": {
"HMAC": "0Wfn7ozGRg1h3LlN+m+2x5c5XZNOl0akoYR8NlAX+fo="
}
}
[SRP] handleSendQueue: Sending to WebSocket
[SRP] handleSendQueue(): Message sent.
[SRP] handleReceiveQueue(): Message(s) in receiveQueue = 1
[SRP] handleReceiveQueue(): Valid Signature. Processing message...
[SRP] extractTimestamp(): Got Timestamp = 1622609963
[SRP] handleRequest(): handling request
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "portal",
"createdAt": 1622609963,
"deviceId": "123456789012345678901234",
"replyToken": "22bb0f44-15d7-41ca-9df1-4411bad86d47",
"type": "request",
"value": {
"state": "Off"
}
},
"signature": {
"HMAC": "Di8m+/krnAZOGKvvLYVII07pwIWhzkY2auXfQNd1Ta0="
}
}
Device 123456789012345678901234 power turned off
[SRP] handleSendQueue(): Sending Number of Message(s) in sendQueue = 1
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "portal",
"createdAt": 1622609963,
"deviceId": "123456789012345678901234",
"message": "OK",
"replyToken": "22bb0f44-15d7-41ca-9df1-4411bad86d47",
"success": true,
"type": "response",
"value": {
"state": "Off"
}
},
"signature": {
"HMAC": "LknB4L8yaPbDeVSEAfZ6bg16RcPELGScuBAiuOEGLnU="
}
}
[SRP] handleSendQueue: Sending to WebSocket
[SRP] handleSendQueue(): Message sent.
Blinds on WT32-ETH01 with ETH_PHY_LAN8720
11.This is the terminal output when running terminal output when running Blinds on WT32-ETH01 with ETH_PHY_LAN8720
Start Blinds on WT32-ETH01 with ETH_PHY_LAN8720
WebServer_WT32_ETH01 v1.4.1
SinricPro_Generic (v2.8.4)
[ETH]: Connecting
ETH Started
ETH Connected
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.83
FULL_DUPLEX, 100Mbps
[ETH]: IP-Address is 192.168.2.83
Connected to SinricPro
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "portal",
"createdAt": 1626752759,
"deviceId": "device-id",
"replyToken": "ab499dd7-9846-4944-814e-21262e645809",
"type": "request",
"value": {
"state": "On"
}
},
"signature": {
"HMAC": "i4exN7P/ScPsul8Cdn2hQa0hZ49zw6nc7TTwiKEVeYw="
}
}Device device-id power turned on
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "portal",
"createdAt": 1626752759,
"deviceId": "device-id",
"message": "OK",
"replyToken": "ab499dd7-9846-4944-814e-21262e645809",
"success": true,
"type": "response",
"value": {
"state": "On"
}
},
"signature": {
"HMAC": "3V/YzNA6AjgAj97QlRUguJijMXtlTjq/KQyViulRPrs="
}
}
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "portal",
"createdAt": 1626752762,
"deviceId": "device-id",
"replyToken": "86d11bc3-1711-48ca-8bdd-f4df119f02f2",
"type": "request",
"value": {
"state": "Off"
}
},
"signature": {
"HMAC": "UrmmYfZM0xcpVg20vVeh0/rdj1hs9K7B93Ge4ZmgYYE="
}
}Device device-id power turned off
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "portal",
"createdAt": 1626752762,
"deviceId": "device-id",
"message": "OK",
"replyToken": "86d11bc3-1711-48ca-8bdd-f4df119f02f2",
"success": true,
"type": "response",
"value": {
"state": "Off"
}
},
"signature": {
"HMAC": "gHrceMstnanDVixoRloVFalZREux+8CF9q6SnXn4F8Q="
}
}
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
- Camera (from v2.5.1)
- AirQualitySensor (from v2.6.1)
Debug
Debug is enabled by default on Serial. Debug Level from 0 to 4. To disable, change the SRP_LOGLEVEL to 0
#define SRP_DEBUG_PORT Serial
// Debug Level from 0 to 4
#define _SRP_LOGLEVEL_ 4
Troubleshooting
If you get compilation errors, more often than not, you may need to install a newer version of the board's core, applying Libraries' Patches, Packages' Patches or this library latest version.
Issues
Submit issues to: SinricPro_Generic issues
TO DO
- Bug Searching and Killing
- Support more types of new boards
- Support more types of Ethernet modules/shields, such as LAN8742A, LAN8720, etc.
- Support more types of WiFi modules/shields, such as WiFi101, ESP8266-AT, ESP32-AT
- Support GSM/GPRS modules/shields.
- Support ENC28J60 Ethernet modules/shields, using new EthernetENC library.
DONE
- Add support to Adafruit SAMD21 (Itsy-Bitsy M0, Metro M0, Feather M0 Express, etc.).
- Add support to Adafruit SAMD51 (Itsy-Bitsy M4, Metro M4, Grand Central M4, Feather M4 Express, etc.).
- Add support to Adafruit nRF52 ( Feather nRF52832, nRF52840 Express, BlueFruit Sense, Itsy-Bitsy nRF52840 Express, Metro nRF52840 Express, NINA_B302_ublox, NINA_B112_ublox, etc.).
- Add support to SAM DUE.
- Add support to Teensy.
- Add support to all STM32F/L/H/G/WB/MP1 having 64K+ Flash program memory.
- Add support to Seeeduino SAMD21/SAMD51 boards (SEEED_WIO_TERMINAL, SEEED_FEMTO_M0, SEEED_XIAO_M0, Wio_Lite_MG126, WIO_GPS_BOARD, SEEEDUINO_ZERO, SEEEDUINO_LORAWAN, SEEED_GROVE_UI_WIRELESS, etc.)
- Add support to W5x00, ENC28J60 Ethernet modules/shields.
- Add support to Ethernet, EthernetLarge, Ethernet2, Ethernet3, UIPEthernet libraries.
- Add support to RP2040-based boards, such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, using Earle Philhower's arduino-pico core.
- Add support to RP2040-based boards, such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, using Arduino-mbed RP2040 core
- Add support to Arduino Nano RP2040 Connect using Arduino mbed OS for Nano boards.
- Add
Table of Contents
- Add support to WT32_ETH01 boards using ESP32-based boards and LAN8720 Ethernet
Contributions and Thanks
- Based on and modified from Boris Jaeger's SinricPro library which is written for only ESP8266 and ESP32.
- Also thanks to the good Sinric/SinricPro platform of Aruna Tennakoon
- Thanks to good work of Miguel Wisintainer for initiating, inspriring, working with, developing, debugging and testing. Without that, support to nRF52, especially U-Blox B302 running as nRF52840 and U-Box B112 running as nRF52832, has never been started and finished.
Miguel Wisintainer |
Contributing
If you want to contribute to this project:
- Report bugs and errors
- Ask for enhancements
- Create issues and pull requests
- Tell other people about this library
License
-
Most of the credits go to original author Boris Jaeger.
Copyright
Copyright 2020- Boris Jaeger, Khoi Hoang