MCPcopy Create free account
hub / github.com/BlueAndi/Pixelix / getTopics

Method getTopics

lib/IconTextLampPlugin/src/IconTextLampPlugin.cpp:76–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74 *****************************************************************************/
75
76void IconTextLampPlugin::getTopics(JsonArray& topics) const
77{
78 uint8_t lampId = 0U;
79 JsonObject jsonText = topics.createNestedObject();
80 JsonObject jsonLamps = topics.createNestedObject();
81
82 /* The topic contains Home Assistant support of the MQTT discovery
83 * (https://www.home-assistant.io/integrations/mqtt). See the configured
84 * JSON file.
85 *
86 * The used icon is from MaterialDesignIcons.com (namespace: mdi).
87 */
88 jsonText["name"] = TOPIC_TEXT;
89 jsonText["extra"]["ha"] = TOPIC_TEXT_EXTRA_HA_FILE_NAME;
90
91 jsonLamps["name"] = TOPIC_LAMPS;
92 jsonLamps["access"] = "r"; /* Only read access allowed. */
93
94 for (lampId = 0U; lampId < _IconTextLampPlugin::View::MAX_LAMPS; ++lampId)
95 {
96 (void)topics.add(String(TOPIC_LAMP) + "/" + lampId);
97 }
98}
99
100bool IconTextLampPlugin::getTopic(const String& topic, JsonObject& value) const
101{

Callers

nothing calls this directly

Calls 1

StringClass · 0.85

Tested by

no test coverage detected