|
EnigmaIOT
0.9.8
Secure sensor and gateway platform based on ESP8266 and ESP32
|
Go to the documentation of this file.
3 #ifndef _BASICCONTROLLER_h
4 #define _BASICCONTROLLER_h
6 #if defined(ARDUINO) && ARDUINO >= 100
19 #define CONTROLLER_CLASS_NAME SmartSwitchController
22 #if SUPPORT_HA_DISCOVERY
30 #define DEFAULT_BUTTON_PIN 4
31 #define DEFAULT_RELAY_PIN 14
103 const size_t capacity = JSON_OBJECT_SIZE (10);
104 DynamicJsonDocument json (capacity);
105 json[
"status"] =
"start";
107 char version_buf[10];
108 snprintf (version_buf, 10,
"%d.%d.%d",
110 json[
"version"] = String (version_buf);
bootRelayStatus_t bootStatus
void setRelay(bool state)
void configManagerStart()
Called when wifi manager starts config portal.
nodeMessageType
Message code definition.
void loop()
This should be called periodically for module handling.
smartSwitchControllerHw_t config
static const uint8_t ENIGMAIOT_PROT_VERS[3]
EnitmaIoT Version.
bool processRxCommand(const uint8_t *address, const uint8_t *buffer, uint8_t length, nodeMessageType_t command, nodePayloadEncoding_t payloadEncoding)
Called to process a downlink command.
bool saveConfig()
Saves output module configuration.
void buildHATriggerDiscovery()
Home Assistant switch integration.
bool sendJson(DynamicJsonDocument &json)
Sends a JSON encoded message to lower layer.
bool sendCommandResp(const char *command, bool result)
Sends command processing response acknowledge.
AsyncWiFiManagerParameter * buttonPinParam
void buildHALinkDiscovery()
Home Assistant trigger integration.
void connectInform()
Used to notify controller that it is registered on EnigmaIOT network.
void configManagerExit(bool status)
Called when wifi manager exits config portal.
AsyncWiFiManagerParameter * bootStatusListParam
static const char * CONTROLLER_NAME
void buildHASwitchDiscovery()
Sends a HA discovery message for a single entity. Add as many functions like this as number of entiti...
AsyncWiFiManagerParameter * bootStatusParam
Main node class. Manages communication with gateway and allows sending and receiving user data.
void setup(EnigmaIOTNodeClass *node, void *data=NULL)
Initialize data structures.
void setLinked(bool state)
Prototype for JSON/MSGPACK based controller node.
bool sendStartAnouncement()
Send a message to notify node has started running.
AsyncWiFiManagerParameter * relayPinParam
bool loadConfig()
Loads output module configuration.