HAButton class¶
-
class HAButton : public HABaseDeviceType¶
HAButton represents a button that’s displayed in the Home Assistant panel and triggers some logic on your Arduino/ESP device once clicked.
Note
You can find more information about this entity in the Home Assistant documentation: https://www.home-assistant.io/integrations/button.mqtt/
Public Functions
-
HAButton(const char *uniqueId)¶
- Parameters
uniqueId – The unique ID of the button. It needs to be unique in a scope of your device.
-
inline void setDeviceClass(const char *deviceClass)¶
Sets class of the device. You can find list of available values here: https://www.home-assistant.io/integrations/button/#device-class
- Parameters
deviceClass – The class name.
-
inline void setIcon(const char *icon)¶
Sets icon of the button. Any icon from MaterialDesignIcons.com (for example:
mdi:home
).- Parameters
icon – The icon name.
-
inline void setRetain(const bool retain)¶
Sets retain flag for the button’s command. If set to
true
the command produced by Home Assistant will be retained.- Parameters
retain –
Protected Functions
-
virtual void buildSerializer() override¶
-
virtual void onMqttConnected() override¶
-
virtual void onMqttMessage(const char *topic, const uint8_t *payload, const uint16_t length) override¶
-
HAButton(const char *uniqueId)¶