Skip to content

Commit 78ffb36

Browse files
committed
v3.23
1 parent 5cf3b0b commit 78ffb36

File tree

8 files changed

+284
-72
lines changed

8 files changed

+284
-72
lines changed

README.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,14 @@ Find InfluxDB configurations in [InfluxDB](INFLUXDB.md).
126126

127127
The parameter FORCE_PUB can occur several times. You can use it to define topics that will be published in each cycle, even if the values do not change. To check the definition, look at the log output after the program start.
128128

129+
Logging can be configured for messages that the home power station output in response to a request.
130+
Messages are collected including a counter for the number of occurrences.
131+
The errors will be logged in a bundle at midnight, at the end of the program or by querying with e3dc/set/log/errors.
132+
This reduces the number of error messages.
133+
To do this, set in the .config file: `LOG_MODE=BUFFERED`.
134+
You can also switch off the logging of such messages completely with `LOG_MODE=OFF`.
135+
If every event is to be logged: `LOG_MODE=ON`.
136+
129137
## Program start
130138

131139
Start the program:
@@ -144,19 +152,19 @@ or to show the help page
144152
If everything works properly, you will see something like this:
145153

146154
```
147-
rscp2mqtt [v3.22]
155+
rscp2mqtt [3.23]
148156
E3DC system >192.168.178.111:5033< user: >your E3DC user<
149157
MQTT broker >localhost:1883< qos = >0< retain = >false< client id >✗< prefix >e3dc<
150158
Fetching data every second.
151159
Requesting PVI ✓ | PM (0) | DCB ✓ (1 battery string) | Wallbox (0) ✗ | Autorefresh ✓
152160
Log level = 0
153161
Stdout to terminal
154162
155-
[2024-04-29 19:00:00] pid=30220 ppid=1 RscpMqttMain.cpp(2804) Connecting to server 192.168.178.111:5033
156-
[2024-04-29 19:00:00] pid=30220 ppid=1 RscpMqttMain.cpp(2811) Success: E3DC connected.
157-
[2024-04-29 19:00:00] pid=30220 ppid=1 RscpMqttMain.cpp(1790) RSCP authentication level 10
158-
[2024-04-29 19:00:00] pid=30220 ppid=1 RscpMqttMain.cpp(2324) Connecting to broker localhost:1883
159-
[2024-04-29 19:00:00] pid=30220 ppid=1 RscpMqttMain.cpp(2336) Success: MQTT broker connected.
163+
[2024-05-12 19:00:00] pid=30230 ppid=1 RscpMqttMain.cpp(2952) Connecting to server 192.168.178.111:5033
164+
[2024-05-12 19:00:00] pid=30230 ppid=1 RscpMqttMain.cpp(2959) Success: E3DC connected.
165+
[2024-05-12 19:00:00] pid=30230 ppid=1 RscpMqttMain.cpp(1896) RSCP authentication level 10
166+
[2024-05-12 19:00:00] pid=30230 ppid=1 RscpMqttMain.cpp(2428) Connecting to broker localhost:1883
167+
[2024-05-12 19:00:00] pid=30230 ppid=1 RscpMqttMain.cpp(2440) Success: MQTT broker connected.
160168
```
161169

162170
Check the configuration if the connections are not established.
@@ -374,7 +382,11 @@ mosquitto_pub -h localhost -p 1883 -t "e3dc/set/force" -m "e3dc/history/2021.*"
374382
```
375383
Log all topics and payloads to the log file
376384
```
377-
mosquitto_pub -h localhost -p 1883 -t "e3dc/set/log" -m 1
385+
mosquitto_pub -h localhost -p 1883 -t "e3dc/set/log/cache" -m 1
386+
```
387+
Log collected error messages to the log file
388+
```
389+
mosquitto_pub -h localhost -p 1883 -t "e3dc/set/log/errors" -m 1
378390
```
379391
Set a new refresh interval (1..300 seconds)
380392
```

RELEASE.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
## Release Notes
22

3+
### Release v3.23 (12.05.2024)
4+
5+
Bug fixes:
6+
- Issue #62: Wallbox daily energy values are negative in some cases
7+
- Issue #67: Program crash after several hours
8+
9+
Features:
10+
- Issue #64: Provide program version as topic e3dc/rscp2mqtt/version
11+
- Issue #68: 1/0 instead of true/false
12+
- Buffered logging (LOG_MODE)
13+
314
### Release v3.22 (29.04.2024)
415

516
- Issue #63: e3dc/set/wallbox/charge is renamed to e3dc/set/wallbox/suspended

RscpMqttConfig.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ typedef struct _config_t {
6464
#endif
6565
bool auto_refresh;
6666
bool store_setup;
67+
char true_value[5];
68+
char false_value[6];
6769
} config_t;
6870

6971
#endif

RscpMqttMain.cpp

Lines changed: 220 additions & 61 deletions
Large diffs are not rendered by default.

RscpMqttMapping.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define UNIT_SIZE 8
1111
#define SOURCE_SIZE 15
1212
#define REGEX_SIZE 160
13+
#define MESSAGE_SIZE 255
1314

1415
#define PAYLOAD_REGEX_0_100 "(^[0-9]{1,2}|100$)"
1516
#define PAYLOAD_REGEX_2_DIGIT "(^[0-9]{1,2}$)"
@@ -109,6 +110,17 @@ typedef struct _not_supported_tags_t {
109110

110111
std::vector<not_supported_tags_t> NotSupportedTags;
111112

113+
typedef struct _message_cache_t {
114+
int type;
115+
uint32_t container;
116+
uint32_t tag;
117+
char message[MESSAGE_SIZE];
118+
int error;
119+
uint32_t count;
120+
} message_cache_t;
121+
122+
std::vector<message_cache_t> MessageCache;
123+
112124
typedef struct _date_t {
113125
int day;
114126
int month;
@@ -503,6 +515,8 @@ rec_cache_t rec_cache[] = {
503515
{ 0, 0, "set/limit/discharge/durable", "^true|on|1$", "1", "^false|off|0$", "0", "", UNIT_NONE, RSCP::eTypeUChar8, -1, false, true },
504516
{ 0, 0, "set/limit/discharge/by_home_power", PAYLOAD_REGEX_5_DIGIT, "", "", "", "", UNIT_W, RSCP::eTypeUInt32, -1, false, true },
505517
{ 0, 0, "set/log", "^true|on|1$", "true", "", "", "", UNIT_NONE, RSCP::eTypeBool, -1, false, true },
518+
{ 0, 0, "set/log/cache", "^true|on|1$", "true", "", "", "", UNIT_NONE, RSCP::eTypeBool, -1, false, true },
519+
{ 0, 0, "set/log/errors", "^true|on|1$", "true", "", "", "", UNIT_NONE, RSCP::eTypeBool, -1, false, true },
506520
{ 0, 0, "set/health", "^true|on|1$", "true", "", "", "", UNIT_NONE, RSCP::eTypeBool, -1, false, true },
507521
{ 0, 0, "set/force", "[a-zA-z0-9/_.*]*", "", "", "", "", UNIT_NONE, RSCP::eTypeBool, -1, false, true },
508522
{ 0, 0, "set/interval", "^[1-9]|[1-9][0-9]|[1-2][0-9][0-9]|300$", "", "", "", "", UNIT_NONE, RSCP::eTypeUChar8, -1, false, true },

RscpTagsOverview.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ typedef struct _tag_overview_t {
1212
} tag_overview_t;
1313

1414
tag_overview_t tag_overview[] = {
15-
{ 0, "TAG_ROOT_CONTAINER", 1 },
15+
{ 0, "0", 1 },
1616
{ TAG_RSCP_REQ_AUTHENTICATION, "TAG_RSCP_REQ_AUTHENTICATION", 1 },
1717
{ TAG_RSCP_AUTHENTICATION_USER, "TAG_RSCP_AUTHENTICATION_USER", 0 },
1818
{ TAG_RSCP_AUTHENTICATION_PASSWORD, "TAG_RSCP_AUTHENTICATION_PASSWORD", 0 },
@@ -3585,6 +3585,7 @@ typedef struct _rscp_err_codes_t {
35853585
} rscp_err_codes_t;
35863586

35873587
rscp_err_codes_t rscp_err_codes[] = {
3588+
{ 0x00, "UNKNOWN" },
35883589
{ RSCP_ERR_NOT_HANDLED, "NOT_HANDLED" },
35893590
{ RSCP_ERR_ACCESS_DENIED, "ACCESS_DENIED" },
35903591
{ RSCP_ERR_FORMAT, "FORMAT_ERROR" },

TOPICS.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ All topics are listed with the default prefix "e3dc".
217217
| Software Release | e3dc/system/software | "S10_XXXX_XXX" |
218218
| Solar Energy | e3dc/solar/energy | [kWh] |
219219
| Time Zone | e3dc/time/zone | "Europe/City" |
220+
| Program Status | e3dc/rscp2mqtt/status | "connected" |
221+
| Program Version | e3dc/rscp2mqtt/long_version | "3.23.influxdb" |
222+
| Program Version | e3dc/rscp2mqtt/version | "3.23" |
220223
| Wallbox Battery | e3dc/wallbox/charge_battery_before_car | (true/false) |
221224
| Wallbox Battery | e3dc/wallbox/discharge_battery_to_car | (true/false) |
222225
| Wallbox Battery | e3dc/wallbox/discharge_battery_until | [%] |
@@ -293,6 +296,8 @@ Energy topics are collected for today, yesterday and the current week, month, ye
293296

294297
****) The value is required to be able to calculate the daily value. To ensure that the value survives a restart, set RETAIN_FOR_SETUP=true in .config.
295298

299+
The boolean values "true" and "false" are saved in the InfluxDB as "1" and "0". By setting the configuration parameter `USE_TRUE_FALSE=false`, this behavior can also be set for the MQTT payload.
300+
296301
### Writeable Topics
297302

298303
Please find detailled information and examples in the [README](README.md).
@@ -339,7 +344,8 @@ Please find detailled information and examples in the [README](README.md).
339344
| Settings and others | | |
340345
| Refresh all topics | e3dc/set/force | 1 |
341346
| Refresh specific topics | e3dc/set/force | "e3dc/history/2021.*" |
342-
| Log all topics and payloads to the log file | e3dc/set/log | 1 |
347+
| Log all topics and payloads to the log file | e3dc/set/log/cache | 1 |
348+
| Log collected error messages to the log file | e3dc/set/log/errors | 1 |
343349
| Log internal stuff to the log file | e3dc/set/health | 1 |
344350
| Set refresh interval [sec] | e3dc/set/interval | (1-300) |
345351
| Enable PM requests | e3dc/set/requests/pm | (true/false) |

config.template

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ MQTT_PASSWORD=
2323
#-System
2424
#--cycle interval in seconds (max 300 seconds)
2525
INTERVAL=1
26-
#--log level, set "1" to get detailled logging
27-
LOG_LEVEL=0
26+
#--log mode defines the handling of errors/messages that are returned in response to a tag request
27+
#--OFF: no logs, ON: error is logged immediately when it occurs, BUFFERED: errors are buffered and printed at midnight, at the end of the program or by a /set/log/errors request
28+
#LOG_MODE=OFF
29+
#LOG_MODE=ON
30+
LOG_MODE=BUFFERED
2831
#--log files
2932
LOGFILE=/tmp/rscp2mqtt.log
3033
TOPIC_LOG_FILE=/tmp/rscp2mqtt.history
@@ -45,6 +48,10 @@ RETAIN_FOR_SETUP=true
4548
#--Topic prefix (max 24 characters), default is e3dc
4649
PREFIX=e3dc
4750

51+
#-MQTT Payload
52+
#--Boolean values true/false or 1/0
53+
USE_TRUE_FALSE=true
54+
4855
#-Power Meter
4956
#--PM_INDEX can be set multiple times if several power meters exist, default is 0
5057
#--PM_EXTERN=true has the same effect as PM_INDEX=6 (6 for S10 Mini, compatibilty with previous releases)

0 commit comments

Comments
 (0)