Skip to content

Instantly share code, notes, and snippets.

@sivar2311
sivar2311 / sample.cpp
Created November 6, 2019 13:03
template for multiple device configuration
typedef struct {
byte group; // RC SWITCH Group ID
byte device; // RC SWITCH DeviceID
bool state; // RC SWITCH state (on/off)
} config_t;
// std:map to hold device configuration and actual device state
// could be stored on SPIFFS and configured via local webserver
// in this example it's configured static:
@sivar2311
sivar2311 / 3_Way_Light.ino
Last active March 22, 2020 05:45
Kreutzschaltung mit 3 Schaltern und 1 Lampe
/*
* If you encounter any issues:
* - check the readme.md at https://github.com/sinricpro/esp8266-esp32-sdk/blob/master/README.md
* - ensure all dependent libraries are installed
* - see https://github.com/sinricpro/esp8266-esp32-sdk/blob/master/README.md#arduinoide
* - see https://github.com/sinricpro/esp8266-esp32-sdk/blob/master/README.md#dependencies
* - open serial monitor and check whats happening
* - check full user documentation at https://sinricpro.github.io/esp8266-esp32-sdk
* - visit https://github.com/sinricpro/esp8266-esp32-sdk/issues and check for existing issues or open a new one
*/
@sivar2311
sivar2311 / EEPROM.ino
Created August 12, 2020 04:36
EEPROM_Check
#include <Arduino.h>
#include <EEPROM.h>
#define MAGIC_BYTE 0xDD
bool checkInit() {
return (EEPROM.read(0) == MAGIC_BYTE);
}
void initializeEEPROM() {
@sivar2311
sivar2311 / thermostat.ino
Created October 7, 2020 17:44
2_Thermostats at same time
// Uncomment the following line to enable serial debug output
#define ENABLE_DEBUG
#ifdef ENABLE_DEBUG
#define DEBUG_ESP_PORT Serial
#define NODEBUG_WEBSOCKETS
#define NDEBUG
#endif
#include <Arduino.h>
@sivar2311
sivar2311 / 5050light.ino
Last active November 12, 2020 11:24
5050 Light example
#include "SinricPro.h"
#include "SinricProLight.h"
#define WIFI_SSID "YOUR-WIFI-SSID"
#define WIFI_PASS "YOUR-WIFI-PASS"
#define APP_KEY "YOUR-APPKEY" // Should look like "de0bxxxx-1x3x-4x3x-ax2x-5dabxxxxxxxx"
#define APP_SECRET "YOUR-APPSECRET" // Should look like "5f36xxxx-x3x7-4x3x-xexe-e86724a9xxxx-4c4axxxx-3x3x-x5xe-x9x3-333d65xxxxxx"
#define LIGHT_ID "YOUR-DEVICEID" // Should look like "5dc1564130xxxxxxxxxxxxxx"
#define BAUD_RATE 9600 // Change baudrate to your need for serial log
@sivar2311
sivar2311 / relay.ino
Created November 11, 2020 20:37
Very basic relay control
#include "SinricPro.h"
#include "SinricProSwitch.h"
#define WIFI_SSID "YOUR-WIFI-SSID"
#define WIFI_PASS "YOUR-WIFI-PASS"
#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 9600 // Change baudrate to your need
@sivar2311
sivar2311 / beamerlift.ino
Last active November 22, 2020 14:54
Beamerlift
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ArduinoOTA.h>
#include "logger.h"
Logger logger;
#define ENABLE_DEBUG
#ifdef ENABLE_DEBUG
@sivar2311
sivar2311 / LM75_Thermostat.ino
Created January 19, 2021 11:23
Thermostat_LM75_Relay
#include "credentials.h"
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include "lm75.h"
#include "SinricPro.h"
#include "SinricProThermostat.h"
#include "EEPROM.h"
@sivar2311
sivar2311 / credentials.h
Created February 27, 2021 12:54
SinricProMQTTExample
#define SSID "WIFI_SSID"
#define PASS "WIFI_PASS"
#define MQTT_SERVER "MQTT-SERVER-ADDRESS"
#define MQTT_PORT 1883
#define MQTT_USERNAME "MQTT-USER-NAME"
#define MQTT_KEY "MQTT-KEY"
#define MQTT_TOPIC "MQTT-TOPIC"
#define APP_KEY "SINRIC-PRO-APPKEY"
@sivar2311
sivar2311 / DimmerSensor.h
Created March 8, 2021 10:57
Custom Dimmer Sensor
#ifndef _DIMMERSENSOR_H_
#define _DIMMERSENSOR_H_
#include <SinricProDevice.h>
#include <Capabilities/RangeController.h>
#include <Capabilities/ContactSensor.h>
class DimmerSensor
: public SinricProDevice
, public RangeController<DimmerSensor>