Skip to content

Commit

Permalink
v3.28
Browse files Browse the repository at this point in the history
  • Loading branch information
pvtom committed Jul 27, 2024
1 parent c06e8e9 commit dc9896c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ or to show the help page
If everything works properly, you will see something like this:

```
rscp2mqtt [3.27]
rscp2mqtt [3.28]
E3DC system >192.168.178.111:5033< user: >your E3DC user<
MQTT broker >localhost:1883< qos = >0< retain = >✗< tls >✗< client id >✗< prefix >e3dc<
Requesting PVI ✓ | PM (0) | DCB ✓ (1 battery string) | Wallbox ✗ | Interval 2 | Autorefresh ✓ | Raw data ✗ | Logging OFF
Expand Down
5 changes: 5 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Release Notes

### Release v3.28 (27.07.2024)

Bug fixes:
- Issue #83: Raw data mode: Problem assembling the topic names

### Release v3.27 (24.07.2024)

Bug fixes:
Expand Down
12 changes: 5 additions & 7 deletions RscpMqttMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <regex>
#include <mutex>

#define RSCP2MQTT_VERSION "3.27"
#define RSCP2MQTT_VERSION "3.28"

#define AES_KEY_SIZE 32
#define AES_BLOCK_SIZE 32
Expand Down Expand Up @@ -881,8 +881,8 @@ bool updateRawData(char *topic, char *payload) {
return(false);
}

void mergeRawData(char *topic, char *payload) {
if (topic && payload && !updateRawData(topic, payload)) {
void insertRawData(char *topic, char *payload) {
if (topic && payload) {
RSCP_MQTT::mqtt_data_t v;
v.topic = strdup(topic);
v.payload = strdup(payload);
Expand Down Expand Up @@ -2108,7 +2108,7 @@ void publishRaw(RscpProtocol *protocol, SRscpValue *response, char *topic) {
updateRawData(topic, payload_new);
} else if (!payload_old && payload_new && strcmp(payload_new, "")) {
publishImmediately(topic, payload_new, false);
mergeRawData(topic, payload_new);
insertRawData(topic, payload_new);
}
if (payload_new) free(payload_new);
return;
Expand Down Expand Up @@ -2136,7 +2136,7 @@ void handleRaw(RscpProtocol *protocol, SRscpValue *response, uint32_t *cache, in
} else {
cache[l + 1] = data[i].tag;
strcpy(topic, "raw");
for (int i = 0; i < RECURSION_MAX_LEVEL; i++) {
for (int i = 0; i <= l + 1; i++) {
if (cache[i]) {
if (strlen(topic) + strlen(tagName(RSCP_TAGS::RscpTagsOverview, cache[i])) + 2 < TOPIC_SIZE) {
strcat(topic, "/");
Expand Down Expand Up @@ -2193,7 +2193,6 @@ int handleResponseValue(RscpProtocol *protocol, SRscpValue *response) {
}

if (cfg.raw_mode) {
for (int i = 0; i < RECURSION_MAX_LEVEL; i++) cache[i] = 0;
if (mosq) handleRaw(protocol, response, cache, -1);
}

Expand Down Expand Up @@ -2547,7 +2546,6 @@ int handleResponseValue(RscpProtocol *protocol, SRscpValue *response) {
}
default:
if (response->dataType == RSCP::eTypeContainer) {
for (int i = 0; i < RECURSION_MAX_LEVEL; i++) cache[i] = 0;
handleContainer(protocol, response, cache, -1);
} else storeResponseValue(RSCP_MQTT::RscpMqttCache, protocol, response, 0, 0);
break;
Expand Down
Binary file added rscp2mqtt_mit_portainer.pdf
Binary file not shown.

0 comments on commit dc9896c

Please sign in to comment.