esp8266_web_settings beta
Public Member Functions | List of all members
grmcdorman::device::Device::Definition Class Referenceabstract

A sensor definition to be published to MQTT. More...

#include <grmcdorman/device/Device.h>

Public Member Functions

virtual const __FlashStringHelper * get_name_suffix () const =0
 Get the name suffix. More...
 
virtual const __FlashStringHelper * get_value_template () const =0
 Get the value template. More...
 
virtual const __FlashStringHelper * get_unique_id_suffix () const =0
 Get the unique id suffix. More...
 
virtual const __FlashStringHelper * get_unit_of_measurement () const =0
 Get the unit of measurement. More...
 
virtual const __FlashStringHelper * get_json_attributes_template () const =0
 Get the json attributes template. More...
 
virtual const __FlashStringHelper * get_icon () const =0
 Get the icon. More...
 

Detailed Description

A sensor definition to be published to MQTT.

This allows MQTT listeners, such as Home Assistant, to automatically discover and recognize the sensor. It also provides the definitions to be used for publishing the device data.

Member Function Documentation

◆ get_icon()

virtual const __FlashStringHelper * grmcdorman::device::Device::Definition::get_icon ( ) const
pure virtual

Get the icon.

This is the icon to be used by applications like Home Assistant. Examples include "mdi:wifi".

Returns
Icon string.

◆ get_json_attributes_template()

virtual const __FlashStringHelper * grmcdorman::device::Device::Definition::get_json_attributes_template ( ) const
pure virtual

Get the json attributes template.

Attributes are additional values other than the primary value; this describes where they are in the JSON. This should be a null (nullptr) if there are no attributes.

Examples include SSID for the WiFi RSSI value.

Returns
Template for attributes.

◆ get_name_suffix()

virtual const __FlashStringHelper * grmcdorman::device::Device::Definition::get_name_suffix ( ) const
pure virtual

Get the name suffix.

The unique ESP identifer is suffixed with this to generate a unique human-readable device name.

Returns
Device name.

◆ get_unique_id_suffix()

virtual const __FlashStringHelper * grmcdorman::device::Device::Definition::get_unique_id_suffix ( ) const
pure virtual

Get the unique id suffix.

The unique ESP identifier is suffixed with this to generate a unique system-wide sensor identifier. Unlike the name value, this is not human-readable and should follow identifier rules.

Returns
Unique id suffix.

◆ get_unit_of_measurement()

virtual const __FlashStringHelper * grmcdorman::device::Device::Definition::get_unit_of_measurement ( ) const
pure virtual

Get the unit of measurement.

The units for the value, e.g. dBm. Most systems support UTF-8, allowing characters like the degree symbol.

Returns
Units string.

◆ get_value_template()

virtual const __FlashStringHelper * grmcdorman::device::Device::Definition::get_value_template ( ) const
pure virtual

Get the value template.

The value template describes which JSON attribute corresponds to the sensor's measurement value.

Returns
Value template.

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