Skip to content

Commit

Permalink
Display can be switched on/off by homeassistant now too.
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueAndi committed Jan 3, 2025
1 parent d509d15 commit e8e95c6
Show file tree
Hide file tree
Showing 26 changed files with 322 additions and 239 deletions.
11 changes: 11 additions & 0 deletions data/extra/display.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"ha": {
"component": "light",
"discovery": {
"name": "Display",
"ic": "mdi:clock-digital",
"pl_on": "{\"state\":\"on\"}",
"pl_off": "{\"state\":\"off\"}"
}
}
}
16 changes: 9 additions & 7 deletions lib/CountdownPlugin/src/CountdownPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,26 +273,28 @@ class CountdownPlugin : public PluginWithConfig
* }
* </code>
*
* Homeassistant MQTT discovery support can be added with the "ha" key.
* Homeassistant MQTT discovery support can be added with the "ha" JSON object inside
* the "extra" JSON object.
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "ha": {
* ... everything here will be used for MQTT discovery ...
* "extra": {
* "ha": {
* ... everything here will be used for MQTT discovery ...
* }
* }
* }]
* }
* </code>
*
* Additional information can be loaded from a file too. It will be appended
* to the topic data (parallel to "name" and "access"). If a file is used,
* any other key than "name" and "access" will be ignored.
* Extra information can be loaded from a file too. This is useful for complex
* configurations and to keep program memory usage low.
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "fileName": "haText.json"
* "extra": "extra.json"
* }]
* }
* </code>
Expand Down
16 changes: 9 additions & 7 deletions lib/DateTimePlugin/src/DateTimePlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,26 +166,28 @@ class DateTimePlugin : public PluginWithConfig
* }
* </code>
*
* Homeassistant MQTT discovery support can be added with the "ha" key.
* Homeassistant MQTT discovery support can be added with the "ha" JSON object inside
* the "extra" JSON object.
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "ha": {
* ... everything here will be used for MQTT discovery ...
* "extra": {
* "ha": {
* ... everything here will be used for MQTT discovery ...
* }
* }
* }]
* }
* </code>
*
* Additional information can be loaded from a file too. It will be appended
* to the topic data (parallel to "name" and "access"). If a file is used,
* any other key than "name" and "access" will be ignored.
* Extra information can be loaded from a file too. This is useful for complex
* configurations and to keep program memory usage low.
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "fileName": "haText.json"
* "extra": "extra.json"
* }]
* }
* </code>
Expand Down
16 changes: 9 additions & 7 deletions lib/GrabViaMqttPlugin/src/GrabViaMqttPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,26 +162,28 @@ class GrabViaMqttPlugin : public PluginWithConfig
* }
* </code>
*
* Homeassistant MQTT discovery support can be added with the "ha" key.
* Homeassistant MQTT discovery support can be added with the "ha" JSON object inside
* the "extra" JSON object.
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "ha": {
* ... everything here will be used for MQTT discovery ...
* "extra": {
* "ha": {
* ... everything here will be used for MQTT discovery ...
* }
* }
* }]
* }
* </code>
*
* Additional information can be loaded from a file too. It will be appended
* to the topic data (parallel to "name" and "access"). If a file is used,
* any other key than "name" and "access" will be ignored.
* Extra information can be loaded from a file too. This is useful for complex
* configurations and to keep program memory usage low.
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "fileName": "haText.json"
* "extra": "extra.json"
* }]
* }
* </code>
Expand Down
16 changes: 9 additions & 7 deletions lib/GrabViaRestPlugin/src/GrabViaRestPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,26 +180,28 @@ class GrabViaRestPlugin : public PluginWithConfig
* }
* </code>
*
* Homeassistant MQTT discovery support can be added with the "ha" key.
* Homeassistant MQTT discovery support can be added with the "ha" JSON object inside
* the "extra" JSON object.
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "ha": {
* ... everything here will be used for MQTT discovery ...
* "extra": {
* "ha": {
* ... everything here will be used for MQTT discovery ...
* }
* }
* }]
* }
* </code>
*
* Additional information can be loaded from a file too. It will be appended
* to the topic data (parallel to "name" and "access"). If a file is used,
* any other key than "name" and "access" will be ignored.
* Extra information can be loaded from a file too. This is useful for complex
* configurations and to keep program memory usage low.
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "fileName": "haText.json"
* "extra": "extra.json"
* }]
* }
* </code>
Expand Down
16 changes: 9 additions & 7 deletions lib/GruenbeckPlugin/src/GruenbeckPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,26 +175,28 @@ class GruenbeckPlugin : public PluginWithConfig
* }
* </code>
*
* Homeassistant MQTT discovery support can be added with the "ha" key.
* Homeassistant MQTT discovery support can be added with the "ha" JSON object inside
* the "extra" JSON object.
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "ha": {
* ... everything here will be used for MQTT discovery ...
* "extra": {
* "ha": {
* ... everything here will be used for MQTT discovery ...
* }
* }
* }]
* }
* </code>
*
* Additional information can be loaded from a file too. It will be appended
* to the topic data (parallel to "name" and "access"). If a file is used,
* any other key than "name" and "access" will be ignored.
* Extra information can be loaded from a file too. This is useful for complex
* configurations and to keep program memory usage low.
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "fileName": "haText.json"
* "extra": "extra.json"
* }]
* }
* </code>
Expand Down
2 changes: 1 addition & 1 deletion lib/IconTextLampPlugin/src/IconTextLampPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void IconTextLampPlugin::getTopics(JsonArray& topics) const
* The used icon is from MaterialDesignIcons.com (namespace: mdi).
*/
jsonText["name"] = TOPIC_TEXT;
jsonText["fileName"] = TOPIC_TEXT_EXTRA_FILE_NAME;
jsonText["extra"] = TOPIC_TEXT_EXTRA_FILE_NAME;

jsonLamps["name"] = TOPIC_LAMPS;
jsonLamps["access"] = "r"; /* Only read access allowed. */
Expand Down
16 changes: 9 additions & 7 deletions lib/IconTextLampPlugin/src/IconTextLampPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,26 +139,28 @@ class IconTextLampPlugin : public PluginWithConfig
* }
* </code>
*
* Homeassistant MQTT discovery support can be added with the "ha" key.
* Homeassistant MQTT discovery support can be added with the "ha" JSON object inside
* the "extra" JSON object.
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "ha": {
* ... everything here will be used for MQTT discovery ...
* "extra": {
* "ha": {
* ... everything here will be used for MQTT discovery ...
* }
* }
* }]
* }
* </code>
*
* Additional information can be loaded from a file too. It will be appended
* to the topic data (parallel to "name" and "access"). If a file is used,
* any other key than "name" and "access" will be ignored.
* Extra information can be loaded from a file too. This is useful for complex
* configurations and to keep program memory usage low.
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "fileName": "haText.json"
* "extra": "extra.json"
* }]
* }
* </code>
Expand Down
6 changes: 3 additions & 3 deletions lib/IconTextPlugin/src/IconTextPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,16 @@ bool IconTextPlugin::isEnabled() const

void IconTextPlugin::getTopics(JsonArray& topics) const
{
JsonObject jsonText = topics.createNestedObject();
JsonObject jsonText = topics.createNestedObject();

/* The topic contains Home Assistant support of the MQTT discovery
* (https://www.home-assistant.io/integrations/mqtt). See the configured
* JSON file.
*
* The used icon is from MaterialDesignIcons.com (namespace: mdi).
*/
jsonText["name"] = TOPIC_TEXT;
jsonText["fileName"] = TOPIC_TEXT_EXTRA_FILE_NAME;
jsonText["name"] = TOPIC_TEXT;
jsonText["extra"] = TOPIC_TEXT_EXTRA_FILE_NAME;
}

bool IconTextPlugin::getTopic(const String& topic, JsonObject& value) const
Expand Down
16 changes: 9 additions & 7 deletions lib/IconTextPlugin/src/IconTextPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,26 +167,28 @@ class IconTextPlugin : public PluginWithConfig
* }
* </code>
*
* Homeassistant MQTT discovery support can be added with the "ha" key.
* Homeassistant MQTT discovery support can be added with the "ha" JSON object inside
* the "extra" JSON object.
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "ha": {
* ... everything here will be used for MQTT discovery ...
* "extra": {
* "ha": {
* ... everything here will be used for MQTT discovery ...
* }
* }
* }]
* }
* </code>
*
* Additional information can be loaded from a file too. It will be appended
* to the topic data (parallel to "name" and "access"). If a file is used,
* any other key than "name" and "access" will be ignored.
* Extra information can be loaded from a file too. This is useful for complex
* configurations and to keep program memory usage low.
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "fileName": "haText.json"
* "extra": "extra.json"
* }]
* }
* </code>
Expand Down
6 changes: 3 additions & 3 deletions lib/JustTextPlugin/src/JustTextPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,16 @@ bool JustTextPlugin::isEnabled() const

void JustTextPlugin::getTopics(JsonArray& topics) const
{
JsonObject jsonText = topics.createNestedObject();
JsonObject jsonText = topics.createNestedObject();

/* The topic contains Home Assistant support of the MQTT discovery
* (https://www.home-assistant.io/integrations/mqtt). See the configured
* JSON file.
*
* The used icon is from MaterialDesignIcons.com (namespace: mdi).
*/
jsonText["name"] = TOPIC_TEXT;
jsonText["fileName"] = TOPIC_TEXT_EXTRA_FILE_NAME;
jsonText["name"] = TOPIC_TEXT;
jsonText["extra"] = TOPIC_TEXT_EXTRA_FILE_NAME;
}

bool JustTextPlugin::getTopic(const String& topic, JsonObject& value) const
Expand Down
16 changes: 9 additions & 7 deletions lib/JustTextPlugin/src/JustTextPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,26 +164,28 @@ class JustTextPlugin : public PluginWithConfig
* }
* </code>
*
* Homeassistant MQTT discovery support can be added with the "ha" key.
* Homeassistant MQTT discovery support can be added with the "ha" JSON object inside
* the "extra" JSON object.
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "ha": {
* ... everything here will be used for MQTT discovery ...
* "extra": {
* "ha": {
* ... everything here will be used for MQTT discovery ...
* }
* }
* }]
* }
* </code>
*
* Additional information can be loaded from a file too. It will be appended
* to the topic data (parallel to "name" and "access"). If a file is used,
* any other key than "name" and "access" will be ignored.
* Extra information can be loaded from a file too. This is useful for complex
* configurations and to keep program memory usage low.
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "fileName": "haText.json"
* "extra": "extra.json"
* }]
* }
* </code>
Expand Down
Loading

0 comments on commit e8e95c6

Please sign in to comment.