Support of Homie convention v3.0.1
Long time awaited Version 3.0 which supports Homie convention v.3.0.1.
Many thanks to all contributors and people who reported issues and asked for features.
Upgrade Guide
To support new features and changes in the Homie convention 3.x some signatures have changed.
HomieNode
Constructor:
HomieNode(const char* id, const char* name, const char* type, bool range = false, uint16_t lower = 0, uint16_t upper = 0, const HomieInternals::NodeInputHandler& nodeInputHandler = [](const HomieRange& range, const String& property, const String& value) { return false; });
instead of
HomieNode(const char* id, const char* type, const HomieInternals::NodeInputHandler& nodeInputHandler = [](const String& property, const HomieRange& range, const String& value) { return false; });
So, you need to insert a new parameter on second place that gives a descriptive name of your node.
Also, ranges are now on Node level in the v3.x convention. So if you use ranges, then you need to enable them and give lower and upper range limit in the HomieNode constructor.
handleInput()
virtual bool handleInput(const HomieRange& range, const String& property, const String& value);
instead of
virtual bool handleInput(const String& property, const HomieRange& range, const String& value);
So, the HomieRange&
is now on first place. This changes was done intentionally to reflect the change how ranges are handled in convention 3.x . However, in many case you can just change the signature of your own handleInput()
method and you are fine.
PropertyInterface
The PropertyInterface
now offers methods to advertise more details about the property as specified in the convention 3.x:
PropertyInterface& setName(const char* name);
PropertyInterface& setUnit(const char* unit);
PropertyInterface& setDatatype(const char* datatype);
PropertyInterface& setFormat(const char* format);
PropertyInterface& setRetained(const bool retained = true);
homie-esp8266 does not enforce the correct usage of these methods. So it is your own responsibility to comply with the convention, especially the rules defined in https://homieiot.github.io/specification/spec-core-v3_0_1/#payload . (Note that the v4.x convention is compatible regarding these rules and gives some more recommendations in https://homieiot.github.io/specification/spec-core-v4_0_0/#property-attributes)
New features
Since the v2.0.1 release some new features have been added.
Note: Most of them were also available in the v2-development branch, but not released yet.
- Disable Config mode or MDNS support
- Disabling the configuration mode makes the binary much smaller. This is especially important, if you want wo use OTA-updates on devices with 1 MB flash only.
- See https://homieiot.github.io/homie-esp8266/docs/3.0.0/advanced-usage/compiler-flags/
- Run loop also if disconnected:
- Any
HomieNode
can set a flag, to run its ownloop()
also, if not connected to MQTT. - This can be useful if the node performs some tasks that is not only visible on MQTT. For example controlling effects on an LED strip.
- Use
setRunLoopDisconnected(bool)
to set it. (defaults tofalse
)
- Any
- [...some more...]