Skip to content

Commit

Permalink
Allow topic registration with empty entity-id. HA discovery topic and…
Browse files Browse the repository at this point in the history
… id's generation is like the following patterns:

DISCOVERY-TOPIC = DISCOVERY-PREFIX/COMPONENT/NODE-ID/OBJECT-ID/config
NODE-ID = DEVICE-ID with "/" and "." replaced by "_"
OBJECT-ID = [ENTITY-ID/]TOPIC with "/" and "." replaced by "_"
UNIQUE-ID = DEVICE-ID/[ENTITY-ID/]TOPIC
  • Loading branch information
BlueAndi committed Jan 6, 2025
1 parent 2628967 commit e643180
Show file tree
Hide file tree
Showing 45 changed files with 351 additions and 272 deletions.
2 changes: 1 addition & 1 deletion data/js/rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ pixelix.rest.Client.prototype.setSetting = function(key, value) {
pixelix.rest.Client.prototype.restart = function() {
return utils.makeRequest({
method: "POST",
url: "/rest/api/v1/device/restart",
url: "/rest/api/v1/restart",
isJsonResponse: true
});
};
Expand Down
2 changes: 1 addition & 1 deletion lib/CountdownPlugin/src/CountdownPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
*****************************************************************************/

/* Initialize plugin topic. */
const char* CountdownPlugin::TOPIC_CONFIG = "/countdown";
const char* CountdownPlugin::TOPIC_CONFIG = "countdown";

/******************************************************************************
* Public Methods
Expand Down
8 changes: 4 additions & 4 deletions lib/CountdownPlugin/src/CountdownPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ class CountdownPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [
* "/text"
* "text"
* ]
* }
* </code>
Expand All @@ -267,7 +267,7 @@ class CountdownPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "name": "text",
* "access": "r"
* }]
* }
Expand All @@ -278,7 +278,7 @@ class CountdownPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "name": "text",
* "extra": {
* "ha": {
* ... everything here will be used for MQTT discovery ...
Expand All @@ -293,7 +293,7 @@ class CountdownPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "name": "text",
* "extra": "extra.json"
* }]
* }
Expand Down
2 changes: 1 addition & 1 deletion lib/DateTimePlugin/src/DateTimePlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
*****************************************************************************/

/* Initialize plugin topic. */
const char DateTimePlugin::TOPIC_CONFIG[] = "/dateTime";
const char DateTimePlugin::TOPIC_CONFIG[] = "dateTime";

/* Initialize default time format. */
const char DateTimePlugin::TIME_FORMAT_DEFAULT[] = "%I:%M %p";
Expand Down
8 changes: 4 additions & 4 deletions lib/DateTimePlugin/src/DateTimePlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class DateTimePlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [
* "/text"
* "text"
* ]
* }
* </code>
Expand All @@ -160,7 +160,7 @@ class DateTimePlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "name": "text",
* "access": "r"
* }]
* }
Expand All @@ -171,7 +171,7 @@ class DateTimePlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "name": "text",
* "extra": {
* "ha": {
* ... everything here will be used for MQTT discovery ...
Expand All @@ -186,7 +186,7 @@ class DateTimePlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "name": "text",
* "extra": "extra.json"
* }]
* }
Expand Down
4 changes: 2 additions & 2 deletions lib/FileMgrService/src/FileMgrService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
const char* FileMgrService::WORKING_DIRECTORY = "/configuration";
const char* FileMgrService::CONFIG_FILE_NAME = "fileMgr.json";
const char* FileMgrService::ENTITY_ID = "files";
const char* FileMgrService::TOPIC_UPLOAD = "/upload";
const char* FileMgrService::TOPIC_REMOVE = "/remove";
const char* FileMgrService::TOPIC_UPLOAD = "upload";
const char* FileMgrService::TOPIC_REMOVE = "remove";
const char* FileMgrService::FILE_EXTENSIONS[] =
{
".bmp",
Expand Down
2 changes: 1 addition & 1 deletion lib/GrabViaMqttPlugin/src/GrabViaMqttPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
*****************************************************************************/

/* Initialize plugin topic. */
const char* GrabViaMqttPlugin::TOPIC_CONFIG = "/grabConfig";
const char* GrabViaMqttPlugin::TOPIC_CONFIG = "grabConfig";

/******************************************************************************
* Public Methods
Expand Down
8 changes: 4 additions & 4 deletions lib/GrabViaMqttPlugin/src/GrabViaMqttPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class GrabViaMqttPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [
* "/text"
* "text"
* ]
* }
* </code>
Expand All @@ -156,7 +156,7 @@ class GrabViaMqttPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "name": "text",
* "access": "r"
* }]
* }
Expand All @@ -167,7 +167,7 @@ class GrabViaMqttPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "name": "text",
* "extra": {
* "ha": {
* ... everything here will be used for MQTT discovery ...
Expand All @@ -182,7 +182,7 @@ class GrabViaMqttPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "name": "text",
* "extra": "extra.json"
* }]
* }
Expand Down
2 changes: 1 addition & 1 deletion lib/GrabViaRestPlugin/src/GrabViaRestPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
*****************************************************************************/

/* Initialize plugin topic. */
const char* GrabViaRestPlugin::TOPIC_CONFIG = "/grabConfig";
const char* GrabViaRestPlugin::TOPIC_CONFIG = "grabConfig";

/******************************************************************************
* Public Methods
Expand Down
8 changes: 4 additions & 4 deletions lib/GrabViaRestPlugin/src/GrabViaRestPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class GrabViaRestPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [
* "/text"
* "text"
* ]
* }
* </code>
Expand All @@ -174,7 +174,7 @@ class GrabViaRestPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "name": "text",
* "access": "r"
* }]
* }
Expand All @@ -185,7 +185,7 @@ class GrabViaRestPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "name": "text",
* "extra": {
* "ha": {
* ... everything here will be used for MQTT discovery ...
Expand All @@ -200,7 +200,7 @@ class GrabViaRestPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "name": "text",
* "extra": "extra.json"
* }]
* }
Expand Down
2 changes: 1 addition & 1 deletion lib/GruenbeckPlugin/src/GruenbeckPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
*****************************************************************************/

/* Initialize plugin topic. */
const char* GruenbeckPlugin::TOPIC_CONFIG = "/ipAddress";
const char* GruenbeckPlugin::TOPIC_CONFIG = "ipAddress";

/******************************************************************************
* Public Methods
Expand Down
8 changes: 4 additions & 4 deletions lib/GruenbeckPlugin/src/GruenbeckPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class GruenbeckPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [
* "/text"
* "text"
* ]
* }
* </code>
Expand All @@ -169,7 +169,7 @@ class GruenbeckPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "name": "text",
* "access": "r"
* }]
* }
Expand All @@ -180,7 +180,7 @@ class GruenbeckPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "name": "text",
* "extra": {
* "ha": {
* ... everything here will be used for MQTT discovery ...
Expand All @@ -195,7 +195,7 @@ class GruenbeckPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "name": "text",
* "extra": "extra.json"
* }]
* }
Expand Down
6 changes: 3 additions & 3 deletions lib/IconTextLampPlugin/src/IconTextLampPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@
*****************************************************************************/

/* Initialize plugin topic. */
const char* IconTextLampPlugin::TOPIC_TEXT = "/iconText";
const char* IconTextLampPlugin::TOPIC_TEXT = "iconText";
const char* IconTextLampPlugin::TOPIC_TEXT_EXTRA_FILE_NAME = "/extra/iconTextLampPlugin.json";

/* Initialize plugin topic. */
const char* IconTextLampPlugin::TOPIC_LAMPS = "/lamps";
const char* IconTextLampPlugin::TOPIC_LAMPS = "lamps";

/* Initialize plugin topic. */
const char* IconTextLampPlugin::TOPIC_LAMP = "/lamp";
const char* IconTextLampPlugin::TOPIC_LAMP = "lamp";

/******************************************************************************
* Public Methods
Expand Down
8 changes: 4 additions & 4 deletions lib/IconTextLampPlugin/src/IconTextLampPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class IconTextLampPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [
* "/text"
* "text"
* ]
* }
* </code>
Expand All @@ -133,7 +133,7 @@ class IconTextLampPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "name": "text",
* "access": "r"
* }]
* }
Expand All @@ -144,7 +144,7 @@ class IconTextLampPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "name": "text",
* "extra": {
* "ha": {
* ... everything here will be used for MQTT discovery ...
Expand All @@ -159,7 +159,7 @@ class IconTextLampPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "name": "text",
* "extra": "extra.json"
* }]
* }
Expand Down
2 changes: 1 addition & 1 deletion lib/IconTextPlugin/src/IconTextPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
*****************************************************************************/

/* Initialize plugin topic. */
const char* IconTextPlugin::TOPIC_TEXT = "/iconText";
const char* IconTextPlugin::TOPIC_TEXT = "iconText";
const char* IconTextPlugin::TOPIC_TEXT_EXTRA_FILE_NAME = "/extra/iconTextPlugin.json";

/******************************************************************************
Expand Down
8 changes: 4 additions & 4 deletions lib/IconTextPlugin/src/IconTextPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class IconTextPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [
* "/text"
* "text"
* ]
* }
* </code>
Expand All @@ -161,7 +161,7 @@ class IconTextPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "name": "text",
* "access": "r"
* }]
* }
Expand All @@ -172,7 +172,7 @@ class IconTextPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "name": "text",
* "extra": {
* "ha": {
* ... everything here will be used for MQTT discovery ...
Expand All @@ -187,7 +187,7 @@ class IconTextPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "name": "text",
* "extra": "extra.json"
* }]
* }
Expand Down
2 changes: 1 addition & 1 deletion lib/JustTextPlugin/src/JustTextPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
*****************************************************************************/

/* Initialize plugin topic. */
const char* JustTextPlugin::TOPIC_TEXT = "/text";
const char* JustTextPlugin::TOPIC_TEXT = "text";
const char* JustTextPlugin::TOPIC_TEXT_EXTRA_FILE_NAME = "/extra/justTextPlugin.json";

/******************************************************************************
Expand Down
8 changes: 4 additions & 4 deletions lib/JustTextPlugin/src/JustTextPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class JustTextPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [
* "/text"
* "text"
* ]
* }
* </code>
Expand All @@ -158,7 +158,7 @@ class JustTextPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "name": "text",
* "access": "r"
* }]
* }
Expand All @@ -169,7 +169,7 @@ class JustTextPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "name": "text",
* "extra": {
* "ha": {
* ... everything here will be used for MQTT discovery ...
Expand All @@ -184,7 +184,7 @@ class JustTextPlugin : public PluginWithConfig
* <code>{.json}
* {
* "topics": [{
* "name": "/text",
* "name": "text",
* "extra": "extra.json"
* }]
* }
Expand Down
Loading

0 comments on commit e643180

Please sign in to comment.