Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions .github/workflows/build-arduino-boards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Build for Arduino UNO R4 WiFi, Nano 33 IoT, MKR WiFi 1010
on:
workflow_dispatch:

pull_request:
branches: [master]
paths:
- src/**
- examples/**

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
example:
- examples/ACUnit
- examples/Blinds
- examples/ContactSensor
- examples/DimSwitch
- examples/doorbell
- examples/Fan
- examples/GarageDoor
- examples/Light/Light
- examples/Lock/Lock
- examples/Lock/Lock_with_feedback
- examples/MotionSensor
- examples/PowerSensor
- examples/Relay/MultiRelays_advance
- examples/Relay/Relay
- examples/Speaker
- examples/Switch/MultiSwitch_advance
- examples/Switch/MultiSwitch_beginner
- examples/Switch/MultiSwitch_intermediate
- examples/Switch/Switch
- examples/Thermostat
- examples/TV
- examples/AirQualitySensor/AirQualitySensor
board:
- fqbn: arduino:renesas_uno:unor4wifi
platform: arduino:renesas_uno
name: UNO_R4_WiFi
- fqbn: arduino:samd:nano_33_iot
platform: arduino:samd
name: Nano_33_IoT
- fqbn: arduino:samd:mkrwifi1010
platform: arduino:samd
name: MKR_WiFi_1010

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Arduino CLI
uses: arduino/setup-arduino-cli@v2

- name: Install board platforms
run: |
arduino-cli config init
arduino-cli core update-index
arduino-cli core install ${{ matrix.board.platform }}

- name: Install library dependencies
run: |
arduino-cli lib install "ArduinoJson"
arduino-cli lib install "WebSockets"
# WiFiNINA required for SAMD boards
if [[ "${{ matrix.board.platform }}" == "arduino:samd" ]]; then
arduino-cli lib install "WiFiNINA"
fi
# DHT sensor library for temperature examples
if [[ "${{ matrix.example }}" == *"DHT22"* ]]; then
arduino-cli lib install "DHT sensor library"
arduino-cli lib install "Adafruit Unified Sensor"
fi
# AHT10 library for temperature examples
if [[ "${{ matrix.example }}" == *"AHT10"* ]]; then
arduino-cli lib install "Adafruit AHTX0"
fi
# HTU21D library for temperature examples
if [[ "${{ matrix.example }}" == *"HTU21D"* ]]; then
arduino-cli lib install "Adafruit HTU21DF Library"
fi

- name: Link library to Arduino libraries folder
run: |
mkdir -p ~/Arduino/libraries
ln -s $GITHUB_WORKSPACE ~/Arduino/libraries/SinricPro

- name: Get sketch name
id: sketch
run: |
SKETCH_PATH="${{ matrix.example }}"
SKETCH_NAME=$(basename "$SKETCH_PATH")
echo "path=${SKETCH_PATH}/${SKETCH_NAME}.ino" >> $GITHUB_OUTPUT

- name: Compile sketch
run: |
arduino-cli compile --fqbn ${{ matrix.board.fqbn }} ${{ steps.sketch.outputs.path }}
2 changes: 1 addition & 1 deletion .github/workflows/build-esp8266-esp32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ jobs:

- name: Compile sketch
run: |
arduino-cli compile --fqbn ${{ matrix.board.fqbn }} ${{ steps.sketch.outputs.path }}
arduino-cli compile --fqbn ${{ matrix.board.fqbn }} ${{ steps.sketch.outputs.path }}
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# SinricPro (ESP8266 / ESP32 / RP2040)
# SinricPro (ESP8266 / ESP32 / RP2040 / Arduino UNO R4 WiFi / Arduino Nano 33 IoT / MKR WiFi 1010)
[![arduino-library-badge](https://www.ardu-badge.com/badge/SinricPro.svg?)](https://www.arduino.cc/reference/en/libraries/sinricpro) [![PlatformIO Registry](https://badges.registry.platformio.org/packages/sinricpro/library/SinricPro.svg)](https://registry.platformio.org/libraries/sinricpro/SinricPro)

[![Platform ESP8266](https://img.shields.io/badge/Platform-Espressif8266-orange)](#) [![Platform ESP32](https://img.shields.io/badge/Platform-Espressif32-orange)](#)
[![Raspberry Pi RP2040](https://img.shields.io/badge/Platform-Raspberry_Pi_RP2040-orange)](#)
[![Arduino UNO R4](https://img.shields.io/badge/Platform-Arduino_UNO_R4_WiFi-orange)](#)
[![Arduino Nano 33 IoT](https://img.shields.io/badge/Platform-Arduino_Nano_33_IoT-orange)](#)
[![MKR WiFi 1010](https://img.shields.io/badge/Platform-MKR_WiFi_1010-orange)](#)

[![Framework](https://img.shields.io/badge/Framework-Arduino-blue)](https://www.arduino.cc/)

Expand All @@ -12,6 +15,8 @@

[![Build](https://github.com/sinricpro/esp8266-esp32-sdk/actions/workflows/build-rpipicow.yml/badge.svg)](https://github.com/sinricpro/esp8266-esp32-sdk/actions/workflows/build-rpipicow.yml)

[![Build](https://github.com/sinricpro/esp8266-esp32-sdk/actions/workflows/build-arduino-boards.yml/badge.svg)](https://github.com/sinricpro/esp8266-esp32-sdk/actions/workflows/build-arduino-boards.yml)

[![Discord](https://img.shields.io/badge/discord-%23esp8266--esp32-blue.svg)](https://discord.gg/rq9vcRcSqA) </br>

## Installation
Expand Down Expand Up @@ -42,6 +47,31 @@
- Arduino core 3.x
- [ArduinoJson](https://github.com/bblanchon/ArduinoJson) by Benoit Blanchon (minimum Version 7.0.3)
- [WebSockets](https://github.com/Links2004/arduinoWebSockets) by Markus Sattler (minimum Version 2.4.0)
- [WiFiNINA](https://github.com/arduino-libraries/WiFiNINA) (for Arduino Nano 33 IoT and MKR WiFi 1010 only)

---

## Supported Boards

### Fully Supported (All Features Including Camera)
- **ESP8266** (all variants) - WiFi with SSL/TLS support
- **ESP32** (all variants) - WiFi with SSL/TLS support
- **Raspberry Pi Pico W (RP2040)** - WiFi with SSL/TLS support
- **Arduino Nano 33 IoT** - WiFiNINA library, SSL/TLS enabled
- **Arduino MKR WiFi 1010** - WiFiNINA library, SSL/TLS enabled
- **Arduino UNO R4 WiFi** - WiFiS3 library, **no SSL/TLS support**

All boards support switches, lights, sensors, thermostats, and other non-camera device types.

### WiFi Library Requirements
| Board | WiFi Library | SSL/TLS | Included |
|-------|-------------|---------|----------|
| ESP8266 | ESP8266WiFi.h | ✓ | ✓ |
| ESP32 | WiFi.h | ✓ | ✓ |
| RP2040 | WiFi.h | ✓ | ✓ |
| Nano 33 IoT | WiFiNINA.h | ✓ | Install separately |
| MKR WiFi 1010 | WiFiNINA.h | ✓ | Install separately |
| UNO R4 WiFi | WiFiS3.h | ✗ | ✓ |

---

Expand Down
8 changes: 8 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## Version 5.0.0

### Added
- **Arduino UNO R4 WiFi support** (WiFiS3, non-SSL)
- **Arduino Nano 33 IoT support** (WiFiNINA, SSL enabled)
- **Arduino MKR WiFi 1010 support** (WiFiNINA, SSL enabled)
---

## Version 4.1.0
New:
1. The `sendSettingEvent` method has been added to SettingController.
Expand Down
31 changes: 19 additions & 12 deletions examples/ACUnit/ACUnit.ino
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
#include <ESP8266WiFi.h>
#elif defined(ESP32) || defined(ARDUINO_ARCH_RP2040)
#include <WiFi.h>
#elif defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_SAMD_NANO_33_IOT)
#include <WiFiNINA.h>
#elif defined(ARDUINO_UNOWIFIR4) || defined(ARDUINO_MINIMA)
#include <WiFiS3.h>
#ifndef SINRICPRO_NOSSL
#define SINRICPRO_NOSSL
#endif
#endif

#include "SinricPro.h"
Expand All @@ -42,44 +49,44 @@ bool globalPowerState;
int globalFanSpeed;

bool onPowerState(const String &deviceId, bool &state) {
Serial.printf("Thermostat %s turned %s\r\n", deviceId.c_str(), state?"on":"off");
SINRICPRO_PRINTF("Thermostat %s turned %s\r\n", deviceId.c_str(), state?"on":"off");
globalPowerState = state;
return true; // request handled properly
}

bool onTargetTemperature(const String &deviceId, float &temperature) {
Serial.printf("Thermostat %s set temperature to %f\r\n", deviceId.c_str(), temperature);
SINRICPRO_PRINTF("Thermostat %s set temperature to %f\r\n", deviceId.c_str(), temperature);
globalTemperature = temperature;
return true;
}

bool onAdjustTargetTemperature(const String & deviceId, float &temperatureDelta) {
globalTemperature += temperatureDelta; // calculate absolut temperature
Serial.printf("Thermostat %s changed temperature about %f to %f", deviceId.c_str(), temperatureDelta, globalTemperature);
SINRICPRO_PRINTF("Thermostat %s changed temperature about %f to %f", deviceId.c_str(), temperatureDelta, globalTemperature);
temperatureDelta = globalTemperature; // return absolut temperature
return true;
}

bool onThermostatMode(const String &deviceId, String &mode) {
Serial.printf("Thermostat %s set to mode %s\r\n", deviceId.c_str(), mode.c_str());
SINRICPRO_PRINTF("Thermostat %s set to mode %s\r\n", deviceId.c_str(), mode.c_str());
return true;
}

bool onRangeValue(const String &deviceId, int &rangeValue) {
Serial.printf("Fan speed set to %d\r\n", rangeValue);
SINRICPRO_PRINTF("Fan speed set to %d\r\n", rangeValue);
globalFanSpeed = rangeValue;
return true;
}

bool onAdjustRangeValue(const String &deviceId, int &valueDelta) {
globalFanSpeed += valueDelta;
Serial.printf("Fan speed changed about %d to %d\r\n", valueDelta, globalFanSpeed);
SINRICPRO_PRINTF("Fan speed changed about %d to %d\r\n", valueDelta, globalFanSpeed);
valueDelta = globalFanSpeed;
return true;
}

void setupWiFi() {
Serial.printf("\r\n[Wifi]: Connecting");
SINRICPRO_PRINTF("\r\n[Wifi]: Connecting");

#if defined(ESP8266)
WiFi.setSleepMode(WIFI_NONE_SLEEP);
Expand All @@ -92,11 +99,11 @@ void setupWiFi() {
WiFi.begin(WIFI_SSID, WIFI_PASS);

while (WiFi.status() != WL_CONNECTED) {
Serial.printf(".");
SINRICPRO_PRINTF(".");
delay(250);
}
IPAddress localIP = WiFi.localIP();
Serial.printf("connected!\r\n[WiFi]: IP-Address is %d.%d.%d.%d\r\n", localIP[0], localIP[1], localIP[2], localIP[3]);
SINRICPRO_PRINTF("connected!\r\n[WiFi]: IP-Address is %d.%d.%d.%d\r\n", localIP[0], localIP[1], localIP[2], localIP[3]);
}

void setupSinricPro() {
Expand All @@ -109,13 +116,13 @@ void setupSinricPro() {
myAcUnit.onAdjustRangeValue(onAdjustRangeValue);

// setup SinricPro
SinricPro.onConnected([](){ Serial.printf("Connected to SinricPro\r\n"); });
SinricPro.onDisconnected([](){ Serial.printf("Disconnected from SinricPro\r\n"); });
SinricPro.onConnected([](){ SINRICPRO_PRINTF("Connected to SinricPro\r\n"); });
SinricPro.onDisconnected([](){ SINRICPRO_PRINTF("Disconnected from SinricPro\r\n"); });
SinricPro.begin(APP_KEY, APP_SECRET);
}

void setup() {
Serial.begin(BAUD_RATE); Serial.printf("\r\n\r\n");
Serial.begin(BAUD_RATE); SINRICPRO_PRINTF("\r\n\r\n");
setupWiFi();
setupSinricPro();
}
Expand Down
21 changes: 14 additions & 7 deletions examples/AirQualitySensor/AirQualitySensor/AirQualitySensor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@
#include <ESP8266WiFi.h>
#elif defined(ESP32) || defined(ARDUINO_ARCH_RP2040)
#include <WiFi.h>
#elif defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_SAMD_NANO_33_IOT)
#include <WiFiNINA.h>
#elif defined(ARDUINO_UNOWIFIR4) || defined(ARDUINO_MINIMA)
#include <WiFiS3.h>
#ifndef SINRICPRO_NOSSL
#define SINRICPRO_NOSSL
#endif
#endif

#include "SinricPro.h"
Expand All @@ -44,7 +51,7 @@ unsigned long dispatchTime = millis() + MIN;

// setup function for WiFi connection
void setupWiFi() {
Serial.printf("\r\n[Wifi]: Connecting");
SINRICPRO_PRINTF("\r\n[Wifi]: Connecting");

#if defined(ESP8266)
WiFi.setSleepMode(WIFI_NONE_SLEEP);
Expand All @@ -57,10 +64,10 @@ void setupWiFi() {
WiFi.begin(WIFI_SSID, WIFI_PASS);

while (WiFi.status() != WL_CONNECTED) {
Serial.printf(".");
SINRICPRO_PRINTF(".");
delay(250);
}
Serial.printf("connected!\r\n[WiFi]: IP-Address is %s\r\n", WiFi.localIP().toString().c_str());
SINRICPRO_PRINTF("connected!\r\n[WiFi]: IP-Address is %s\r\n", WiFi.localIP().toString().c_str());
}

// setup function for SinricPro
Expand All @@ -71,13 +78,13 @@ void setupSinricPro() {
// set callback function to device

// setup SinricPro
SinricPro.onConnected([](){ Serial.printf("Connected to SinricPro\r\n"); });
SinricPro.onDisconnected([](){ Serial.printf("Disconnected from SinricPro\r\n"); });
SinricPro.onConnected([](){ SINRICPRO_PRINTF("Connected to SinricPro\r\n"); });
SinricPro.onDisconnected([](){ SINRICPRO_PRINTF("Disconnected from SinricPro\r\n"); });
SinricPro.begin(APP_KEY, APP_SECRET);
}

void setup() {
Serial.begin(BAUD_RATE); Serial.printf("\r\n\r\n");
Serial.begin(BAUD_RATE); SINRICPRO_PRINTF("\r\n\r\n");
setupWiFi();
setupSinricPro();
}
Expand All @@ -96,7 +103,7 @@ void loop() {
if(success) {
Serial.println("Air Quality event sent! ..");
} else {
Serial.printf("Something went wrong...could not send Event to server!\r\n");
SINRICPRO_PRINTF("Something went wrong...could not send Event to server!\r\n");
}

dispatchTime += MIN;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@
#include <ESP8266WiFi.h>
#elif defined(ESP32) || defined(ARDUINO_ARCH_RP2040)
#include <WiFi.h>
#elif defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_SAMD_NANO_33_IOT)
#include <WiFiNINA.h>
#elif defined(ARDUINO_UNOWIFIR4) || defined(ARDUINO_MINIMA)
#include <WiFiS3.h>
#ifndef SINRICPRO_NOSSL
#define SINRICPRO_NOSSL
#endif
#endif

#include "SinricPro.h"
Expand All @@ -52,7 +59,7 @@ GP2YDustSensor dustSensor(GP2YDustSensorType::GP2Y1014AU0F, SHARP_LED_PIN, SHARP

// setup function for WiFi connection
void setupWiFi() {
Serial.printf("\r\n[Wifi]: Connecting");
SINRICPRO_PRINTF("\r\n[Wifi]: Connecting");

#if defined(ESP8266)
WiFi.setSleepMode(WIFI_NONE_SLEEP);
Expand All @@ -65,10 +72,10 @@ void setupWiFi() {
WiFi.begin(WIFI_SSID, WIFI_PASS);

while (WiFi.status() != WL_CONNECTED) {
Serial.printf(".");
SINRICPRO_PRINTF(".");
delay(250);
}
Serial.printf("connected!\r\n[WiFi]: IP-Address is %s\r\n", WiFi.localIP().toString().c_str());
SINRICPRO_PRINTF("connected!\r\n[WiFi]: IP-Address is %s\r\n", WiFi.localIP().toString().c_str());
}

// setup function for SinricPro
Expand All @@ -77,8 +84,8 @@ void setupSinricPro() {
SinricProAirQualitySensor& mySinricProAirQualitySensor = SinricPro[DEVICE_ID];

// setup SinricPro
SinricPro.onConnected([](){ Serial.printf("Connected to SinricPro\r\n"); });
SinricPro.onDisconnected([](){ Serial.printf("Disconnected from SinricPro\r\n"); });
SinricPro.onConnected([](){ SINRICPRO_PRINTF("Connected to SinricPro\r\n"); });
SinricPro.onDisconnected([](){ SINRICPRO_PRINTF("Disconnected from SinricPro\r\n"); });
SinricPro.begin(APP_KEY, APP_SECRET);
}

Expand All @@ -89,7 +96,7 @@ void setupDustSensor() {
}

void setup() {
Serial.begin(BAUD_RATE); Serial.printf("\r\n\r\n");
Serial.begin(BAUD_RATE); SINRICPRO_PRINTF("\r\n\r\n");
setupWiFi();
setupSinricPro();
setupDustSensor();
Expand All @@ -115,7 +122,7 @@ void loop() {
if(success) {
Serial.println("Air Quality event sent! ..");
} else {
Serial.printf("Something went wrong...could not send Event to server!\r\n");
SINRICPRO_PRINTF("Something went wrong...could not send Event to server!\r\n");
}

dispatchTime += MIN;
Expand Down
Loading