Skip to content

Commit

Permalink
v3.23
Browse files Browse the repository at this point in the history
  • Loading branch information
pvtom committed May 12, 2024
1 parent 5cf3b0b commit 78ffb36
Show file tree
Hide file tree
Showing 8 changed files with 284 additions and 72 deletions.
26 changes: 19 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ Find InfluxDB configurations in [InfluxDB](INFLUXDB.md).

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.

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

## Program start

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

```
rscp2mqtt [v3.22]
rscp2mqtt [3.23]
E3DC system >192.168.178.111:5033< user: >your E3DC user<
MQTT broker >localhost:1883< qos = >0< retain = >false< client id >✗< prefix >e3dc<
Fetching data every second.
Requesting PVI ✓ | PM (0) | DCB ✓ (1 battery string) | Wallbox (0) ✗ | Autorefresh ✓
Log level = 0
Stdout to terminal
[2024-04-29 19:00:00] pid=30220 ppid=1 RscpMqttMain.cpp(2804) Connecting to server 192.168.178.111:5033
[2024-04-29 19:00:00] pid=30220 ppid=1 RscpMqttMain.cpp(2811) Success: E3DC connected.
[2024-04-29 19:00:00] pid=30220 ppid=1 RscpMqttMain.cpp(1790) RSCP authentication level 10
[2024-04-29 19:00:00] pid=30220 ppid=1 RscpMqttMain.cpp(2324) Connecting to broker localhost:1883
[2024-04-29 19:00:00] pid=30220 ppid=1 RscpMqttMain.cpp(2336) Success: MQTT broker connected.
[2024-05-12 19:00:00] pid=30230 ppid=1 RscpMqttMain.cpp(2952) Connecting to server 192.168.178.111:5033
[2024-05-12 19:00:00] pid=30230 ppid=1 RscpMqttMain.cpp(2959) Success: E3DC connected.
[2024-05-12 19:00:00] pid=30230 ppid=1 RscpMqttMain.cpp(1896) RSCP authentication level 10
[2024-05-12 19:00:00] pid=30230 ppid=1 RscpMqttMain.cpp(2428) Connecting to broker localhost:1883
[2024-05-12 19:00:00] pid=30230 ppid=1 RscpMqttMain.cpp(2440) Success: MQTT broker connected.
```

Check the configuration if the connections are not established.
Expand Down Expand Up @@ -374,7 +382,11 @@ mosquitto_pub -h localhost -p 1883 -t "e3dc/set/force" -m "e3dc/history/2021.*"
```
Log all topics and payloads to the log file
```
mosquitto_pub -h localhost -p 1883 -t "e3dc/set/log" -m 1
mosquitto_pub -h localhost -p 1883 -t "e3dc/set/log/cache" -m 1
```
Log collected error messages to the log file
```
mosquitto_pub -h localhost -p 1883 -t "e3dc/set/log/errors" -m 1
```
Set a new refresh interval (1..300 seconds)
```
Expand Down
11 changes: 11 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
## Release Notes

### Release v3.23 (12.05.2024)

Bug fixes:
- Issue #62: Wallbox daily energy values are negative in some cases
- Issue #67: Program crash after several hours

Features:
- Issue #64: Provide program version as topic e3dc/rscp2mqtt/version
- Issue #68: 1/0 instead of true/false
- Buffered logging (LOG_MODE)

### Release v3.22 (29.04.2024)

- Issue #63: e3dc/set/wallbox/charge is renamed to e3dc/set/wallbox/suspended
Expand Down
2 changes: 2 additions & 0 deletions RscpMqttConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ typedef struct _config_t {
#endif
bool auto_refresh;
bool store_setup;
char true_value[5];
char false_value[6];
} config_t;

#endif
281 changes: 220 additions & 61 deletions RscpMqttMain.cpp

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions RscpMqttMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#define UNIT_SIZE 8
#define SOURCE_SIZE 15
#define REGEX_SIZE 160
#define MESSAGE_SIZE 255

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

std::vector<not_supported_tags_t> NotSupportedTags;

typedef struct _message_cache_t {
int type;
uint32_t container;
uint32_t tag;
char message[MESSAGE_SIZE];
int error;
uint32_t count;
} message_cache_t;

std::vector<message_cache_t> MessageCache;

typedef struct _date_t {
int day;
int month;
Expand Down Expand Up @@ -503,6 +515,8 @@ rec_cache_t rec_cache[] = {
{ 0, 0, "set/limit/discharge/durable", "^true|on|1$", "1", "^false|off|0$", "0", "", UNIT_NONE, RSCP::eTypeUChar8, -1, false, true },
{ 0, 0, "set/limit/discharge/by_home_power", PAYLOAD_REGEX_5_DIGIT, "", "", "", "", UNIT_W, RSCP::eTypeUInt32, -1, false, true },
{ 0, 0, "set/log", "^true|on|1$", "true", "", "", "", UNIT_NONE, RSCP::eTypeBool, -1, false, true },
{ 0, 0, "set/log/cache", "^true|on|1$", "true", "", "", "", UNIT_NONE, RSCP::eTypeBool, -1, false, true },
{ 0, 0, "set/log/errors", "^true|on|1$", "true", "", "", "", UNIT_NONE, RSCP::eTypeBool, -1, false, true },
{ 0, 0, "set/health", "^true|on|1$", "true", "", "", "", UNIT_NONE, RSCP::eTypeBool, -1, false, true },
{ 0, 0, "set/force", "[a-zA-z0-9/_.*]*", "", "", "", "", UNIT_NONE, RSCP::eTypeBool, -1, false, true },
{ 0, 0, "set/interval", "^[1-9]|[1-9][0-9]|[1-2][0-9][0-9]|300$", "", "", "", "", UNIT_NONE, RSCP::eTypeUChar8, -1, false, true },
Expand Down
3 changes: 2 additions & 1 deletion RscpTagsOverview.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ typedef struct _tag_overview_t {
} tag_overview_t;

tag_overview_t tag_overview[] = {
{ 0, "TAG_ROOT_CONTAINER", 1 },
{ 0, "0", 1 },
{ TAG_RSCP_REQ_AUTHENTICATION, "TAG_RSCP_REQ_AUTHENTICATION", 1 },
{ TAG_RSCP_AUTHENTICATION_USER, "TAG_RSCP_AUTHENTICATION_USER", 0 },
{ TAG_RSCP_AUTHENTICATION_PASSWORD, "TAG_RSCP_AUTHENTICATION_PASSWORD", 0 },
Expand Down Expand Up @@ -3585,6 +3585,7 @@ typedef struct _rscp_err_codes_t {
} rscp_err_codes_t;

rscp_err_codes_t rscp_err_codes[] = {
{ 0x00, "UNKNOWN" },
{ RSCP_ERR_NOT_HANDLED, "NOT_HANDLED" },
{ RSCP_ERR_ACCESS_DENIED, "ACCESS_DENIED" },
{ RSCP_ERR_FORMAT, "FORMAT_ERROR" },
Expand Down
8 changes: 7 additions & 1 deletion TOPICS.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ All topics are listed with the default prefix "e3dc".
| Software Release | e3dc/system/software | "S10_XXXX_XXX" |
| Solar Energy | e3dc/solar/energy | [kWh] |
| Time Zone | e3dc/time/zone | "Europe/City" |
| Program Status | e3dc/rscp2mqtt/status | "connected" |
| Program Version | e3dc/rscp2mqtt/long_version | "3.23.influxdb" |
| Program Version | e3dc/rscp2mqtt/version | "3.23" |
| Wallbox Battery | e3dc/wallbox/charge_battery_before_car | (true/false) |
| Wallbox Battery | e3dc/wallbox/discharge_battery_to_car | (true/false) |
| Wallbox Battery | e3dc/wallbox/discharge_battery_until | [%] |
Expand Down Expand Up @@ -293,6 +296,8 @@ Energy topics are collected for today, yesterday and the current week, month, ye

****) 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.

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.

### Writeable Topics

Please find detailled information and examples in the [README](README.md).
Expand Down Expand Up @@ -339,7 +344,8 @@ Please find detailled information and examples in the [README](README.md).
| Settings and others | | |
| Refresh all topics | e3dc/set/force | 1 |
| Refresh specific topics | e3dc/set/force | "e3dc/history/2021.*" |
| Log all topics and payloads to the log file | e3dc/set/log | 1 |
| Log all topics and payloads to the log file | e3dc/set/log/cache | 1 |
| Log collected error messages to the log file | e3dc/set/log/errors | 1 |
| Log internal stuff to the log file | e3dc/set/health | 1 |
| Set refresh interval [sec] | e3dc/set/interval | (1-300) |
| Enable PM requests | e3dc/set/requests/pm | (true/false) |
Expand Down
11 changes: 9 additions & 2 deletions config.template
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ MQTT_PASSWORD=
#-System
#--cycle interval in seconds (max 300 seconds)
INTERVAL=1
#--log level, set "1" to get detailled logging
LOG_LEVEL=0
#--log mode defines the handling of errors/messages that are returned in response to a tag request
#--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
#LOG_MODE=OFF
#LOG_MODE=ON
LOG_MODE=BUFFERED
#--log files
LOGFILE=/tmp/rscp2mqtt.log
TOPIC_LOG_FILE=/tmp/rscp2mqtt.history
Expand All @@ -45,6 +48,10 @@ RETAIN_FOR_SETUP=true
#--Topic prefix (max 24 characters), default is e3dc
PREFIX=e3dc

#-MQTT Payload
#--Boolean values true/false or 1/0
USE_TRUE_FALSE=true

#-Power Meter
#--PM_INDEX can be set multiple times if several power meters exist, default is 0
#--PM_EXTERN=true has the same effect as PM_INDEX=6 (6 for S10 Mini, compatibilty with previous releases)
Expand Down

0 comments on commit 78ffb36

Please sign in to comment.