Skip to content

Commit a71132e

Browse files
committed
v3.26
1 parent dd00f6e commit a71132e

File tree

13 files changed

+1101
-452
lines changed

13 files changed

+1101
-452
lines changed

.github/workflows/dockerimage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
password: ${{ secrets.GITHUB_TOKEN }}
5353
-
5454
name: Build and push
55-
uses: docker/build-push-action@v5
55+
uses: docker/build-push-action@v6
5656
with:
5757
context: .
5858
build-args: |

INFLUXDB.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ INFLUXDB_2_TOKEN=<my_token>
6464

6565
Please use the web admin tool of the InfluxDB v2.x to configure the bucket, the orga and the token.
6666

67-
### TLS encryption
67+
### TLS Encryption
6868

6969
rscp2mqtt uses the library libcurl for the connection to InfluxDB. To establish a TLS connection, please use the following configuration parameters.
7070
```

MQTT_TLS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ MQTT_TLS_CERTFILE=/home/pi/client.crt
1313
MQTT_TLS_KEYFILE=/home/pi/client.key
1414
```
1515

16-
### Certificates and broker configuration
16+
### Certificates and Broker Configuration
1717

1818
Please follow these commands to create an example environment on your computer with a running Mosquitto broker:
1919

@@ -53,7 +53,7 @@ openssl x509 -req -in client.csr -CA /etc/mosquitto/ca_certificates/ca.crt -CAke
5353
chmod a+r *
5454
```
5555

56-
### Broker configuration
56+
### Broker Configuration
5757
```
5858
cd /etc/mosquitto/conf.d
5959
@@ -74,7 +74,7 @@ Restart the MQTT broker
7474
systemctl restart mosquitto.service
7575
```
7676

77-
### Prepare client
77+
### Prepare Client
7878

7979
Copy client key and certificate
8080
```

NEWTAGS.md

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
## New Tags and Topics
2+
3+
The following options are available to support the clarification and integration of further topics:
4+
5+
- Raw data mode
6+
- Configuration of tags that can be queried
7+
- Configuration of new topics
8+
- One-time execution
9+
10+
### Raw Data Mode
11+
12+
The raw data mode helps to find out which data is output when configuring new query tags.
13+
14+
It can be configured in the .config with
15+
```
16+
RAW_DATA=true
17+
```
18+
rscp2mqtt will generate additional output such as
19+
```
20+
e3dc/raw/TAG_EMS_POWER_PV
21+
e3dc/raw/TAG_EMS_POWER_BAT
22+
e3dc/raw/TAG_EMS_POWER_HOME
23+
e3dc/raw/TAG_EMS_POWER_GRID
24+
e3dc/raw/TAG_BAT_DATA/TAG_BAT_RSOC
25+
```
26+
27+
The tag names are used to build the topic names.
28+
Raw data is only published via MQTT.
29+
30+
### Configuration of Tags
31+
32+
All tags that are listed in RscpTags.h and have "REQ" in their name can be used.
33+
ADD_NEW_REQUEST and ADD_NEW_REQUEST_AT_START (for one-time execution at program start) are usable for configuration in the .config.
34+
35+
```
36+
ADD_NEW_REQUEST=<container>:<tag>[:value]-<sequence>
37+
ADD_NEW_REQUEST_AT_START=<container>:<tag>[:value]-<sequence>
38+
```
39+
40+
Containers are substructured tags. But containers are not labeled as such and therefore cannot be distinguished from other tags. The root container has the value 0.
41+
If several tags are queried for a container, a query sequence can be specified, otherwise use "0".
42+
In some cases it is necessary to set a "value" first, e.g. to specify a battery pack, a wallbox or a photovoltaic inverter.
43+
44+
#### Example "IP address"
45+
```
46+
ADD_NEW_REQUEST_AT_START=0:TAG_INFO_REQ_IP_ADDRESS-0
47+
# root container, tag for querying the IP address
48+
```
49+
50+
#### Example "Battery info for the battery package with index 0"
51+
```
52+
ADD_NEW_REQUEST=TAG_BAT_REQ_DATA:TAG_BAT_INDEX:0-0
53+
ADD_NEW_REQUEST=TAG_BAT_REQ_DATA:TAG_BAT_REQ_INFO-1
54+
# battery data container, index value 0 as sequence 0 and request info as sequence 1
55+
```
56+
57+
### Configuration of New Topics
58+
59+
If you have successfully configured a new tag and were able to find the output in the raw data, you can configure a new topic for it.
60+
61+
```
62+
ADD_NEW_TOPIC=<container>:<tag>:<unit>:<divisor>:<bit_to_bool>:<topic>
63+
```
64+
Float values are divided by the divisor. In this way power values in Watt can be converted into kW.
65+
Integer values can be converted to a boolean value (true/false) with "bit_to_bool" using a boolean AND.
66+
67+
unit = "_" will be handled as "no unit".
68+
69+
Please enter the topic without the prefix.
70+
71+
#### Example "IP address"
72+
```
73+
ADD_NEW_TOPIC=0:TAG_INFO_IP_ADDRESS:_:1:0:system/ip_address
74+
```
75+
76+
rscp2mqtt always requests container and tag, no further levels. If further levels are output in the raw data, please specify the last two levels with ADD_NEW_TOPIC.
77+
78+
#### Example "Max DC Power"
79+
```
80+
ADD_NEW_REQUEST=0:TAG_EMS_REQ_MAX_DC_POWER-0
81+
ADD_NEW_TOPIC=TAG_EMS_MAX_DC_POWER:TAG_EMS_PARAM_POWER_VALUE_L1:W:1:0:system/max_dc_power_L1
82+
ADD_NEW_TOPIC=TAG_EMS_MAX_DC_POWER:TAG_EMS_PARAM_POWER_VALUE_L2:W:1:0:system/max_dc_power_L2
83+
ADD_NEW_TOPIC=TAG_EMS_MAX_DC_POWER:TAG_EMS_PARAM_POWER_VALUE_L3:W:1:0:system/max_dc_power_L3
84+
```
85+
86+
### Configuration of New Set Topics
87+
88+
```
89+
ADD_NEW_SET_TOPIC=<container>:<tag>:<topic>:<regex>-<datatype<
90+
# or
91+
ADD_NEW_SET_TOPIC=<container>:<tag>:<topic>:<true_regex>:<true_value>:<false_regex>:<false_value>-<datatype<
92+
```
93+
You can use "regex" to define a regular expression that checks the input payload, e.g. for permitted numbers.
94+
95+
To check boolean values use the fields "true_regex" and "false_regex" to check the input payload for true and false. "true_value" and "false_value" define the values that are to be sent to the home power station.
96+
97+
Possible data types are "Bool", "Char8", "UChar8", "Int32", "UInt32" and "Float32".
98+
99+
See various examples in RscpMqttMapping.h
100+
101+
#### Example "Other set command for weather regulation"
102+
```
103+
ADD_NEW_SET_TOPIC=TAG_EMS_REQ_SET_POWER_SETTINGS:TAG_EMS_WEATHER_REGULATED_CHARGE_ENABLED:set/weather:^true|on|1$:1:^false|off|0$:0-UChar8
104+
```
105+
106+
### One-time Execution
107+
108+
The program can be started that it executes only one entire interval.
109+
```
110+
./rscp2mqtt -1
111+
```
112+
### Remarks
113+
114+
The procedure for integrating new tags is always trial and error. The structure of the tags is not standardized. There is no guarantee that you will get the expected values. Sometimes you receive multiple tags or tag structures in response to a single query. A look at the list of generated errors can be very helpful.
115+
116+
RscpTags.h is based on the old portal, so new features may not be available.
117+
118+
If you have made a big catch and it makes sense to integrate what you have found directly into the tool, let the community know.
119+
120+
### Further Examples
121+
```
122+
ADD_NEW_REQUEST=0:TAG_EMS_REQ_IS_PV_DERATING-0
123+
ADD_NEW_TOPIC=0:TAG_EMS_IS_PV_DERATING:_:1:0:system/is_pv_derating
124+
125+
# Network
126+
ADD_NEW_REQUEST_AT_START=0:TAG_INFO_REQ_IP_ADDRESS-0
127+
ADD_NEW_TOPIC=0:TAG_INFO_IP_ADDRESS:_:1:0:system/ip_address
128+
ADD_NEW_REQUEST_AT_START=0:TAG_INFO_REQ_SUBNET_MASK-0
129+
ADD_NEW_TOPIC=0:TAG_INFO_SUBNET_MASK:_:1:0:system/subnet_mask
130+
ADD_NEW_REQUEST_AT_START=0:TAG_INFO_REQ_GATEWAY-0
131+
ADD_NEW_TOPIC=0:TAG_INFO_GATEWAY:_:1:0:system/gateway
132+
ADD_NEW_REQUEST_AT_START=0:TAG_INFO_REQ_DHCP_STATUS-0
133+
ADD_NEW_TOPIC=0:TAG_INFO_DHCP_STATUS:_:1:0:system/dhcp_status
134+
ADD_NEW_REQUEST_AT_START=0:TAG_INFO_REQ_DNS-0
135+
ADD_NEW_TOPIC=0:TAG_INFO_DNS:_:1:0:system/dns
136+
ADD_NEW_REQUEST_AT_START=0:TAG_INFO_REQ_MAC_ADDRESS-0
137+
ADD_NEW_TOPIC=0:TAG_INFO_MAC_ADDRESS:_:1:0:system/mac_address
138+
139+
# Info Tag
140+
ADD_NEW_REQUEST=0:TAG_INFO_REQ_INFO-0
141+
ADD_NEW_REQUEST=TAG_NETWORK_REQ_INFO:TAG_NETWORK_PARAM_IP-0
142+
143+
# DC/DC
144+
ADD_NEW_REQUEST=TAG_DCDC_REQ_DATA:TAG_DCDC_INDEX:0-0
145+
ADD_NEW_REQUEST=TAG_DCDC_REQ_DATA:TAG_DCDC_REQ_STATUS-1
146+
ADD_NEW_REQUEST=TAG_DCDC_REQ_DATA:TAG_DCDC_REQ_STATUS_AS_STRING-1
147+
ADD_NEW_REQUEST=TAG_DCDC_REQ_DATA:TAG_DCDC_REQ_GET_BAT_CONNECTED-1
148+
ADD_NEW_REQUEST=TAG_DCDC_REQ_DATA:TAG_DCDC_REQ_I_BAT-1
149+
ADD_NEW_REQUEST=TAG_DCDC_REQ_DATA:TAG_DCDC_REQ_U_BAT-1
150+
ADD_NEW_REQUEST=TAG_DCDC_REQ_DATA:TAG_DCDC_REQ_P_BAT-1
151+
ADD_NEW_REQUEST=TAG_DCDC_REQ_DATA:TAG_DCDC_REQ_I_DCL-1
152+
ADD_NEW_REQUEST=TAG_DCDC_REQ_DATA:TAG_DCDC_REQ_U_DCL-1
153+
ADD_NEW_REQUEST=TAG_DCDC_REQ_DATA:TAG_DCDC_REQ_P_DCL-1
154+
ADD_NEW_REQUEST=TAG_DCDC_REQ_DATA:TAG_DCDC_REQ_ON_GRID-1
155+
ADD_NEW_REQUEST=TAG_DCDC_REQ_DATA:TAG_DCDC_REQ_DERATING-1
156+
ADD_NEW_REQUEST=TAG_DCDC_REQ_DATA:TAG_DCDC_REQ_DERATING_VALUE-1
157+
```

README.md

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Supported topic areas are:
2323
- Values of the power meter (PM)
2424
- Values of the photovoltaic inverter (PVI)
2525
- Values of the emergency power supply (EP)
26-
- Values of the wallbox (WB)
26+
- Values of wallboxes (WB)
2727

2828
For continuous provision of values, you can configure several topics that are published in each cycle. Default: Only modified values will be published.
2929

@@ -45,8 +45,10 @@ For continuous provision of values, you can configure several topics that are pu
4545
- Historical data for past years
4646
- Query of historical daily values
4747
- Multiple power meters
48-
- Switch between wallboxes
49-
- TLS connections ([MQTT broker](MQTT_TLS.md), InfluxDB)
48+
- Multiple wallboxes
49+
- TLS connections ([MQTT broker](MQTT_TLS.md), [InfluxDB](INFLUXDB.md))
50+
- [Additional tags and topics](NEWTAGS.md) by configuration
51+
- Raw data mode
5052

5153
Please also take a look at the [release notes](RELEASE.md).
5254

@@ -135,7 +137,7 @@ To do this, set in the .config file: `LOG_MODE=BUFFERED`.
135137
You can also switch off the logging of such messages completely with `LOG_MODE=OFF`.
136138
If every event is to be logged: `LOG_MODE=ON`.
137139

138-
## Program start
140+
## Program Start
139141

140142
Start the program:
141143
```
@@ -153,19 +155,10 @@ or to show the help page
153155
If everything works properly, you will see something like this:
154156

155157
```
156-
rscp2mqtt [3.25]
158+
rscp2mqtt [3.26]
157159
E3DC system >192.168.178.111:5033< user: >your E3DC user<
158-
MQTT broker >localhost:1883< qos = >0< retain = >false< tls >✗< client id >✗< prefix >e3dc<
159-
Fetching data every second.
160-
Requesting PVI ✓ | PM (0) | DCB ✓ (1 battery string) | Wallbox (0) ✗ | Autorefresh ✓
161-
Log Level = 2 (BUFFERED)
162-
Stdout to terminal
163-
164-
[2024-06-08 08:00:00] pid=30250 ppid=1 RscpMqttMain.cpp(3022) Connecting to server 192.168.178.111:5033
165-
[2024-06-08 08:00:00] pid=30250 ppid=1 RscpMqttMain.cpp(3029) Success: E3DC connected.
166-
[2024-06-08 08:00:00] pid=30250 ppid=1 RscpMqttMain.cpp(1903) RSCP authentication level 10
167-
[2024-06-08 08:00:00] pid=30250 ppid=1 RscpMqttMain.cpp(2435) Connecting to broker localhost:1883
168-
[2024-06-08 08:00:00] pid=30250 ppid=1 RscpMqttMain.cpp(2456) Success: MQTT broker connected.
160+
MQTT broker >localhost:1883< qos = >0< retain = >✗< tls >✗< client id >✗< prefix >e3dc<
161+
Requesting PVI ✓ | PM (0) | DCB ✓ (1 battery string) | Wallbox ✗ | Interval 2 | Autorefresh ✓ | Raw data ✗ | Logging OFF
169162
```
170163

171164
Check the configuration if the connections are not established.
@@ -356,11 +349,11 @@ Turn on the functionality in the configuration file .config, add/change the foll
356349
AUTO_REFRESH=true
357350
```
358351

359-
## Wallbox Control
352+
### Wallbox Control
360353

361354
The commands for controlling an E3/DC wallbox can be found [here](WALLBOX.md).
362355

363-
## Historical daily data
356+
### Historical Daily Data
364357

365358
Historical data for a specific day (format "YYYY-MM-DD") can be queried by
366359
```
@@ -372,7 +365,7 @@ Please use the script `request_days.sh` to request data for a time span.
372365
./request_days.sh localhost 1883 e3dc 2024-01-01 2024-01-13
373366
```
374367

375-
## System Commands
368+
### System Commands
376369

377370
Refresh all topics
378371
```
@@ -406,6 +399,14 @@ Turn DCB requests on or off (true/1/false/0)
406399
```
407400
mosquitto_pub -h localhost -p 1883 -t "e3dc/set/requests/dcb" -m true
408401
```
402+
Turn EMS requests on or off (true/1/false/0)
403+
```
404+
mosquitto_pub -h localhost -p 1883 -t "e3dc/set/requests/ems" -m true
405+
```
406+
Turn history requests on or off (true/1/false/0)
407+
```
408+
mosquitto_pub -h localhost -p 1883 -t "e3dc/set/requests/history" -m true
409+
```
409410
Turn SOC limiter on or off (true/1/false/0)
410411
```
411412
mosquitto_pub -h localhost -p 1883 -t "e3dc/set/soc_limiter" -m true
@@ -418,6 +419,10 @@ Turn statistic values on or off (true/1/false/0)
418419
```
419420
mosquitto_pub -h localhost -p 1883 -t "e3dc/set/statistic_values" -m true
420421
```
422+
Turn raw data mode on or off (true/1/false/0)
423+
```
424+
mosquitto_pub -h localhost -p 1883 -t "e3dc/set/raw_mode" -m true
425+
```
421426

422427
## Used Libraries and Licenses
423428

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.26 (14.07.2024)
4+
5+
Features:
6+
- Issue #76: Multiple wallboxes
7+
- Additional tags and topics by configuration
8+
- Raw data mode
9+
- Deletion of deprecated wallbox commands (e3dc/set/wallbox/control)
10+
11+
Pull request:
12+
- #78 (build workflow)
13+
314
### Release v3.25 (08.06.2024)
415

516
Features:

RscpMqttConfig.h

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@
55
#define MAX_PM_COUNT 8
66
#define MAX_WB_COUNT 8
77

8+
typedef struct _wb_t {
9+
int day_add_total[MAX_WB_COUNT];
10+
int day_total[MAX_WB_COUNT];
11+
int day_add_solar[MAX_WB_COUNT];
12+
int day_solar[MAX_WB_COUNT];
13+
int last_wallbox_energy_total_start[MAX_WB_COUNT];
14+
int last_wallbox_energy_solar_start[MAX_WB_COUNT];
15+
int last_wallbox_plugged_last[MAX_WB_COUNT];
16+
int last_diff_total[MAX_WB_COUNT];
17+
int last_diff_solar[MAX_WB_COUNT];
18+
int last_add_total[MAX_WB_COUNT];
19+
int last_add_solar[MAX_WB_COUNT];
20+
} wb_t;
21+
822
typedef struct _config_t {
923
char e3dc_ip[20];
1024
uint32_t e3dc_port;
@@ -51,6 +65,7 @@ typedef struct _config_t {
5165
char *logfile;
5266
char *historyfile;
5367
bool verbose;
68+
bool once;
5469
int interval;
5570
int log_level;
5671
bool save_memory;
@@ -62,14 +77,17 @@ typedef struct _config_t {
6277
int bat_dcb_start[MAX_DCB_COUNT];
6378
bool pm_extern;
6479
int pm_number;
65-
int pm_index[MAX_PM_COUNT];
80+
int pm_indexes[MAX_PM_COUNT];
6681
bool pm_requests;
82+
bool ems_requests;
83+
bool hst_requests;
6784
bool dcb_requests;
6885
bool soc_limiter;
6986
bool daily_values;
7087
bool statistic_values;
7188
bool wallbox;
72-
int wb_index;
89+
int wb_number;
90+
int wb_indexes[MAX_WB_COUNT];
7391
bool daemon;
7492
bool mqtt_pub;
7593
#ifdef INFLUXDB
@@ -79,6 +97,7 @@ typedef struct _config_t {
7997
bool store_setup;
8098
char true_value[5];
8199
char false_value[6];
100+
bool raw_mode;
82101
} config_t;
83102

84103
#endif

0 commit comments

Comments
 (0)