arduino-esp32/libraries/RainMaker
Me No Dev 6f7a1ca76a
ESP-IDF v5.1 (#7733)
* Initial changes to compile under ESP-IDF v5.1

* Initial import for ESP-IDF v5.1 libs

* Update toolchain

* Update esp32-hal-psram.c

* Add missing LDs

* Update platform.txt

* Stop some CI jobs, because they will always fail

* Fix examples

* Update app_httpd.cpp

* Update ResetReason.ino

* Warnings fixes

* Added the example guideline and template (#7665)

* Added the example guideline and template

* PR review changes with some typos and grammar fixes

* Changes according to the PR review

* Added ESP32-S3 link to the datasheet (#7738)

* Update HiFreq_ADC.ino

* Replace periph_ctrl.h use because of deprecation

* Replace esp_spi_flash.h use because of deprecation

* Add includes to male mDNS::enableWorkstation compile

* Fix ssl_client mbedtls_pk_parse_key callback

* Update temperature sensor driver

* Allow sketch_utils to compile with arduino-cli

* Run CI with arduino-cli

* Fix arduino-cli CI build on Windows

* Refactor platform.txt to not use components installed through the board manager when running from git

* Initial Peripheral Manager Implementation

* Update SigmaDelta driver to use the new ESP-IDF driver API

* Small improvements to peripheral manager and SigmaDelta

* Remove deleted function from SigmaDelta header

* Update DAC driver to use the new ESP-IDF driver API

* Adds softAp(String) to make it compatible with ESP8266 (#7801)

* Fix commentary (#7800)

Minor fix based on observation done in https://github.com/espressif/arduino-esp32/issues/7795#issuecomment-1416868611

* add adafruit new board feather esp32s2 reserve tft (#7794)

* bugfix: add <stdint.h> for uint8_t to avoid compilation failure (GCC 11.2.0) (#7744)

* Adding 3rd party boards for VALTRACK-V4-VTS-ESP32-C3 & VALTRACK-V4-MFW-ESP32-C3 (#7735)

* Added VALTRACK-V4-VTS-ESP32-C3 board definition

Created pins_arduino.h & made changes to boards.txt with necessary changes

* Modified the URL

* Renamed json

* renamed all auRL

* Adding VALTRACK-V4 series board definitions

Added VALTRACK-V4-VTS-ESP32C3 & VALTRACK-V4-MFW-ESP32-C3 board variants

* Adding VALTRACK-V4 series board definitions

Added VALTRACK-V4-VTS-ESP32C3 & VALTRACK-V4-MFW-ESP32-C3 board variants

* Reverted package_esp32_index.template.json

restored package_esp32_index.template.json from edits

* Reverted package_esp32_index.template.json

Added new line to package_esp32_index.template.json

* Update Platformio CI (#7725)

* WiFiClient example fix (#7711)

* Modified WiFiClient example to use thingspeak instead of non-functionig sparkfun

* Moved instructions to README

* Fixed spelling

* Added link to S3 datasheet

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>

* Mirror update from Heltec repository (#7709)

Heltec updated the I2C pins in b10f4bf85d

* Fixes BLE data printing (#7699)

* Fixes BLE data printing

BLE data has no '\0' terminator, therefore it can't be printed as a regular C string.
This fix just prints the BLE data based on its length.

* Simplify printing to a single call

* split menu options + lora_32_V3 fix (#7697)

* Change header gaurd name (#7696)

* Fix Name (#7691)

Wrong name in definitions.

* Fix error in WiFiClient.cpp where the connect function fails for timeouts below 1 second (#7686)

* Update WiFiClient.cpp

This change will allow specifying connect timeouts below 1 second. Without this change, if connect timeouts under 1 second are given, the connect defaults to 0ms and fails. 
This will also allow timeouts in fractions of seconds, e.g. 1500ms. Without this change, connect timeouts are truncated to full second increments.

* Make parameter timeout_ms clear

* Change connection timeout_ms name for clarity

---------

Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>

* fixed the function header (#7674)

* fixed the function header

* fixed function name and paramaters

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>

* Ticker fix solving #6155 (#7664)

* Wrapped Ticker functions with #pragma disabling -Wcast-function-type

* Revert "Wrapped Ticker functions with #pragma disabling -Wcast-function-type"

This reverts commit 160be7e67a10d01b6e44c4bf2521c0ccd6348976.

* Fixed Ticker example

* Modified Ticker example

* Fixed LED_BUILTIN err for ESP32

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>

* setPins fix ESP32 "specified pins are not supported by this chip." (#7646)

[ESP32: SDMMCFS::begin hardcodes the usage of slot 1, only check if the pins match slot 1 pins.]

setPins() was testing pins D1, D2 and D3 all against D1 ... fine in 1 pin mode when all are -1 not so much if you're trying to get 4 pin mode working.
I now see this function doesn't really do anything on the ESP32...accept now correctly checks that you are trying to use the slot 1 pins.

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>

* Allow passing IP as connect method parameter in WiFiClientSecure and skip unnecessary host-ip conversions (#7643)

* Add LED_BUILTIN* definitions and initialization for LEDs to stop them floating. (#7636)

Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>

* Expand path to tinuf2 image when checking existence in platformio-build.py (#7631)

* Expand path to tinuf2 image when checking existence

* More isFiles fixed

* Remove (useless) trailing semicolon from Print.cpp (#7622)

* ADD: New variant Edgebox-ESP-100 (#7771)

* ADD: New variant Edgebox-ESP-100

* FIX: Edgebox-ESP-100 Board.txt usb mode option change back to default value as ESP32S3

* Add Crabik Slot ESP32-S3 board (#7790)

* Added Crabik Slot ESP32-S3

* Adding CPU frequency settings and removing excess from partition scheme settings

* new variant LilyGO T-Display-S3 (#7763)

* new variant LilyGO T-Display-S3

https://github.com/Xinyuan-LilyGO/T-Display-S3

* Add boards.txt definition

---------

Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>

* Update get.py to support Apple ARM64

* Update package_esp32_index.template.json

* WString Return bool (#7774)

* Add Roboheart Hercules development board to the esp32-core (#7672)

* added Roboheart Hercules pin definitions and board.txt entries

* added package_roboheat.json for prototyping

* Roboheart Hercules pins

* Updated the pins

* Delete package_roboheart.json

* Requested changes

---------

Co-authored-by: renebohne <rene.bohne@gmail.com>

* Reword "ESP-IDF as Component" (#7812)

I think "Arduino as an ESP-IDF component" or just "As ESP-IDF component" instead of  "ESP-IDF as Component" is more correct way to name the link.

1. "ESP-IDF as Component" would imply that ESP-IDF is some sort of library for Arduino, which is (IMO) misleading, because it's true the other way around.
2. It's written as "Arduino as an ESP-IDF component" on the webpage it points to as well.

- Also I removed the capitalization from "Component" as I have not found a reason why is it capitalized.

* add new board Adafruit Feather ESP32-S3 Reverse TFT (#7811)

* Multi threading examples (tasks, queues, semaphores, mutexes) (#7660)

* Moved and renamed example ESP32/FreeRTOS to MultiThreading/BasicMultiThreading

* Added dummy files

* Modified original example

* Fixed BasicMultiThreading.ino

* Added Example demonstrating use of queues

* Extended info in BasicMultiThreading

* Renamed Queues to singular Queue

* Added Mutex example

* Added Semaphore example

* Moved info from example to README

* Moved doc from Mutex to README

* Added Queue README

* Removed unecesary text

* Fixed grammar

* Increased stack size for Sempahore example

* Added headers into .ino files

* Added word Example at the end of title in README

* removed unused line

* Added forgotten README

* Modified BasicMultiThreading example

* Added missing S3 entry in README

* moved location

* Update ESP-IDF libs

* Update CMakeLists.txt

* Update esptool to v4.4

* Add function timerAttachInterruptFlag (#7809)

* Update esptool to v4.5

* ADC refactoring (#7827)

* Adc refactored + periman implementation

Peripheral manager still needs to be checked if the implementation is right.

* switched to working solution for milivolts read

* Periman detachbus fix

* coding style

* fix CI warnings

* fix FreeRTOS example

* Update ETH.cpp

* Update FunctionalInterruptStruct.ino

* Update package_esp32_index.template.json

* Update package_esp32_index.template.json

* Fixes for the latest IDF v5.1

* update esp-idf libs and toolchain

* Turn OFF auto crystal frequency for ESP32 (needed by TWAI)

* Update examples

* Switch build to mostly use flags from files

Includes can not be done this way

* Reorganize flag files

* Optimize chip build flags further

* Revert defines from file. MBEDTLS_CONFIG_FILE does not properly expand

* Add support for includes and defines from file

* Replace old sdk path references in platform.txt

* use gcc-ar (#8013)

* Makes F_CPU generic for all SoC (#8007)

Based on CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ that is correctly defined in the sdkconfig file for each SoC.

* TIMER refactoring (#7904)

* refactor using GPtimer

* Updated timer HW test

* fix examples

* Add v2.0.7 in issue template (#7871)

* refactor using GPtimer

* Updated timer HW test

* fix examples

* Revert "Add v2.0.7 in issue template (#7871)"

This reverts commit fcc3b17d62ff57861f8913ca1f142fd5163b7457.

* Update upload-artifact to v3 in HW CI

* Revert "Update upload-artifact to v3 in HW CI"

This reverts commit 1ba228071718ba37c4e26d98db22f77b2a7364a6.

* replace resolution with frequency

* remove count_down option

* countup removed from examples + header

* Refactored timer object

* code cleanup + examples and tests fixes

* TimerAlarm fix

---------

Co-authored-by: Vojtěch Bartoška <76958047+VojtechBartoska@users.noreply.github.com>

* [Docs] ADC and Timer API Update (+some docs fixes) (#7906)

* updated docs

* remove hall sensor docs

Removed Hall sensor documentation as its no longer supported in IDF-5

* Fixed ESPNow examples location in docs

* Last timer refactored API + gpio small fix

* AlarmWrite fix

* Fixes APLL/PLL with RTC Frequency (#8025)

log_d() was displaying APLL for any SoC, but S3 and C3 has not such option, causing compilation errors.

* Update IDF libs and fix OPI PSRAM on S3

* Add setMode function HardwareSerial.c to set the esp32 uart mode for use with RS485 auto RTS (#7935)

* Added setMode function to set the esp32 uart mode

Used to set the esp32 uart mode for use with RS485 Half Duplex and the auto RTS pin mode. This will set/clear the RTS pin output to control the RE/DE pin on most RS485 chips.

* Add Success (bool) return in some functions

* Add Success (bool) return code to some functions

* Add Success (bool) return to some functions

* Add Success (bool) return to some functions

* Fix uartSetRxTimeout return type

---------

Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>

* Add support for esp-elf-gdb

* WFG Crashfix (#8044)

* Update component libs

* IDF release/v5.1 (#8061)

* IDF release/v5.1 bb9200acec

* Update Esp.cpp

* IDF release/v5.1 420ebd208a

* Update esp32-hal-psram.c

* Switch SDK to be an external package

* fix path (#8096)

* Makes UART work at any APB Frequency (#8097)

Fixes HardwareSerial to work with IDF 5.1 on any CPU/APB Frequency (240MHz to 10MHZ), including user created low power modes.

* Add required callbacks for TinyUSB DFU

* Update version to 3.0.0

* Add ESP.getCoreVersion() and update ESP.getChipModel()

* Update timer hal for the latest 5.1

* Use separate RX and TX buffer sizes in HTTP client

optimizes download by allowing up to 4K packets to be received

* Rename clock tree enum name in latest 5.1

* ESP32-H4 support was removed in ESP-IDF v5.1

* IDF release/v5.1 2004bf4e11 (#8165)

* Deinit previous bus first (#8180)

* TIMER - add timer_started flag, fix timerEnd() + timer HW test (#8135)

* Add timer_started flag and stop before disable

* Fix timer HW test

* TOUCH - Peripheral manager implementation (#8129)

* Touch periman implemented

* Deinit previous bus first

* LEDC Refactoring - Peripheral manager implemented (#8126)

* LEDC periman implementation

* Fix examples

* Rework tone

* Update ledc docs

* fix missing bracket

* Update analog funtions esp32-hal.h

* Update CameraWebServer example

* Fix HiFreq_ADC example

* minor fixes - typos

* Avoid calling tone/notone when tone already runs on dif. pin

* Remove unused channels_resolution

* GPIO - Peripheral manager implementation (#8179)

* periman-implementation

* fix RGB_BUILTIN and remove space

* Enforces more consistency into Peripheral Manager (#8188)

* Avoid log_i() message the first time a bus is assigned

* Prevent operation with ESP32_BUS_TYPE_INIT

* keeps coding style

* do not print messages on INIT bus type

* [Arduino Core 3.0.0] RMT IDF5.1 Refactoring (#7994)

* RMT IDF5.1 refactoring

* Fixes initial value setting

* removed rmtRead() with user callback

* simplify/remove Read data structure

* Deep API simplification

* fixes the examples

* fix rmt.h

* adds support to APB different frequencies

* fixes CI and not defined RGB_BUILTIN

* new RMT API and examples

* fixing commentaties

* Update esp32-hal-rgb-led.c

* changes Filter API

* Fixes example with Filter API

* Update PlatformIO scripts for the upcoming 3.0 core (#8183)

* Update PlatformIO scripts for the upcoming 3.0 core

* Dynamically select proper framework-arduinoespressif32-libs package

With this change the dev-platform will be dynamically configured to
pull the latest .zip package with precompiled libraries from extracted from
package_esp32_index.template.json

* free memory on detach (#8264)

* SPI - Peripheral manager implementation  (#8255)

* spi periman implementation

* fix header file

* remove unused struct

* fix missing braces

* Update esp32-hal-rmt.c (#8216)

Optimizing Peripheral Manager Test

* I2C - Peripheral manager implementation (#8220)

* i2c-master periman initial commit

* i2c-master make detachbus static + comment remove

* i2c-slave periman implementation

* SetPinBus to INIT on i2cDeinits

* Fix slave pins deinit

* remove dbg logs

* set ret to ESP_FAIL instead of returning

* Fix warnings in hal-spi caused by pariman transition

* Update esptool.py to version 4.6

* Add platform support for ESP_SR

* Add USB Type and valid pin check to periman

* replace bus with spi->num+1 (#8279)

* Remove default pins from SPI HAL

* Add commented out handlers for esptool.js in TinyUSB CDC

For future use

* Add build defines for host os and fqbn (for debug purposes)

* Provide proper memory caps total size

* Update Esp.cpp

* SDMMC - Peripheral manager implementation (#8289)

* sdmmc periman implemented

* save pins when SOC_SDMMC_USE_IOMUX

* IDF release/v5.1 4bc762621d (#8292)

* Adds missing pinMode (#8312)

* Adds missing pinMode

The example code lacks a pinMode() to initialize the GPIO 0 (button). In Arduino Core 3.0.0, it prints an error message when trying to read a not initialized GPIO.

* Update KeyboardLogout.ino

Adds <buttonPin> to keep code standard

* Update KeyboardReprogram.ino

Adds <buttonPin> to keep code standard

* LEDC Fade implementation (#8338)

* fade API + pointer fixes

* Add fade api

* Add fade example

* update ledc docs

* remove unused variables

* fix path to example

* Adds USB to Peripheral Manager - Arduino Core 3.0.0 (#8335)

* ETHERNET - Peripheral manager implementation (#8297)

* Peripheral manager implemented

* remove unused variable

* Add all RMII pins

* fix typo

* Adds HardwareSerial to Peripheral Manager Arduino 3.0.0 (#8328)

* Do not limit ETHERNET in periman to only ESP32. SPI is also an option

* Initial support for ESP32-C6 (#8337)

* Add checks for SOC defines (#8351)

* Add checks for SOC defines

* Add SoC checks to BLE library

* fix i2c compilation error

* fix wrong placement of include

* add check to SPI library

* add check to USB library

* add checks to Wire library

* Feature/esp32h2 support (#8373)

* Initial support for ESP32H2

* Additional changes for ESP32H2

* Update libs for ESP32H2

* Fix flashing on ESP32-H2

* Fix GPIO Configs for ESP32-C6 and ESP32-H2

* Update Timer test sketch

* Fix upload flash parameters

* Use ets_write_char_uart instead of ets_printf in log_printfv

* Print full chip report when log level is sufficient (#8282)

* ESP32-C3 does not have ets_write_char_uart

* Fix BLE gap event name

* HW Testing - Pytest update (#8389)

* update tests requirements

* remove already handled components

* Update version of pytest

* Add missing ESP32-H2 to hil.yml

* Updated FreeRTOS names (#8418)

* HW Testing -  ESP32-C6 + ESP32-H2 fixes (#8404)

* add C6/H2 to tests cfg.json

* remove ,

* workflow runs-on runner by matrix

* Add need for arduino tag to select runner

* Add cryptography to requirements.txt

* Removed duplicate TX1 define for H2 (#8402)

* Fix broken examples

* Fixes RMT filter & idle timing and setup (#8359)

* Fixes Filter and Idle parameter to uint32

* Fixes Filter and Idle setup

* Fixes it to 5.1Libs branch

* fix RMT CLK source and Filter API

* fixes missing ;

* fixes missing ;

* fixes RMT example

* IDF release/v5.1 a7b62bbcaf (#8438)

* Add workflow to build executables from python scripts (#8290)

* Add workflow to build executables from python scripts

* Push binary to tools

* Enable executable signing on Windows

* Update get.py

* Push binary to tools

* Try with multiple files

* Try more actions

* Try powershell

* Restore tools so they do not get rebuilt

* Finalize scripts

* Push binary to tools

* App rollback should be after PSRAM is initialized

* Correcting RX1 to GPIO4 and TX1 to GPIO5 to be consistent with documentation. Previous pin use works but is inconsistent with C6 docs.

* Fixes Memory Leak (#8486)

* fixes preprocessor test (#8485)

* fixes preprocessor test

When using `#define USE_SOFT_AP` 
Change
`&& not USE_SOFT_AP` ==> `&& !defined(USE_SOFT_AP)`

* Adds any BLE capable device in WiFiProv.ino

Removing ESP32 restriction for BLE Provisioning.

* fix flash mode read out for C6

* Add option for custom partitions without restrictions

* SD_MMC update (#8298)

* Updated SD_MMC lib and examples

* Removed getter implementation and commented usage in examples

* squashed updates

* IDF release/v5.1 f0437b945f (#8599)

* Update package_esp32_index.template.json

* Fix printf format build error in BTAdvertisedDeviceSet.cpp

---------

Co-authored-by: Pedro Minatel <pedro.minatel@espressif.com>
Co-authored-by: Rodrigo Garcia <rodrigo.garcia@espressif.com>
Co-authored-by: Ha Thach <thach@tinyusb.org>
Co-authored-by: Martin Turski <quiret@vfemail.net>
Co-authored-by: raviypujar <raviypujar@gmail.com>
Co-authored-by: Jason2866 <24528715+Jason2866@users.noreply.github.com>
Co-authored-by: Tomáš Pilný <34927466+PilnyTomas@users.noreply.github.com>
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: Daniel Berlin <dberlin@dberlin.org>
Co-authored-by: Nima Askari (نیما عسکری) <nimaltd@yahoo.com>
Co-authored-by: rtpmsys <106180646+rtpmsys@users.noreply.github.com>
Co-authored-by: bytiful <55647551+bytiful@users.noreply.github.com>
Co-authored-by: tmfarrington <tmfarrington@users.noreply.github.com>
Co-authored-by: Krzysiek S <chris.streh@gmail.com>
Co-authored-by: surt <carl.olsson@gmail.com>
Co-authored-by: Max Scheffler <max.scheffler@pm.me>
Co-authored-by: Clemens Kirchgatterer <clemens@1541.org>
Co-authored-by: Peter Pan's Techland <twinkle-pirate@hotmail.com>
Co-authored-by: Roman <programmeofficemilkyway@gmail.com>
Co-authored-by: Eistee <Eistee82@users.noreply.github.com>
Co-authored-by: David McCurley <44048235+mrengineer7777@users.noreply.github.com>
Co-authored-by: Gaya3N25 <30388176+Gaya3N25@users.noreply.github.com>
Co-authored-by: renebohne <rene.bohne@gmail.com>
Co-authored-by: Olivér Remény <25034625+remenyo@users.noreply.github.com>
Co-authored-by: davidk88 <david.kotar@gmail.com>
Co-authored-by: Vojtěch Bartoška <76958047+VojtechBartoska@users.noreply.github.com>
Co-authored-by: James Armstrong <jamesarmstrong3@me.com>
Co-authored-by: Valerii Koval <valeros@users.noreply.github.com>
Co-authored-by: Peter G. Jensen <root@petergjoel.dk>
2023-10-05 14:54:25 +03:00
..
examples ESP-IDF v5.1 (#7733) 2023-10-05 14:54:25 +03:00
src ESP-IDF v5.1 (#7733) 2023-10-05 14:54:25 +03:00
library.properties Bump library versions to 2.0.0 (#5182) 2021-05-18 14:00:49 +03:00
README.md Correct Spelling of addTemperatureParam in ESP Rainmaker (#7288) 2022-11-02 13:22:43 +02:00

ESP RainMaker library for Arduino

This library allows to work with ESP RainMaker.

ESP RainMaker is an end-to-end solution offered by Espressif to enable remote control and monitoring for ESP32-S2 and ESP32 based products without any configuration required in the Cloud. The primary components of this solution are:

  • Claiming Service (to get the Cloud connectivity credentials)
  • RainMaker library (i.e. this library, to develop the firmware)
  • RainMaker Cloud (backend, offering remote connectivity)
  • RainMaker Phone App/CLI (Client utilities for remote access)

The key features of ESP RainMaker are:

  1. Ability to define own devices and parameters, of any type, in the firmware.
  2. Zero configuration required on the Cloud.
  3. Phone apps that dynamically render the UI as per the device information.

This ESP RainMaker library is built using esp-rainmaker component.

Repository Source

Phone Apps

Android

iOS

Documentation

Additional information about ESP RainMaker can be found here

NOTE : ESP RainMaker library is currently supported for ESP32 board only.

ESP RainMaker Agent API

RMaker.initNode()

This initializes the ESP RainMaker agent, wifi and creates the node.

Node initNode(const char *name, const char *type);
  • Parameters
  1. name: Name of the node
  2. type: Type of the node
  • Return
  1. Object of Node.
  • You can also set the configuration of the node using the following API
  1. RMaker.setTimeSync(bool val)

NOTE: If you want to set the configuration for the node then these configuration API must be called before RMaker.initNode().

RMaker.start()

It starts the ESP RainMaker agent.

esp_err_t start()
  • Return
  1. ESP_OK : On success
  2. Error in case of failure

NOTE :

  1. ESP RainMaker agent should be initialized before this call.
  2. Once ESP RainMaker agent starts, compulsorily call WiFi.beginProvision() API.

RMaker.stop()

It stops the ESP RainMaker agent which was started using RMaker.start().

esp_err_t stop()
  • Return
  1. ESP_OK : On success
  2. Error in case of failure

RMaker.deinitNode()

It deinitializes the ESP RainMaker agent and the node created using RMaker.initNode().

esp_err_t deinitNode(Node node)
  • Parameter
  1. node : Node object created using RMaker.initNode()
  • Return
  1. ESP_OK : On success
  2. Error in case of failure

RMaker.enableOTA()

It enables OTA as per the ESP RainMaker Specification. For more details refer ESP RainMaker documentation. check here

esp_err_t enableOTA(ota_type_t type);
  • Parameter
  1. type : The OTA workflow type.
    • OTA_USING_PARAMS
    • OTA_USING_TOPICS
  • Return
  1. ESP_OK : On success
  2. Error in case of failure

RMaker.enableSchedule()

This API enables the scheduling service for the node. For more information, check here.

esp_err_t enableSchedule();
  • Return
  1. ESP_OK : On success
  2. Error in case of failure

RMaker.setTimeZone()

This API set's the timezone as a user friendly location string. Check here for a list of valid values.

esp_err_t setTimeZone(const char *tz);
  • Parameter
  1. `tz' : Valid values as specified in documentation.
  • Return
  1. ESP_OK : On success
  2. Error in case of failure

NOTE : default value is "Asia/Shanghai". This API comes into picture only when working with scheduling.

ESP RainMaker NODE APIs

Node class expose API's for node.

NOTE : my_node is the object of Node class.

my_node.getNodeID()

It returns the unique node_id assigned to the node. This node_id is usually the MAC address of the board.

char * getNodeID()
  • Return
  1. char * : Pointer to a NULL terminated node_id string.

my_node.getNodeInfo()

It returns pointer to the node_info_t as configured during node initialisation.

node_info_t * getNodeInfo();
  • Return
  1. node_info_t : Pointer to the structure node_info_t on success.
  2. NULL : On failure.
  • ESP RainMaker node info It has following data member
  1. char * name
  2. char * type
  3. char * fw_version
  4. char * model

my_node.addNodeAttr()

It adds a new attribute as the metadata to the node.

esp_err_t addNodeAttr(const char *attr_name, const char *val);
  • Parameters
  1. attr_name : Name of the attribute
  2. val : Value of the attribute
  • Return
  1. ESP_OK : On success
  2. Error in case of failure

NOTE : Only string values are allowed.

my_node.addDevice()

It adds a device to the node.

esp_err_t addDevice(Device device);
  • Parameter
  1. device : Device object
  • Return
  1. ESP_OK : On success
  2. Error in case of failure

NOTE :

  • This is the mandatory API to register device to node.
  • Single Node can have multiple devices.
  • Device name should be unique for each device.

my_node.removeDevice()

It removes a device from the node.

esp_err_t removeDevice(Device device);
  • Parameter
  1. device : Device object
  • Return
  1. ESP_OK : On success
  2. Error in case of failure

ESP RainMaker DEVICE API's

Device class expose API's for virtual devices on the node. Parameterized constructor is defined which creates the virtual device on the node. Using Device class object you can create your own device.

NOTE : my_device is the object of Device class

Device my_device(const char *dev_name, const char *dev_type, void *priv_data);
  • Parameters
  1. dev_name : Unique device name
  2. dev_type : Optional device type. It can be kept NULL.
    • Standard Device Types
      • ESP_RMAKER_DEVICE_SWITCH
      • ESP_RMAKER_DEVICE_LIGHTBULB
      • ESP_RMAKER_DEVICE_FAN
      • ESP_RMAKER_DEVICE_TEMP_SENSOR
  3. priv_data : Private data associated with the device. This will be passed to the callbacks.

NOTE : This created device should be added to the node using my_node.addDevice(my_device).

  • Sample example
Device my_device("Switch");
Device my_device("Switch1", NULL, NULL);

Here, dev_name is compulsory, rest are optional. Node can have multiple device, each device should have unique device name.

Standard Device

  • Classes are defined for the standard devices.
  • Creating object of these class creates the standard device with default parameters to it.
  • Class for standard devices
    • Switch
    • LightBulb
    • TemperatureSensor
    • Fan
Switch my_switch(const char *dev_name, void *priv_data, bool power);
  • Parameters
  1. dev_name : Unique device name by default it is "switch" for switch device.
  2. priv_data : Private data associated with the device. This will be passed to the callbacks.
  3. power : It is the value that can be set for primary parameter.
  • Sample example for standard device.
Switch switch1;
Switch switch2("switch2", NULL, true);

"switch2" : Name for standard device.

NULL : Private data for the device, which will be used in callback.

true : Default value for the primary param, in case of switch it is power.

NOTE : No parameter are compulsory for standard devices. However if you are creating two objects of same standard class then in that case you will have to set the device name, if not then both device will have same name which is set by default, hence device will not get create. Device name should be unique for each device.

my_device.getDeviceName()

It returns the name of the Device.

const char * getDeviceName();
  • Return
  1. char *: Returns Device name.

NOTE : Each device on the node should have unique device name.

my_device.addDeviceAttr()

It adds attribute to the device. Device attributes are reported only once after a boot-up as part of the node configuration. Eg. Serial Number

esp_err_t addDeviceAttr(const char *attr_name, const char *val);
  • Parameters
  1. attr_name : Name of the attribute
  2. val : Value of the attribute
  • Return
  1. ESP_OK : On success
  2. Error in case of failure

my_device.deleteDevice()

It deletes the device created using parameterized constructor. This device should be first removed from the node using my_node.removeDevice(my_device).

esp_err_t deleteDevice();
  • Return
  1. ESP_OK : On success
  2. Error in case of failure

my_device.addXParam()

It adds standard parameter to the device.

NOTE : X is the default name by which parameter is referred, you can specify your own name to each parameter.

Default

Eg. my_device.addPowerParam(true) here power parameter is referred with name Power. Eg. my_device.addHueParam(12) here hue parameter is referred with name Hue.

You can specify your own name to each parameter

Eg. my_device.addNameParam("NickName") here name parameter is referred with name NickName. Eg. my_device.addPowerParam(true, "FanPower") here power parameter is referred with name FanPower.

esp_err_t addNameParam(const char *param_name = ESP_RMAKER_DEF_NAME_PARAM);
esp_err_t addPowerParam(bool val, const char *param_name = ESP_RMAKER_DEF_POWER_NAME);
esp_err_t addBrightnessParam(int val, const char *param_name = ESP_RMAKER_DEF_BRIGHTNESS_NAME);
esp_err_t addHueParam(int val, const char *param_name = ESP_RMAKER_DEF_HUE_NAME);
esp_err_t addSaturationParam(int val, const char *param_name = ESP_RMAKER_DEF_SATURATION_NAME);
esp_err_t addIntensityParam(int val, const char *param_name = ESP_RMAKER_DEF_INTENSITY_NAME);
esp_err_t addCCTParam(int val, const char *param_name = ESP_RMAKER_DEF_CCT_NAME);
esp_err_t addDirectionParam(int val, const char *param_name = ESP_RMAKER_DEF_DIRECTION_NAME);
esp_err_t addSpeedParam(int val, const char *param_name = ESP_RMAKER_DEF_SPEED_NAME);
esp_err_t addTemperatureParam(float val, const char *param_name = ESP_RMAKER_DEF_TEMPERATURE_NAME);
  • Standard Parameters

  • These are the standard parameters.

    • Name : ESP_RMAKER_DEF_NAME_PARAM
    • Power : ESP_RMAKER_DEF_POWER_NAME
    • Brightness : ESP_RMAKER_DEF_BRIGHTNESS_NAME
    • Hue : ESP_RMAKER_DEF_HUE_NAME
    • Saturation : ESP_RMAKER_DEF_SATURATION_NAME
    • Intensity : ESP_RMAKER_DEF_INTENSITY_NAME
    • CCT : ESP_RMAKER_DEF_CCT_NAME
    • Direction : ESP_RMAKER_DEF_DIRECTION_NAME
    • Speed : ESP_RMAKER_DEF_SPEED_NAME
    • Temperature : ESP_RMAKER_DEF_TEMPERATURE_NAME

NOTE : Care should be taken while accessing name of parameter. Above mentioned are the two ways using which default name of parameters can be accessed. Either LHS or RHS.

my_device.assignPrimaryParam()

It assigns a parameter (already added using addXParam() or addParam()) as a primary parameter, which can be used by clients (phone apps specifically) to give prominence to it.

esp_err_t assignPrimaryParam(param_handle_t *param);
  • Parameter
  1. param : Handle of the parameter. It is obtained using my_device.getParamByName().
param_handle_t * getParamByName(const char *param_name);

NOTE : param_name : It is the name of the parameter which was added using addXparam() or addParam().

my_device.addParam()

It allows user to add custom parameter to the device created using Param class.

esp_err_t addParam(Param parameter);
  • Parameter
  1. parameter : Object of Param
  • Return
  1. ESP_OK : On success
  2. Error in case of failure

NOTE : Param class exposes API's to create the custom parameter.

my_device.updateAndReportParam()

It updates the parameter assosicated with particular device on ESP RainMaker cloud.

esp_err_t updateAndReportParam(const char *param_name, value);
  • Parameters
  1. param_name : Name of the parameter
  2. value : Value to be updated. It can be int, bool, char * , float.
  • Return
  1. ESP_OK : On success
  2. Error in case of failure

my_device.addCb()

It registers read and write callback for the device which will be invoked as per requests received from the cloud (or other paths as may be added in future).

void addCb(deviceWriteCb write_cb, deviceReadCb read_cb);
  • Parameters
  1. write_cb : Function with signature [ func_name(Device *device, Param *param, const param_val_t val, void *priv_data, write_ctx_t *ctx); ]
  2. read_cb : Function with signature [ func_name(Device *device, Param *param, void *priv_data, read_ctx_t *ctx); ]
  • param_val_t val Value can be accessed as below
  1. bool : val.val.b
  2. integer : val.val.i
  3. float : val.val.f
  4. char * : val.val.s

ESP RainMaker PARAM API's

Param class expose API's for creating custom parameters for the devices and report and update values associated with parameter to the ESP RainMaker cloud. Parameterized constructor is defined which creates custom parameter.

NOTE : my_param is the object of Param class.

Param my_param(const char *param_name, const char *param_type, param_val_t val, uint8_t properties);
  • Parameters
  1. param_name : Name of the parameter
  2. param_type : Type of the parameter. It is optional can be kept NULL.
  3. val : Define the default value for the parameter. It should be defined using value(int ival) , value(bool bval) , value(float fval) , value(char *sval).
  4. properties : Properties of the parameter, which will be a logical OR of flags.
    • Flags
      • PROP_FLAG_WRITE
      • PROP_FLAG_READ
      • PROP_FLAG_TIME_SERIES
      • PROP_FLAG_PERSIST

Sample example : Param my_param("bright", NULL, value(30), PROP_FLAG_READ | PROP_FLAG_WRITE | PROP_FLAG_PERSIST);

NOTE : Parameter created using Param class should be added to the device using my_device.addParam(my_param);

my_param.addUIType()

Add a UI type to the parameter. This will be used by the Phone apps (or other clients) to render appropriate UI for the given parameter. Please refer the RainMaker documentation here for supported UI Types.

esp_err_t addUIType(const char *ui_type);
  • Paramter
  1. ui_type : String describing the UI Type.
    • Standard UI Types
    • ESP_RMAKER_UI_TOGGLE
    • ESP_RMAKER_UI_SLIDER
    • ESP_RMAKER_UI_DROPDOWN
    • ESP_RMAKER_UI_TEXT
  • Returns
  1. ESP_OK : On success.
  2. Error in case of failure.

my_param.addBounds()

Add bounds for an integer/float parameter. This can be used to add bounds (min/max values) for a given integer/float parameter. Eg. brightness will have bounds as 0 and 100 if it is a percentage.

esp_err_t addBounds(param_val_t min, param_val_t max, param_val_t step);
  • Parameters
  1. min : Minimum value
  2. max : Maximum value
  3. step : step Minimum stepping
  • Returns
  1. ESP_OK : On success.
  2. Error in case of failure.

Sample example : my_param.addBounds(value(0), value(100), value(5));

my_param.updateAndReport()

It updates the parameter and report it to ESP RainMaker cloud. This is called in callback.

esp_err_t updateAndReport(param_val_t val);
  • Parameters
  1. val : New value of the parameter
  • Return
  1. ESP_OK : On success.
  2. Error in case of failure.

NOTE :

  • This API should always be called inside device write callback, if you aimed at updating n reporting parameter values, changed via RainMaker Client (Phone App), to the ESP RainMaker cloud.
  • If not called then paramter values will not be updated to the ESP RainMaker cloud.

printQR()

This API displays QR code, which is used in provisioning.

printQR(const char *serv_name, const char *pop, const char *transport);
  • Parameters
  1. name : Service name used in provisioning API.
  2. pop : Proof of posession used in provisioning API.
  3. transport :
    1. softap : In case of provisioning using SOFTAP.
    2. ble : In case of provisioning using BLE.

RMakerFactoryReset()

Reset the device to factory defaults.

RMakerFactoryReset(2);
  • Parameters
  1. seconds : Time in seconds after which the chip should reboot after doing a factory reset.

RMakerWiFiReset()

Reset Wi-Fi credentials.

RMakerWiFiReset(2);
  • Parameters
  1. seconds : Time in seconds after which the chip should reboot after doing a Wi-Fi reset.