EnigmaIOT  0.9.8
Secure sensor and gateway platform based on ESP8266 and ESP32
Public Member Functions | Static Public Member Functions | List of all members
HATrigger Class Reference

#include <haTrigger.h>

Inheritance diagram for HATrigger:
HAEntity

Public Member Functions

 HATrigger ()
 Trigger constructor. More...
 
void setPayload (const char *payload)
 Optional payload to match the payload being sent over the topic https://www.home-assistant.io/integrations/device_trigger.mqtt/#payload. More...
 
void setType (ha_triggerType_t type)
 Set trigger type as ha_triggerType_t https://www.home-assistant.io/integrations/device_trigger.mqtt/#type. More...
 
void setType (const char *type)
 Set trigger type as char string https://www.home-assistant.io/integrations/device_trigger.mqtt/#type. More...
 
void setSubtype (ha_triggerSubtype_t subtype)
 Set trigger subtype as ha_triggerSubtype_t https://www.home-assistant.io/integrations/device_trigger.mqtt/#subtype. More...
 
void setSubtype (const char *subtype)
 Set trigger subtype as char string https://www.home-assistant.io/integrations/device_trigger.mqtt/#subtype. More...
 
- Public Member Functions inherited from HAEntity
size_t getAnounceMessage (int bufferlen, uint8_t *buffer)
 Gets entity anounce message to be sent over EnigmaIOT message. More...
 
void setNameSufix (const char *payload)
 Sets name suffix. Used for multi entity nodes. More...
 
void allowSendAttributes ()
 Enables registering entity attributes as a json object. More...
 
size_t measureMessage ()
 Gets needed buffer size for discovery message. More...
 

Static Public Member Functions

static const char * getTriggerTypeStr (int type)
 Returns string that correspond with trigger type in ha_triggerType_t format https://www.home-assistant.io/integrations/device_trigger.mqtt/#type. More...
 
static const char * getTriggerSubtypeStr (int subtype)
 Returns string that correspond with trigger subtype in ha_triggerSubtype_t format https://www.home-assistant.io/integrations/device_trigger.mqtt/#subtype. More...
 
static size_t getDiscoveryJson (char *buffer, size_t buflen, const char *nodeName, const char *networkName, DynamicJsonDocument *inputJSON)
 Allows Gateway to get Home Assistant discovery message using Trigger template. More...
 
- Static Public Member Functions inherited from HAEntity
static String deviceTypeStr (haDeviceType_t entityType)
 Gets entity type string from haDeviceType_t value https://www.home-assistant.io/docs/mqtt/discovery/. More...
 
static String getDiscoveryTopic (const char *hassPrefix, const char *nodeName, haDeviceType_t entityType, const char *nameSuffix=NULL)
 Allows Gateway to get discovery message MQTT topic. More...
 

Additional Inherited Members

- Protected Member Functions inherited from HAEntity
 HAEntity ()
 Default constructor. Needed for inheritance. More...
 
- Protected Attributes inherited from HAEntity
size_t capacity
 JSON object memory reservation length. More...
 
haDeviceType_t deviceType = UNDEFINED
 HomeAssistant entity device type. More...
 
DynamicJsonDocument * entityConfig
 JSON object to be sent to gateway. More...
 

Detailed Description

Definition at line 126 of file haTrigger.h.

Constructor & Destructor Documentation

◆ HATrigger()

HATrigger::HATrigger ( )
inline

Trigger constructor.

Definition at line 132 of file haTrigger.h.

Member Function Documentation

◆ getDiscoveryJson()

size_t HATrigger::getDiscoveryJson ( char *  buffer,
size_t  buflen,
const char *  nodeName,
const char *  networkName,
DynamicJsonDocument *  inputJSON 
)
static

Allows Gateway to get Home Assistant discovery message using Trigger template.

Parameters
bufferBuffer to hold message string
buflenBuffer size
nodeNameOriginating node name
networkNameEnigmaIOT network name
inputJSONJSON object sent by node with needed data to fill template in
Returns
Discovery message payload

msgPack || !len

Definition at line 39 of file haTrigger.cpp.

◆ getTriggerSubtypeStr()

static const char* HATrigger::getTriggerSubtypeStr ( int  subtype)
inlinestatic

Returns string that correspond with trigger subtype in ha_triggerSubtype_t format https://www.home-assistant.io/integrations/device_trigger.mqtt/#subtype.

Parameters
subtypeTrigger type

Definition at line 158 of file haTrigger.h.

◆ getTriggerTypeStr()

static const char* HATrigger::getTriggerTypeStr ( int  type)
inlinestatic

Returns string that correspond with trigger type in ha_triggerType_t format https://www.home-assistant.io/integrations/device_trigger.mqtt/#type.

Parameters
typeTrigger type

Definition at line 145 of file haTrigger.h.

◆ setPayload()

void HATrigger::setPayload ( const char *  payload)

Optional payload to match the payload being sent over the topic https://www.home-assistant.io/integrations/device_trigger.mqtt/#payload.

Parameters
payloadPayload string

Definition at line 13 of file haTrigger.cpp.

◆ setSubtype() [1/2]

void HATrigger::setSubtype ( const char *  subtype)
inline

Set trigger subtype as char string https://www.home-assistant.io/integrations/device_trigger.mqtt/#subtype.

Parameters
subtypePayload string

Definition at line 205 of file haTrigger.h.

◆ setSubtype() [2/2]

void HATrigger::setSubtype ( ha_triggerSubtype_t  subtype)
inline

Set trigger subtype as ha_triggerSubtype_t https://www.home-assistant.io/integrations/device_trigger.mqtt/#subtype.

Parameters
subtypePayload string

Definition at line 196 of file haTrigger.h.

◆ setType() [1/2]

void HATrigger::setType ( const char *  type)
inline

Set trigger type as char string https://www.home-assistant.io/integrations/device_trigger.mqtt/#type.

Parameters
typePayload string

Definition at line 187 of file haTrigger.h.

◆ setType() [2/2]

void HATrigger::setType ( ha_triggerType_t  type)
inline

Set trigger type as ha_triggerType_t https://www.home-assistant.io/integrations/device_trigger.mqtt/#type.

Parameters
typePayload string

Definition at line 178 of file haTrigger.h.


The documentation for this class was generated from the following files: