You don't have to instantiate an
Homie instance, it is done internally.
void Homie.setup ()¶
Setup Homie. Must be called once in
void Homie.loop ()¶
Handle Homie work. Must be called in
void Homie.enableLogging (bool
Enable or disable Homie Serial logging.
If logging is enabled,
Serial.begin(115200) will be called internally.
enable: Whether or not to enable logging. By default, logging is enabled
void Homie.enableBuiltInLedIndicator (bool
Enable or disable the built-in LED to indicate the Homie state.
enable: Whether or not to enable built-in LED. By default, it is enabled
void Homie.setLedPin (unsigned char
pin, unsigned char
Set pin of the LED to control.
pin: LED to control
on: state when the light is on (HIGH or LOW)
void Homie.setBrand (const char*
Set the brand of the device, used in the configuration AP, the device hostname and the MQTT client ID.
name: Name of the brand. Default value is
void Homie.setFirmware (const char*
name, const char*
Set the name and version of the firmware. This is useful for OTA, as Homie will check against the server if there is a newer version.
name: Name of the firmware. Default value is
version: Version of the firmware. Default value is
void Homie.registerNode (HomieNode
Register a node.
node: node to register
void Homie.setGlobalInputHandler (std::function
Set input handler for subscribed properties.
handler: Global input handler
node: Name of the node getting updated
property: Property of the node getting updated
value: Value of the new property
void Homie.onEvent (std::function
Set the event handler. Useful if you want to hook to Homie events.
callback: Event handler
void Homie.setResetTrigger (unsigned char
pin, unsigned char
state, unsigned int
Set the reset trigger. By default, the device will reset when pin
pin: Pin of the reset trigger
state: Reset when the pin reaches this state for the given time
time: Time necessary to reset
void Homie.disableResetTrigger ()¶
Disable the reset trigger.
void Homie.setResetFunction (std::function
Set the reset function. This is a function that is going to be called at each loop iteration, which can trigger a device reset. If the function returns true, the device resets. Else, it does not.
callback: Reset function
void Homie.setSetupFunction (std::function
You can provide the function that will be called when operating in
callback: Setup function
void Homie.setLoopFunction (std::function
You can provide the function that will be looped in normal mode.
callback: Loop function
void Homie.setNodeProperty (HomieNode
retained = true)¶
Using this function, you can set the value of a node property, like a temperature for example.
node: HomieNode instance on which to set the property on
property: Property to send
retained: Optional. Should the MQTT broker retain this value, or is it a one-shot value?
void Homie.setResettable (bool
Is the device resettable? This is useful at runtime, because you might want the device not to be resettable when you have another library that is doing some unfinished work, like moving shutters for example.
resettable: Is the device resettable? Default value is
bool Homie.isReadyToOperate ()¶
Is the device in normal mode, configured and connected? You should not need this function. But maybe you will.
void HomieNode (const char*
id, const char*
handler = , bool
subscribeToAll = false)¶
handler= , bool
Constructor of a HomieNode object.
id: ID of the node
type: Type of the node
handler: Optional. Input handler of the node
subscribeToAll: Optional. Whether or not to call the handler for every properties, even the ones not registered
void .subscribe (const char*
handler) = )¶
handler) = )¶
Subscribes the node to the given property.
property: Property to subscribe to
handler: Optional. Input handler of the property of the node