EnigmaIOT  0.9.8
Secure sensor and gateway platform based on ESP8266 and ESP32
haCover.h
Go to the documentation of this file.
1 
9 #ifndef _HA_COVER_h
10 #define _HA_COVER_h
11 
12 #include "haEntity.h"
13 
14 #if SUPPORT_HA_DISCOVERY
15 
119 class HACover : public HAEntity {
120 
121 public:
122 
126  HACover () {
127  capacity = JSON_OBJECT_SIZE (10) + 250;
128  entityConfig = new DynamicJsonDocument (capacity);
129  deviceType = COVER;
130  (*entityConfig)[ha_device_type] = deviceType;
131  };
132 
137  void setDeviceClass (haCoverClass_t devClass);
138 
144  void setPayloadOpen (const char* payload);
145 
151  void setPayloadClose (const char* payload);
152 
158  void setPayloadStop (const char* payload);
159 
164  void setPayloadGoto (const char* payload);
165 
171  void setStateOpen (const char* payload);
172 
178  void setStateOpening (const char* payload);
179 
185  void setStateClosed (const char* payload);
186 
192  void setStateClosing (const char* payload);
193 
199  void setStateStopped (const char* payload);
200 
210  static size_t getDiscoveryJson (char* buffer, size_t buflen, const char* nodeName, const char* networkName, DynamicJsonDocument* inputJSON);
211 
217  static String deviceClassStr (haCoverClass_t sensorClass);
218 
219 };
220 
221 #endif // SUPPORT_HA_DISCOVERY
222 
223 #endif // _HA_COVER_h
haCoverClass_t
haCoverClass_t
Definition: haEntity.h:102
HACover::getDiscoveryJson
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 Cover template.
Definition: haCover.cpp:114
COVER
@ COVER
Definition: haEntity.h:58
HACover::setStateOpening
void setStateOpening(const char *payload)
The payload that represents the opening state https://www.home-assistant.io/integrations/cover....
Definition: haCover.cpp:50
HAEntity::entityConfig
DynamicJsonDocument * entityConfig
JSON object to be sent to gateway.
Definition: haEntity.h:138
HACover::setStateClosing
void setStateClosing(const char *payload)
The payload that represents the closing state https://www.home-assistant.io/integrations/cover....
Definition: haCover.cpp:62
HACover
Definition: haCover.h:119
haEntity.h
Defines an entity for Home Assistant autodiscovery.
HACover::setPayloadClose
void setPayloadClose(const char *payload)
The command payload that closes the cover https://www.home-assistant.io/integrations/cover....
Definition: haCover.cpp:26
HAEntity::capacity
size_t capacity
JSON object memory reservation length.
Definition: haEntity.h:134
HACover::setPayloadOpen
void setPayloadOpen(const char *payload)
The command payload that opens the cover https://www.home-assistant.io/integrations/cover....
Definition: haCover.cpp:20
HACover::deviceClassStr
static String deviceClassStr(haCoverClass_t sensorClass)
Gets binary sensor class name from haCoverClass_t https://www.home-assistant.io/integrations/cover....
Definition: haCover.cpp:192
HACover::setDeviceClass
void setDeviceClass(haCoverClass_t devClass)
Define cover class as haCoverClass_t
Definition: haCover.cpp:13
HACover::setPayloadStop
void setPayloadStop(const char *payload)
The command payload that stops the cover https://www.home-assistant.io/integrations/cover....
Definition: haCover.cpp:32
ha_device_type
constexpr auto ha_device_type
Definition: haEntity.h:23
HAEntity::deviceType
haDeviceType_t deviceType
HomeAssistant entity device type.
Definition: haEntity.h:135
HACover::HACover
HACover()
Cover constructor.
Definition: haCover.h:126
HACover::setPayloadGoto
void setPayloadGoto(const char *payload)
The command that moves the cover to specific position.
Definition: haCover.cpp:38
HACover::setStateStopped
void setStateStopped(const char *payload)
The payload that represents the stopped state https://www.home-assistant.io/integrations/cover....
Definition: haCover.cpp:68
HACover::setStateOpen
void setStateOpen(const char *payload)
The payload that represents the open state https://www.home-assistant.io/integrations/cover....
Definition: haCover.cpp:44
HAEntity
Definition: haEntity.h:132
HACover::setStateClosed
void setStateClosed(const char *payload)
The payload that represents the closed state https://www.home-assistant.io/integrations/cover....
Definition: haCover.cpp:56