Skip to content

Commit

Permalink
v3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
pvtom committed Jan 13, 2024
1 parent f0835d6 commit 49a3d8e
Show file tree
Hide file tree
Showing 8 changed files with 374 additions and 174 deletions.
1 change: 1 addition & 0 deletions INFLUXDB.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ INFLUXDB_1_AUTH=false
INFLUXDB_1_USER=
INFLUXDB_1_PASSWORD=
INFLUXDB_TOPIC=e3dc/[a-z]+/power
INFLUXDB_TOPIC=e3dc/day/.*
```
You can configure the topics to be transferred to the InfluxDB by setting the parameter INFLUXDB_TOPIC.
INFLUXDB_TOPIC can occur several times.
Expand Down
37 changes: 24 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
[![GitHub](https://img.shields.io/github/license/pvtom/rscp2mqtt)](https://github.com/pvtom/rscp2mqtt/blob/main/LICENSE)

This software module connects a home power station from E3/DC to an MQTT broker.
It uses the RSCP interface of the device.

The solution is based on the RSCP sample application provided by E3/DC and was developed and tested with a Raspberry Pi and a Linux PC (x86_64).
It uses the RSCP interface of the device. The solution is based on the RSCP sample application provided by E3/DC and was developed and tested with a Raspberry Pi and a Linux PC (x86_64).

The tool fetches data cyclically and publishes it to the MQTT broker under certain [topics](TOPICS.md).
The tool cyclically queries data from the home power station and publishes it to an MQTT broker using these [topics](TOPICS.md).

Supported topic areas are:

Expand Down Expand Up @@ -47,9 +46,9 @@ For continuous provision of values, you can configure several topics that are pu
- Configuration of the topics that will be published to InfluxDB (INFLUXDB_TOPIC)
- MQTT Client ID can be configured
- More detailled [TOPIC](TOPICS.md) overview
- (new) Multiple battery strings are supported (BATTERY_STRINGS parameter)
- (new) Automatic detection of the number of PVI trackers
- (new) Additional topics
- Multiple battery strings are supported (BATTERY_STRINGS parameter)
- Automatic detection of the number of PVI trackers
- (new) Query of historical daily values

## Docker

Expand Down Expand Up @@ -142,7 +141,7 @@ or in verbose mode
If everything works properly, you will see something like this:

```
rscp2mqtt [v3.10]
rscp2mqtt [v3.11]
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.
Expand All @@ -151,11 +150,11 @@ Log level = 0
Stdout to terminal
...
[2024-01-03 10:00:00] pid=30100 ppid=1 RscpMqttMain.cpp(2185) Connecting to server 192.168.178.111:5033
[2024-01-03 10:00:00] pid=30100 ppid=1 RscpMqttMain.cpp(2192) Success: E3DC connected.
[2024-01-03 10:00:00] pid=30100 ppid=1 RscpMqttMain.cpp(1283) RSCP authentication level 10
[2024-01-03 10:00:00] pid=30100 ppid=1 RscpMqttMain.cpp(1796) Connecting to broker localhost:1883
[2024-01-03 10:00:00] pid=30100 ppid=1 RscpMqttMain.cpp(289) Success: MQTT broker connected.
[2024-01-13 10:50:00] pid=30110 ppid=1 RscpMqttMain.cpp(2294) Connecting to server 192.168.178.111:5033
[2024-01-13 10:50:00] pid=30110 ppid=1 RscpMqttMain.cpp(2301) Success: E3DC connected.
[2024-01-13 10:50:00] pid=30110 ppid=1 RscpMqttMain.cpp(1379) RSCP authentication level 10
[2024-01-13 10:50:00] pid=30110 ppid=1 RscpMqttMain.cpp(1905) Connecting to broker localhost:1883
[2024-01-13 10:50:00] pid=30110 ppid=1 RscpMqttMain.cpp(1914) Success: MQTT broker connected.
...
```

Expand Down Expand Up @@ -198,7 +197,7 @@ sudo systemctl start rscp2mqtt

## Device Control

rscp2mqtt subscribes to the root topic "prefix/set/#" and forwards incoming requests to the home power station. In this way, the device can be controlled and changes made to its configuration.
rscp2mqtt subscribes to the root topic "e3dc/set/#" and forwards incoming requests to the home power station. In this way, the device can be controlled, additional data can be queried and changes can be made to its configuration.

### Battery Charging

Expand Down Expand Up @@ -379,6 +378,18 @@ Set number of phases (1/3)
mosquitto_pub -h localhost -p 1883 -t "e3dc/set/wallbox/number_phases" -m 1
```

## Historical daily data

Historical data for a specific day (format "YYYY-MM-DD") can be queried by
```
mosquitto_pub -h localhost -p 1883 -t "e3dc/set/request/day" -m "2024-01-01"
```

Please use the script `request_days.sh` to request data for a time span.
```
./request_days.sh localhost 1883 e3dc 2024-01-01 2024-01-13
```

## System Commands

Refresh all topics
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.11 (13.01.2024)

- Query of historical daily values (Issue #40)
- Issue #41: Enables the reserve to be set to 100%

### Release v3.10 (03.01.2024)

- Issue #30: Multiple battery strings are supported (e.g. S10 Pro)
Expand Down
167 changes: 139 additions & 28 deletions RscpMqttMain.cpp

Large diffs are not rendered by default.

166 changes: 90 additions & 76 deletions RscpMqttMapping.h

Large diffs are not rendered by default.

128 changes: 72 additions & 56 deletions TOPICS.md

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion config.template
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ DISABLE_MQTT_PUBLISH=false
AUTO_REFRESH=false
#--external Power Meter (i.e. S10 Mini)
PM_EXTERN=false
#--Year of installation
#--Start of Operation
HISTORY_START_YEAR=2022

#-MQTT Topics
Expand Down Expand Up @@ -75,6 +75,7 @@ INFLUXDB_PORT=8086
INFLUXDB_VERSION=2
INFLUXDB_MEASUREMENT=e3dc
INFLUXDB_TOPIC=e3dc/[a-z]+/power
INFLUXDB_TOPIC=e3dc/day/.*

#-InfluxDB v1
#--if compiled with InfluxDB option
Expand Down
41 changes: 41 additions & 0 deletions request_days.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

if [ $# -ne 5 ]; then
echo "Usage: $0 <broker> <port> <prefix> <start_date> <end_date>"
exit 1
fi

broker=$1
port=$2
prefix=$3
start_date=$4
end_date=$5

if ! [[ $port =~ ^[0-9]+$ ]]; then
echo "Invalid port number. Please provide a positive integer."
exit 1
fi
if (($port < 1)) || (($port > 65535)); then
echo "Invalid port number. Port must be between 1 and 65535."
exit 1
fi
if ! [[ $start_date =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]] || ! [[ $end_date =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]]; then
echo "Invalid date format. Please use YYYY-MM-DD."
exit 1
fi
if ! date -d "$start_date" &> /dev/null; then
echo "Invalid start date: $start_date"
exit 1
fi
if ! date -d "$end_date" &> /dev/null; then
echo "Invalid end date: $end_date"
exit 1
fi

end_date=$(date -d "$end_date + 1 day" +"%Y-%m-%d")

while [[ $start_date < $end_date ]]; do
echo "Requesting data for $start_date"
mosquitto_pub -h $broker -p $port -t "$prefix/set/request/day" -m "$start_date"
start_date=$(date -d "$start_date + 1 day" +"%Y-%m-%d")
done

0 comments on commit 49a3d8e

Please sign in to comment.