| 74 | *****************************************************************************/ |
| 75 | |
| 76 | void 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 | |
| 100 | bool IconTextLampPlugin::getTopic(const String& topic, JsonObject& value) const |
| 101 | { |