Giter Site home page Giter Site logo

pvtom / rscp2mqtt Goto Github PK

View Code? Open in Web Editor NEW
29.0 7.0 7.0 318 KB

Bridge between an E3/DC home power station and an MQTT broker based on the RSCP protocol

License: MIT License

C++ 61.16% Makefile 0.04% C 38.59% Dockerfile 0.08% Shell 0.12%
e3dc rscp mqtt s10 photovoltaic wallbox influxdb influxdb2 hauskraftwerk solar-energy

rscp2mqtt's Introduction

RSCP2MQTT - Bridge between an E3/DC device and an MQTT broker

GitHub sourcecode GitHub release (latest by date) GitHub last commit GitHub issues GitHub pull requests GitHub

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

The tool cyclically queries data from the home power station and publishes it to an MQTT broker using these topics.

Supported topic areas are:

  • Energy topics for today
  • Current power values
  • Autarky and self-consumption
  • Battery status
  • Energy management (EMS) power settings
  • Data from yesterday and the current week, month and year
  • Values of the power meter (PM)
  • Values of the photovoltaic inverter (PVI)
  • Values of the emergency power supply (EP)
  • Values of the wallbox (WB)

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

Features

  • E3/DC wallbox topics
  • InfluxDB support
  • Topics for temperatures (battery, PVI)
  • Idle periods
  • System error messages
  • Details of the battery modules (DCB)
  • Units as InfluxDB tags
  • Battery SOC limiter
  • Docker images at https://hub.docker.com/r/pvtom/rscp2mqtt
  • Dashboard is available
  • Configuration of the topics that will be published to InfluxDB (INFLUXDB_TOPIC)
  • Multiple battery strings are supported (BATTERY_STRINGS parameter)
  • Automatic detection of the number of PVI trackers
  • Historical data for past years
  • Query of historical daily values
  • Multiple power meters
  • Switch between wallboxes

Please also take a look at the release notes.

Docker

Instead of installing the package you can use a Docker image.

Prerequisites

  • An MQTT broker in your environment
  • rscp2mqtt needs the library libmosquitto. For installation please enter:
sudo apt-get install libmosquitto-dev

If you like to transfer data to InfluxDB install the libcurl library:

sudo apt-get install curl libcurl4-openssl-dev

Cloning the Repository

sudo apt-get install git # if necessary
git clone https://github.com/pvtom/rscp2mqtt.git
cd rscp2mqtt

Compilation

To build a program version without InfluxDB use:

make

To build a program version including InfluxDB support use:

make WITH_INFLUXDB=yes

Installation

sudo mkdir -p /opt/rscp2mqtt
sudo chown pi:pi /opt/rscp2mqtt/

Adjust user and group (pi:pi) if you use another user.

Copy rscp2mqtt into the directory /opt/rscp2mqtt

cp -a rscp2mqtt /opt/rscp2mqtt

Configuration

Copy the config template file into the directory /opt/rscp2mqtt

cp config.template /opt/rscp2mqtt/.config

Please change to the directory /opt/rscp2mqtt and edit .config to adjust to your configuration:

cd /opt/rscp2mqtt
nano .config

The configuration parameters are described in the file.

The prefix of the topics can be configured by the attribute PREFIX. By default all topics start with "e3dc". This can be changed to any other string that MQTT accepts as a topic, max. 24 characters. E.g. "s10" or "s10/1".

If your system has more than one battery string (e.g. S10 Pro), you have to configure the parameter BATTERY_STRINGS accordingly. Battery topics that belong to a battery string are extended by the number of the battery string. Battery modules (DCB topics) are numbered consecutively.

Find InfluxDB configurations in InfluxDB.

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:

./rscp2mqtt

or in verbose mode

./rscp2mqtt -v

or to show the help page

./rscp2mqtt --help

If everything works properly, you will see something like this:

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

Notes: In the following examples I assume that the MQTT broker runs on the same machine as rscp2mqtt under port 1883. If the MQTT broker runs on another server, please use its name instead of localhost and change the port if it is different. The default prefix e3dc is used for the topics. Please adjust the calls if you use a different prefix.

If you use the Mosquitto tools you can subscribe the topics with (here without user / password)

mosquitto_sub -h localhost -p 1883 -t 'e3dc/#' -v

Daemon Mode

Start the program in daemon mode:

./rscp2mqtt -d

The daemon can be terminated with

pkill rscp2mqtt

Be careful that the program runs only once.

Systemd

rscp2mqtt can be managed by systemd. For this purpose, copy the file rscp2mqtt.service to the systemd directory:

sudo cp -a rscp2mqtt.service /etc/systemd/system/

Configure the service sudo nano rscp2mqtt.service (adjust user 'User=pi'), if needed.

Register the service and start it with:

sudo systemctl enable rscp2mqtt
sudo systemctl start rscp2mqtt

Check log output

journalctl _SYSTEMD_UNIT=rscp2mqtt.service

Device Control

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

Start battery charging manually (payload is the energy [Wh] to charge)

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/manual_charge" -m 1000

Weather Regulation

Set weather regulation (true/1/false/0)

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/weather_regulation" -m true

Power Limits

Set limits for battery charging and discharging (true/1/false/0)

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/power_limits" -m true

Set the charging and discharging power limits in [W]

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/max_charge_power" -m 2300
mosquitto_pub -h localhost -p 1883 -t "e3dc/set/max_discharge_power" -m 4500

Idle Periods

Set idle periods to lock battery charging or discharging

Note: The set operations will work only if the idle period functionality is turned on (via the S10 display).

Parameters:

  • Day: "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday" or "today"
  • Mode: "charge" or "discharge"
  • Active: "true" or "false"
  • Period: "hh:mi-hh:mi"
mosquitto_pub -h localhost -p 1883 -t "e3dc/set/idle_period" -m "today:charge:true:00:00-23:59"

With the topics "e3dc/ems/charging_lock" and "e3dc/ems/discharging_lock" you can check whether a lock is currently active or not.

Battery SOC Limiter

The SOC limiter can be used to conveniently control the charging or discharging of the house battery. It uses the Idle Periods described previously.

Maximum SOC

When the maximum SOC value is reached, the battery charging process is stopped.

Minimum SOC

The battery charge level does not fall below the minimum SOC value. When the SOC is reached, discharging stops.

Home Power

When the house power is above the set value, discharging will stop. This can be used, for example, to prevent charging the electric vehicle from the house battery (when using a non-E3/DC wallbox that cannot be controlled directly by the device).

Set the minimum SOC to limit discharging the battery [%]

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/limit/discharge/soc" -m 30

Turn off the limiter for discharging the battery

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/limit/discharge/soc" -m 0

Set the home power value which stops discharging the battery [W]

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/limit/discharge/by_home_power" -m 7000

Reset the home power value which stops discharging the battery

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/limit/discharge/by_home_power" -m 0

Reset the limiter at the day change

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/limit/discharge/durable" -m false

Keep the limiter setting even after the day change

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/limit/discharge/durable" -m true

Set the maximum SOC to limit charging the battery [%]

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/limit/charge/soc" -m 80

Turn off the limiter for charging the battery

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/limit/charge/soc" -m 0

Reset the limiter at the day change

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/limit/charge/durable" -m false

Keep the limiter setting even after the day change

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/limit/charge/durable" -m true

Emergency Power

Set battery reserve for emergency power

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/reserve/energy" -m 1500 # in [Wh]
# or
mosquitto_pub -h localhost -p 1883 -t "e3dc/set/reserve/percent" -m 10 # in [%]

Power Management

Control the power management with "e3dc/set/power_mode":

The functionality can be used to intervene in the regulation of the power management. Caution: This function can be used to bypass a set feed-in reduction. Use this functionality at your own risk.

Automatic / normal mode

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/power_mode" -m "auto"

Idle mode (number of cycles)

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/power_mode" -m "idle:60"

Discharge mode (power in [W], number of cycles)

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/power_mode" -m "discharge:2000:60"

Charge mode (power in [W], number of cycles)

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/power_mode" -m "charge:2000:60"

Grid charge mode (power in [W], number of cycles)

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/power_mode" -m "grid_charge:2000:60"

After the time has elapsed (number of cycles multiplied by the configured interval) plus a few seconds, the system automatically returns to normal mode.

Turn on the functionality in the configuration file .config, add/change the following line:

AUTO_REFRESH=true

Wallbox Control

The commands for controlling an E3/DC wallbox can be found here.

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

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/force" -m 1

Refresh specific topics

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/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)

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/interval" -m 2

Turn PM requests on or off (true/1/false/0)

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/requests/pm" -m true

Turn PVI requests on or off (true/1/false/0)

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/requests/pvi" -m true

Turn DCB requests on or off (true/1/false/0)

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/requests/dcb" -m true

Turn SOC limiter on or off (true/1/false/0)

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/soc_limiter" -m true

Turn daily historical values on or off (true/1/false/0)

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/daily_values" -m true

Turn statistic values on or off (true/1/false/0)

mosquitto_pub -h localhost -p 1883 -t "e3dc/set/statistic_values" -m true

Used Libraries and Licenses

  • The RSCP example application comes from E3/DC. According to E3/DC it can be distributed under the following conditions: The authors or copyright holders, and in special E3/DC can not be held responsible for any damage caused by the software. Usage of the software is at your own risk. It may not be issued in copyright terms as a separate work.
  • License of AES is included in the AES code files
  • Eclipse Mosquitto (https://github.com/eclipse/mosquitto) with EPL-2.0
  • libcurl (https://github.com/curl/curl/blob/master/COPYING)

rscp2mqtt's People

Contributors

bstaeheli avatar goebelmeier avatar martinholters avatar pvtom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

rscp2mqtt's Issues

Make ClientID configurable

I had problems to add rscp2mqtt to my FHEM installation via the build-in MQTT2 server. Finally I could do so after changing your mosquito connection string, which generates at every start a new random ClientID, to this fixed string (line 1621 in RscpMqttMain.cpp):

mosq = mosquitto_new("rscp2mqtt", true, NULL);

It would be fine, if it is possible to set a fixed ClientID in the config file.

Feature: influxdb 1 missing Authentifikation

Hello,

the influxdb v1 Implementation is missing the the Auth possibility for authentifikation:
if (cfg.influxdb_version == 1) {
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_BASIC);
curl_easy_setopt(curl, CURLOPT_USERNAME, cfg.influxdb_user);
curl_easy_setopt(curl, CURLOPT_PASSWORD, cfg.influxdb_password);
sprintf(buffer, "http://%s:%d/write?db=%s", cfg.influxdb_host, cfg.influxdb_port, cfg.influxdb_db);

I will try to imlement

e3dc/mode

A question regarding value "e3dc/mode".
It jumps every few seconds between "1" and "2" within my installation S10X from Oct 2023.

In docker I see this log entry:
Error: Tag 0x06800400 received error code 4294967295.

In rsc2mqtt log file I see:
[2023-12-17 10:56:38] pid=1 ppid=0 RscpMqttMain.cpp(324) topic >e3dc/system/software< payload >H20_2023_024< unit ><

I tried to grab the values via mqtt explorer
grafik

my .config

// IP address of the E3/DC S10 device
E3DC_IP=192.168.X.Y
// Port of the E3/DC S10 device, default is 5033
E3DC_PORT=5033
// E3/DC account
[email protected]
E3DC_PASSWORD=password
// AES password
E3DC_AES_PASSWORD=password
// Target MQTT broker
MQTT_HOST=192.168.X.Y
// Default port is 1883
MQTT_PORT=1883
// MQTT user / password authentication necessary? Depends on the MQTT broker configuration.
MQTT_AUTH=false
// if true, then enter here
MQTT_USER=
MQTT_PASSWORD=
// MQTT parameters
MQTT_QOS=0
MQTT_RETAIN=false
// Topic prefix (max 24 characters), default is e3dc
PREFIX=e3dc
// log file
LOGFILE=rscp2mqtt.log
// history start year (installation of the E3/DC device)
HISTORY_START_YEAR=2023
// log file for selected topics
TOPIC_LOG_FILE=/tmp/rscp2mqtt.history
// selected topics for logging (regular expressions)
TOPIC_LOG=e3dc/history/.*
TOPIC_LOG=e3dc/system/software
// Interval requesting the E3/DC S10 device in seconds (1..10)
INTERVAL=3
// enable PVI requests, default is true
PVI_REQUESTS=true
// number of available PV strings(trackers), default is 2
PVI_TRACKER=2
// enable PM requests, default is true
PM_REQUESTS=true
// use external PM (S10 Mini), default is false
PM_EXTERN=false
// enable DCB (details for battery modules) requests, default is true
DCB_REQUESTS=false
// enable battery SOC limiter, default is false
SOC_LIMITER=true
// Auto refresh, default is false
AUTO_REFRESH=true
// Disable MQTT publish support (dryrun mode)
DISABLE_MQTT_PUBLISH=false
// Wallbox, default is false
WALLBOX=false
// topics to be published in each cycle (regular expressions)
FORCE_PUB=e3dc/.*

In OpenHAB forum I found a hint about too many persites item states leading to performance issues. In fact, I persisted with every change, now every 5 seconds. Surprise: the status of e3dc/mode change way less now. From every few seconds to twice in 30min:

2023-12-17 12:06:45.129 [INFO ] [b.automation.script.ui.E3DC_Notstrom] - E3DC Notstrombetrieb bereit. Status="1"
2023-12-17 12:06:46.675 [INFO ] [b.automation.script.ui.E3DC_Notstrom] - E3DC Notstrombetrieb nicht aktiv. Status="2"

Any idea, how to deeper understand this behaviour? The E3DC shows stable status

Historical data

Daily, weekly, yearly historica data - how to manage this?
Can I give a specific date or a range?

Logging: Error: Tag 0x05840000 received error code 6.

Hi,
thanks for providing this great tool. I'm running it for a couple of hours and noted the following log entry:

Error: Tag 0x05840000 received error code 6.
{"code":"invalid","message":"unable to parse 'e3dc,topic=e3dc/system/software value=S10_2022_046': invalid boolean\nunable to parse 'e3dc,topic=e3dc/system/production_date value=KW46 2020': invalid boolean\nunable to parse 'e3dc,topic=e3dc/system/serial_number value=XXXXXXXX': invalid boolean\nunable to parse 'e3dc,topic=e3dc/time/zone value=Europe/Berlin': invalid boolean"}{"code":"invalid","message":"unable to parse 'e3dc,topic=e3dc/battery/name value=LG_BAT': invalid boolean"}[2023-06-25 22:09:19] pid=1 ppid=0 RscpMqttMain.cpp(789) Error: Tag 0x05840000 received error code 6.

I removed the serial number from the bug report. It doesn't seem to hurt much as it seems to provide most of the data I was looking for. But maybe you want to investigate / fix it .
In case of any questions, please let me know.

DCB Batteries missing

Hallo Thomas,

mir ist aufgefallen dass bei den DCB Werten nicht alle Batterien kommen.
Ich habe 5 Stück und bekomme nur die ersten 3 Stück, welche am Batterie String 1 meines E3DC PRO hängt.
Die beiden Module auf dem zweiten Batterie-String werden nicht übertragen.

Gibts dafür auch TAGS mit denen du die Werte lesen kannst?

Danke & Grüße
Philipp

TOPICS die bei jedem Durchlauf geschrieben werden sollen

Hallo Thomas,

da ich die rscp2mqtt Daten in eine Influxdb schreibe, bräuchte ich die Möglichkeit folgende TOPICS bei jedem Durchlauf zu schreiben, momentan funktioniert das nicht bei allen z.b. e3dc/wallbox/power/total. Dadurch entstehen Lücken und unschöne Graphen Verläufe (siehe Bild)

Bildschirmfoto vom 2024-04-09 15-28-02

FORCE_TOPIC=e3dc/[a-z]+/power
FORCE_TOPIC=e3dc/[a-z]+/energy
FORCE_TOPIC=e3dc/grid/energy/[a-z]+
FORCE_TOPIC=e3dc/wallbox/[a-z]+/total
FORCE_TOPIC=e3dc/wallbox/[a-z]+/solar
FORCE_TOPIC=e3dc/pvi/[a-z]+/string_[1-2]
FORCE_TOPIC=e3dc/battery/energy/[a-z]+
FORCE_TOPIC=e3dc/battery/soc
FORCE_TOPIC=e3dc/battery/soh
FORCE_TOPIC=e3dc/battery/dcb/[1-4]/soh
FORCE_TOPIC=e3dc/battery/dcb/[1-4]/soc
FORCE_TOPIC=e3dc/battery/temperature/.*

Die TOPICS für Grafana sehen genauso aus.

Mache ich da etwas verkehrt?

Gruß Sven

battery_discharge_until

Hallo,

ich habe leider keine weiteren Informationen zum Parameter battery_discharge_until für die Wallbox gefunden. Meine Tests ergaben, dass beim Erreichen des Batterielevels das Laden des Autos unterbrochen wird. Wenn man mit Überschuss lädt, dann wird sich die Batterie wieder aufladen.

Was passiert beim Erreichen der eingestellten Schwelle? Wird das Laden beendet und muss dann durch eine gesonderte Aktion wieder getriggert werden?

Vielen Dank!

systemd service

Happy New Year, too!
No really an issue, but an extension (I'm a bit left handed using git pull requests...).
Started using RSCP2MQTT only a few hours ago and found it really great; this is exactly what I was looking for :-)
Hence I created a systemd service to auto-start it on my RPi:

[Unit]
Description=RSCP2MQTT service
After=network.target
After=systemd-user-sessions.service
After=network-online.target

[Service]
User=pi
Type=forking
WorkingDirectory=/opt/rscp2mqtt
ExecStart=/opt/rscp2mqtt/rscp2mqtt -d
ExecStop=pkill rscp2mqtt
TimeoutSec=30
Restart=on-failure
RestartSec=30
StartLimitInterval=350
StartLimitBurst=10

[Install]
WantedBy=multi-user.target

Maybe helpful to others :-)

Create as 'rscp2mqtt.service' in '/etc/systemd/system/'
Config with 'sudo nano rscp2mqtt.service' (adjust USER 'User'=pi, if needed)
Start: sudo systemctl start rscp2mqtt
Install: sudo systemctl enable rscp2mqtt

Add a Parameter for ID of external Powermeter

Great software and exactly, what I needed. Many thanks.

The ID of the external PM of my E3DC S10 is 4 and not 6. Therefore I had to change RscpMqttMain.cpp the line
protocol.appendValue(&PMContainer, TAG_PM_INDEX, (uint8_t)6); to
protocol.appendValue(&PMContainer, TAG_PM_INDEX, (uint8_t)4);

It would be probably a good idea, to add a parameter e.g. PM_INDEX to the config file.

Change request interval of specific Tags

Hallo Thomas,

wie kann man (im Code) das Abfrageinterval für best. Tags ändern? Ich nutze aktuell das EMS WB_DISCHARGE_BAT_UNTIL und setze dies per MQTT, um es synchron mit Werten aus der Autoladesoftware evcc zu halten.
Dabei ist mir aufgefallen, dass sich der MQTT Wert e3dc/wallbox/battery_discharge_until nach einem MQTT Set nicht ändert, da er wohl nur ab und zu (1x nach Start von rscp2mqtt ?) aktualisiert wird.
Wenn der häufiger aktualisert werden würde, könnte ich auch eine Automatik aufsetzen, die bei Änderung dieses Wertes im E3DC System meine evcc Steuerung synchronisiert.

AES Password ?

Hi together

I am just preparing the config file and wondering what i have to do with the AES Password. Do i have to encrypt my password?

Regards

Patrick

Feature Request: Support of REQ_SET_POWER

Support of REQ_SET_POWER commands to control the charging/discharging of the battery storage directly.

Presumably REQ_SET_POWER_MODE and REQ_SET_POWER_VALUE should be sent in one container.
I am available for testing if needed

Battery_to_car and Battery_before_car without function

Hi,

both type are without function because there a typos...

--- RscpMqttMapping.h.org       2023-05-20 13:30:03.556207343 +0200
+++ RscpMqttMapping.h   2023-05-20 13:34:38.316840030 +0200
@@ -206,8 +206,8 @@
     { TAG_SE_REQ_SET_EP_RESERVE, TAG_SE_PARAM_EP_RESERVE, "e3dc/set/reserve/percent", PAYLOAD_REGEX_2_DIGIT, "", "", "", "", RSCP::eTypeFloat32, -1, true },
     { TAG_SE_REQ_SET_EP_RESERVE, TAG_SE_PARAM_EP_RESERVE_W, "e3dc/set/reserve/energy", PAYLOAD_REGEX_5_DIGIT, "", "", "", "", RSCP::eTypeFloat32, -1, true },
     { 0, 0, "e3dc/set/power_mode", "^auto$|^idle:[0-9]{1,4}$|^charge:[0-9]{1,5}:[0-9]{1,4}$|^discharge:[0-9]{1,5}:[0-9]{1,4}$|^grid_charge:[0-9]{1,5}:[0-9]{1,4}$", "", "", "", "", RSCP::eTypeBool, -1, true },
-    { 0, TAG_EMS_BATTERY_TO_CAR_MODE, "e3dc/set/wallbox/battery_to_car", "^true|on|1$", "1", "^false|off|0$", "0", "", RSCP::eTypeUChar8, -1, true },
-    { 0, TAG_EMS_BATTERY_BEFORE_CAR_MODE, "e3dc/set/wallbox/battery_before_car", "^true|on|1$", "1", "^false|off|0$", "0", "", RSCP::eTypeUChar8, -1, true },
+    { 0, TAG_EMS_REQ_SET_BATTERY_TO_CAR_MODE, "e3dc/set/wallbox/battery_to_car", "^true|on|1$", "1", "^false|off|0$", "0", "", RSCP::eTypeUChar8, -1, true },
+    { 0, TAG_EMS_REQ_SET_BATTERY_BEFORE_CAR_MODE, "e3dc/set/wallbox/battery_before_car", "^true|on|1$", "1", "^false|off|0$", "0", "", RSCP::eTypeUChar8, -1, true },
     { TAG_WB_REQ_DATA, TAG_WB_EXTERN_DATA, "e3dc/set/wallbox/control", "^solar:[0-9]{1,2}$|^mix:[0-9]{1,2}$|^stop$", "", "", "", "", RSCP::eTypeBool, -1, true },
     { 0, 0, "e3dc/set/requests/pm", "^true|1$", "true", "^false|0$", "false", "", RSCP::eTypeBool, -1, true },
     { 0, 0, "e3dc/set/requests/pvi", "^true|1$", "true", "^false|0$", "false", "", RSCP::eTypeBool, -1, true },

Best Regards

Semantics

First of all - I love this piece of software :-)

No issues, just some perceptions beyond the scope of the well-functional programming.
Would be interesting to receive feedback about them.

It´s about the meaning behind the parameters (semantics)

The E3DC RSCP doc+examples (found the last tag update from 2016) give a little insights about semantics, but it seems to me that E3DC doesn´t want them to be self-explanatory.

  1. It took a while to understand that "e3dc/grid/energy/in" seems to be the daily energy to/from grid.
  2. I´d propose to enrich the documentation with a column like "readable" / "writable".
  3. First values of interest for me were the power values. Some kind of grouping, beyond the E3DC tags, would be appreciated.
  4. Some semantics would be helpful. Say, what is the meaning behind the parameters
  5. Typical behaviour of the parameter values (e.g. like in the docs - "e3dc/mode" give good hints, but what are the possible values?) Currently, I tested emergency power and this value raised to 10. On normal days it alternates between 0..1..2. Please understand this as an example. I guess, some experiences could be helpful for the community.

Maybe there is already some deeper pieces of information available somewhere to avoid reinventing the wheel?

If someone is interested in my contribution, let me know (along my personal learning curve with)

enable discharge lock?

Hi Thomas,

thanks for that nice project.
I would like to block battery discharge when my car is being charged. Is there a set command to lock battery discharged?
Or do you have another idea how to solve this?

BR Andreas

"e3dc/set/interval" not considered

It seems that "e3dc/set/interval" is not considered, while the INTERVAL value of config file is taken into account on startup.

When starting rscp2mqtt, INTERVAL setting in .config file sets the initial cadence of writing data to MQTT broker. When INTERVAL is changed and rscp2mqtt got a restart, new frequency is applied.
README.md reports that the cadence can be changed by e.g. mosquitto_pub -h localhost -p 1883 -t "e3dc/set/interval" -m 2, to change the interval. MQTT Explorer reflects the change in correct topic, but rscp2mqtt's update frequency doesn't change.
Commenting INTERVAL in config file results in default 1s cadence, but also here, newly published interval doesn't change this.
Btw.-1 "set/*" topics are not created by rscp2mqtt on startup, which might or might not be expected, e.g. to avoid feedback loops.:check:
Btw.-2 mosquitto_pub -h localhost -p 1883 -t "e3dc/set/force" -m 1 does result in a full topics refresh (except e3dc/set/*) 👍

add wallbox historical data

Hi, a great software which I use since some time. :-)

Is it possible to add historical data of the wallbox like: e3dc/yesterday/wallbox/energy
On this occasion, the total energy consumed by the wallbox would also help a lot.

Maybe it's not just me who would really appreciate it. Many thanks

Multiple powermeters support

Apart from root consumption power meter (PM#0, ROOT), I run a second PM to explicitly measure heat pump consumption (PM#1, ADDITIONAL_CONSUMPTION).
Topic "pm" reports full PM#0 values, but PM#1 values are not exposed. Changing RscpMqttMain.cpp from
protocol.appendValue(&PMContainer, TAG_PM_INDEX, (uint8_t)0); to
protocol.appendValue(&PMContainer, TAG_PM_INDEX, (uint8_t)1);
shows PM#1 in pm/* topics.
Maybe a list of indexes in config file would allow cycling through all available powermeters, or those that are wanted to be queried?
Assuming pm_0 and pm_1 relate to the two powermeters in my system, "pm_0/energy" and "pm_1/energy" topics are available, but no more. Both those energy values are 0.00 at all times.

Testing more Wallbox Tags

Wow, reading rscplib.js I am overwhelmed with possible Tags😮...

Let's use the dev branch to test some Tags and see what the returned values are and how usefull they might be for users.

Some general information Tags

WB_STATUS	E800004
WB_ERROR_CODE	E800005
WB_MODE	E800006
WB_APP_SOFTWARE	E800007
WB_BOOTLOADER_SOFTWARE	E800008
WB_HW_VERSION	E800009
WB_FLASH_VERSION	E80000A
WB_DEVICE_ID	E80000B
WB_PM_MODE	E800011
WB_PM_DEVICE_ID	E800015
WB_PM_ERROR_CODE	E800016
WB_PM_FIRMWARE_VERSION	E800017
WB_PM_DEVICE_STATE	E800029
WB_FIRMWARE_VERSION	E80002F
WB_DEVICE_NAME	E800042

Some power related Tags

WB_AVAILABLE_SOLAR_POWER	E841000
WB_SUN_MODE_ACTIVE	E841038

Some network related Tags

WB_MAC_ADDRESS	E841022
WB_GATEWAY	E841031
WB_SUBNET_MASK	E841032
WB_IP_ADDR	E841033
WB_DHCP_ENABLED	E841034
WB_WALLBOX_TYPE	E841036

Would be cool, if you could implement them for testing.
Or let me know, how I need to modify the code to implement them in my local copy for testing the Tags.

SOC changing to zero every about 13 min 20 s while solar power is zero

Hi there again,

sorry to come up with another issue. I am wondering about the topic e3dc/battery/soc changing to 0 every 13 min 20 s (nearly exactly, plus/minus a few seconds). It is looking a bit strange in Home Assistant (the lower graph in the following picture).

grafik

This issue is not a new one - but until now I suspected the reason to be in Home Assistant. Only since I did some analytics of the mqtt messages I found out that it seems to be rscp2mqtt related. This behaviour can only be observed while there is no solar power (e3dc/solar/power = 0). Or in other words: As soon as the sun is shining there are no jumps in the soc value, visible on the left side of the diagram screenshot.

As well, after upgrading to v3.12 I noticed that e3dc/battery/rsoc is changing from the rsoc to the soc value from time to time (that is the upper graph) - and vice versa (and this behaviour is new with v3.12). I checked the values with RSCPGui, also refreshed the values at that moment when e3dc/battery/soc changed to zero (that was for about 1-3 intervals with INTERVAL=3, then back to the correct value). RSCPGui does not show these jumps, even if I force updates as soon as I observe the value jumps via mqtt. Weirdly, before upgrading rscp2mqtt, the rsoc value was always identical to the soc value - only that the rsoc value had one decimal (i.e. 23.5%) while soc always are published as integer value (i.e. 23 %).

I did not dive into the source code too deeply (since I am not a skilled programmer) but possibly there is a double definition of some mqtt topics in RscpMqttMapping.h in block

// CONTAINER TAG_DB_HISTORY_DATA_...
// TODAY

(Possibly in that block there is a missing "today/" prefix in the mqtt topics? But could not find anything in parallel to this regarding the soc jumps).

Best regards

Connection Error

Hi Thomas

Ich habe die Punkte von dir gestern umgestetzt. Ich habe einen Docker Container auf meiner Synology am laufen und erhalte nach dem Start die folgnede Ausgabe im Terminal

Beim Start habe ich folgendes im Log:
image

Ich bekomme dann aber Connection Error:

image

Mich erstaunt die Meldung cannot be converted.1.230. Dies sieht irgendwie wie Teile der IP

Im Config habe ich folgendes:

E3DC_IP=192.168.001.230
E3DC_PORT=5033
E3DC_USER=xxx
E3DC_PASSWORD=xxx
E3DC_AES_PASSWORD=xxx
MQTT_HOST=192.168.1.10
MQTT_PORT=1883
MQTT_AUTH=false
MQTT_USER=
MQTT_PASSWORD=
MQTT_QOS=0
MQTT_RETAIN=false
ENABLE_INFLUXDB=true
DISABLE_MQTT_PUBLISH=false
INFLUXDB_HOST=localhost
INFLUXDB_PORT=8086
INFLUXDB_VERSION=2
INFLUXDB_MEASUREMENT=e3dc
INFLUXDB_1_DB=e3dc
INFLUXDB_1_AUTH=false
INFLUXDB_1_USER=
INFLUXDB_1_PASSWORD=
INFLUXDB_2_ORGA=tognellacom
INFLUXDB_2_BUCKET=smartHome
INFLUXDB_2_TOKEN=xxx==
PREFIX=e3dc
LOGFILE=/tmp/rscp2mqtt.log
INTERVAL=1
PVI_REQUESTS=true
PVI_TRACKER=2
PM_REQUESTS=true
PM_EXTERN=false
DCB_REQUESTS=true
AUTO_REFRESH=false
WALLBOX=true
FORCE_PUB=e3dc/[a-z]+/power
FORCE_PUB=e3dc/battery/rsoc
FORCE_PUB=e3dc/pvi/.*/string_[1,2]

Ich sehe den Fehler nicht. Ich habe eine S10X mit Zusatzwechselrichter

Automatic detection of the number of PVI trackers not detection 2nd PVI tracker

Hi there,

I'm using rscp2mqtt with an S10E, latest firmware (Q4/2023). Until rscp2mqtt v3.9 everything works fine. But from 3.10 the second PVI tracker is no longer delivering values other than zero - 0 voltage, 0 current and 0 power on the 2nd string (which is forced to be published by "FORCE_PUB=e3dc/pvi/.*/string_[1,2]" in .config).

Since PVI_TRACKER in .config does not seem to work any longer, I'm missing the second string with >=v3.10. You probably aim to get the autodetection to work - but may I suggest: If PVI_TRACKER is not defined in .config, rscp2mqtt tries auto detection, but if it's defined, it overrides auto detection?

Your great work is very much appreciated!

Wunsch: Wallbox Energy per day

Hallo Thomas,

deine Applikation ist echt super und dein Support perfekt.
Einen Wunsch hätte ich noch, kannst du das gleiche wie bei den Solarstrings auch für die Wallbox machen, energy_total_day und energy_solar_day?
Da gibt es ja schon Topics, die einen enthalten aber nur die letzte Ladung und die anderen die Gesamtladung.

Gruß Sven

ENERGY per String

Hi,

short question, is it possible to select the e3dc/pvi/energy/string_x (today) instead off e3dc/pvi/energy_all/string_x (all time)?

This would be great!

Thx

problem when switching true / false does not work

Hello,

Thank you for the bridge and the good documentation.
I have a problem switching the power limits in W works.

However, if I want to switch the power limits or the weather regulation, it doesn't work.

What can be the reason?

e3dc/set/max_charge_power -> works
e3dc/set/weather_regulation -> it does not work
e3dc/set/power_limits -> it does not work

I have an S 10 X and switch out of IP Sycmon.

I haven't tested more yet.

Thanks and Regards

P.S. Sorry for my bad English, German would be better.

Wallbox data

I love your tool and would like to know if there are any plans to query wallbox data?

Connection issue "RscpMqttMain.cpp(1143) RSCP authentitication level 0"

Hi Thomas,
vielen Dank für Dein Modul (die Anleitung von e3DC ist ja ziemlich wild...)

Allerdings passt was mit meiner Connection noch nicht. Das Ganze läuft unter Docker compose.

  • Die Initiale Verbindung klappt
  • Ich bekomme auch zwei MQTT Meldungen (Battery, Grid)
  • Aber dann ist Ruhe...

Any hints? Vermute mal irgendwas in Richtung authorization oder reset connection?
VG timmo

Ich bekomme im Portainer log folgende Meldungen:
Log:

/rscp2mqtt [v3.8]
Connecting...
E3DC system >192.168.178.58:5033< user: >my.name<
MQTT broker >localhost:1883< qos = 0 retain = false
MQTT prefix: >e3dcrscp <
History year 2017 to 2023
Fetching data every 10 seconds.
Requesting PVI data = true (2 strings/trackers)
Requesting PM data = true
Requesting DCB (battery module) data = true
Battery SOC limiter active = false
Wallbox support = true
Auto refresh mode = false
Stdout to terminal

[2023-12-10 13:22:44] pid=1 ppid=0 RscpMqttMain.cpp(1970) Connecting to server 192.168.178.58:5033
[2023-12-10 13:22:44] pid=1 ppid=0 RscpMqttMain.cpp(1977) Success: E3DC connected.
[2023-12-10 13:22:44] pid=1 ppid=0 RscpMqttMain.cpp(725) Request authentication (1702210964)
[2023-12-10 13:22:46] pid=1 ppid=0 RscpMqttMain.cpp(1143) RSCP authentitication level 0
[2023-12-10 13:22:46] pid=1 ppid=0 RscpMqttMain.cpp(1622) Connecting to broker localhost:1883
[2023-12-10 13:22:46] pid=1 ppid=0 RscpMqttMain.cpp(1633) Error: Connection failed.
[2023-12-10 13:22:56] pid=1 ppid=0 RscpMqttMain.cpp(725) Request authentication (1702210976)
[2023-12-10 13:22:59] pid=1 ppid=0 RscpMqttMain.cpp(1143) RSCP authentitication level 0
[2023-12-10 13:22:59] pid=1 ppid=0 RscpMqttMain.cpp(1622) Connecting to broker localhost:1883
[2023-12-10 13:22:59] pid=1 ppid=0 RscpMqttMain.cpp(1631) Success: MQTT broker connected.
MQTT publish topic >e3dcrscp /battery/state< payload >EMPTY< unit ><
[2023-12-10 13:22:59] pid=1 ppid=0 RscpMqttMain.cpp(266) MQTT: starting listener loop
MQTT publish topic >e3dcrscp /grid/state< payload >IN< unit ><
[2023-12-10 13:23:09] pid=1 ppid=0 RscpMqttMain.cpp(725) Request authentication (1702210989)
[2023-12-10 13:23:12] pid=1 ppid=0 RscpMqttMain.cpp(1511) Error: Response receive timeout (retry)
[2023-12-10 13:23:22] pid=1 ppid=0 RscpMqttMain.cpp(725) Request authentication (1702211002)
[2023-12-10 13:23:22] pid=1 ppid=0 RscpMqttMain.cpp(1143) RSCP authentitication level 0
[2023-12-10 13:23:32] pid=1 ppid=0 RscpMqttMain.cpp(725) Request authentication (1702211012)
[2023-12-10 13:23:32] pid=1 ppid=0 RscpMqttMain.cpp(1143) RSCP authentitication level 0
[2023-12-10 13:23:42] pid=1 ppid=0 RscpMqttMain.cpp(725) Request authentication (1702211022)
[2023-12-10 13:23:42] pid=1 ppid=0 RscpMqttMain.cpp(1143) RSCP authentitication level 0
[2023-12-10 13:23:52] pid=1 ppid=0 RscpMqttMain.cpp(725) Request authentication (1702211032)
[2023-12-10 13:23:52] pid=1 ppid=0 RscpMqttMain.cpp(1143) RSCP authentitication level 0
[2023-12-10 13:24:02] pid=1 ppid=0 RscpMqttMain.cpp(725) Request authentication (1702211042)
[2023-12-10 13:24:02] pid=1 ppid=0 RscpMqttMain.cpp(1143) RSCP authentitication level 0
[2023-12-10 13:24:12] pid=1 ppid=0 RscpMqttMain.cpp(725) Request authentication (1702211052)
[2023-12-10 13:24:12] pid=1 ppid=0 RscpMqttMain.cpp(1143) RSCP authentitication level 0
[2023-12-10 13:24:22] pid=1 ppid=0 RscpMqttMain.cpp(725) Request authentication (1702211062)
[2023-12-10 13:24:22] pid=1 ppid=0 RscpMqttMain.cpp(1143) RSCP authentitication level 0

(etc.)

.config File:

// IP address of the E3/DC S10 device
E3DC_IP=192.168.178.58
// Port of the E3/DC S10 device, default is 5033
E3DC_PORT=5033
// E3/DC account
E3DC_USER=my.name
E3DC_PASSWORD=my.PW
// AES password
E3DC_AES_PASSWORD=my.AESPW
// Target MQTT broker
MQTT_HOST=localhost
// Default port is 1883
MQTT_PORT=1883
// MQTT user / password authentication necessary? Depends on the MQTT broker configuration.
MQTT_AUTH=false
// if true, then enter here
MQTT_USER=
MQTT_PASSWORD=
// MQTT parameters
MQTT_QOS=0
MQTT_RETAIN=false
// Topic prefix (max 24 characters), default is e3dc
PREFIX=e3dcrscp
// log file
LOGFILE=/tmp/rscp2mqtt.log
// history start year (installation of the E3/DC device)
HISTORY_START_YEAR=2017
// log file for selected topics
TOPIC_LOG_FILE=/tmp/rscp2mqtt.history
// selected topics for logging (regular expressions)
TOPIC_LOG=e3dc/history/.*
TOPIC_LOG=e3dc/system/software
// Interval requesting the E3/DC S10 device in seconds (1..10)
INTERVAL=10
// enable PVI requests, default is true
PVI_REQUESTS=true
// number of available PV strings(trackers), default is 2
PVI_TRACKER=2
// enable PM requests, default is true
PM_REQUESTS=true
// use external PM (S10 Mini), default is false
PM_EXTERN=false
// enable DCB (details for battery modules) requests, default is true
DCB_REQUESTS=true
// enable battery SOC limiter, default is false
SOC_LIMITER=false
// Auto refresh, default is false
AUTO_REFRESH=false
// Disable MQTT publish support (dryrun mode)
DISABLE_MQTT_PUBLISH=false
// Wallbox, default is false
WALLBOX=true
// topics to be published in each cycle (regular expressions)
FORCE_PUB=e3dc/[a-z]+/power
FORCE_PUB=e3dc/battery/soc

Docker Compose

rscp2mqtt:
container_name: "rscp2mqtt"
image: pvtom/rscp2mqtt:latest-with-influxdb
restart: unless-stopped
environment:
- TZ=Europe/Berlin
volumes:
- ./volumes/rscp2mqtt/.config:/opt/rscp2mqtt/.config
network_mode: "host"
stdin_open: true
tty: true

Probleme mit Battery_to_car

Hi,

{ 0, TAG_EMS_REQ_SET_BATTERY_BEFORE_CAR_MODE, "e3dc/set/wallbox/battery_before_car", "^true|on|1$", "1", "^false|off|0$", "0", "", RSCP::eTypeUChar8, -1, true },

ich habe noch Probleme mit dieser Zeile. Wenn ich am Speicher die Einstellung ändere bekomme ich
0 = zuerst Wallbox
1 = zuerst Hausbatterie

Das gleiche Ergebnis, erhalte ich, wenn ich über das E3DC Portal schalte.

Sende ich über MQTT eine 0 wird auf "zuerst Wallbox" geschaltet.
Sende ich über MQTT eine 1 wird auch auf "zuerst Hausbatterie" geschaltet. ABER. Leider nicht immer. Ich kann manchmal mehrmals hintereinander umschalten, manchmal bleibt aber der Wert immer bei "zuerst Wallbox". In diesem Zustand komme ich nur raus, wenn ich am Speicher oder per Portal auf "zuerst Hausbatterie" schalte.

Danach klappen die Umschaltvorgänge meistens wieder für kurze zeit. Hast Du da eine idee?

feat | Logging to stdout / stderr

Hi @pvtom,
vielen Dank für das coole Projekt. Ich würde rscp2mqtt gerne als Container bereitstellen um es als Add-On in Home Assistant OS bereitzustellen. Voraussetzung für das Deployment in Containern ist, dass das Logging nicht in ein Logfile geschieht, sondern nach stdout und stderr. Warum das so ist wird erklärt in https://12factor.net/logs / https://12factor.net/de/logs
Wäre es ein großer Aufwand, nach stdout und stderr zu loggen, wenn zum Beispiel LOGFILE= leer gelassen wird?

Detailed historical consumption from e3DC

Hi Tom,
noch zwei Fragen zu den historischen Werten:

Die e3DC liefert ja werte für "yesterday", "week", "month", "year". Weiterhin gibt es das Topic "history" nach Jahren geordnet.

  • Gibt es auch die Tageswerte über die gesamte Laufzeit? (Oder macht die e3DC eine Aggregation und wirft die Messwerte dann weg?). Das Portal zeigt diese Werte an, wenn ich mich richtig erinnere.. vielleicht sind sie nicht in der Schnittstelle drin.
  • Gibt es einen Zeitstempel für diese Werte - "Yesterday" ist halt nur in Verbindung mit dem Lesezeitpunkt sinnvoll (geht in Grafana, ist aber nicht so schön...)

VG TImmo
(hoffe, dass das der richtige Kanal für solche Fragen ist - oder hast Du ein separates Forum?)

Question: Aktive Phasen der Wallbox setzen?

Hallo Thomas,

besteht die Möglichkeit, die Menge der Phasen (1 oder 3) zu setzen?
Ich nutze eine E3/DC Multi Connect Wallbox und schalte bisher manuell auf 1 Phase für die Überschussladung und auf 3 Phasen im Mischmodus.

Danke vorab und schöne Grüße
Dirk

Feature Request: power meter summaries

Recent version of rscp2mqtt offers great support for multiple power meters, with subsequent values for power, voltage, energy and active phases. Those provide individual values for phases L1, L2, L3.
Yet, at least power and energy readings make sense to be provided as a sum of L1+L2+L3, e.g. as value for title topic:
e3dc/pm/1/power = 1092 (W) or e3dc/pm/2/energy = 535.836 (kWh).
This releases subscribed applications from such highly repetetive calculations.
Maybe similar summaries also for topics in other paths, aside of power meters?

Btw. topics e3dc/pm_0/energy and e3dc/pm_1/energy are constantly 0.00. Same for those under historical topics.

Powermeter energy values float precision

Reading and interpreting powermeter values, I came across the wish to have kWh with float precision like 7.54 kWh. So far, TAG_PM_ENERGY_Lx deliver int kWh. I found my experience isn't good enough to change them to float, so I changed in RscpMqttMapping.h:
from { TAG_PM_DATA, TAG_PM_ENERGY_L1, 0, "%s/energy/L1", "", F_FLOAT_D, UNIT_WH, 1000, 0, false, false, false },
to { TAG_PM_DATA, TAG_PM_ENERGY_L1, 0, "%s/energy/L1", "", F_FLOAT_2, UNIT_WH, 1, 0, false, false, false },
...
(changing F_FLOAT_D to F_FLOAT_2 didn't help, it's still integer + the original is UNIT_KWH, but change also didn't help)
Depending on your preference, is there a chance to change this to float from your end, or help by pointing to the correct changes for me to apply?

RscpMqttMain.cpp(1930) Error: Maximum buffer size exceeded 69632

Hi Thomas

ich habe seit einiger Zeit diese Meldungen im Log, und das Schreiben auf die influx DB klappt nicht. Scheint, dass die Verbindung zum e3DC nicht klappt. Nach einem Neustart des Docker Containers geht's wieder einige Zeit.

Any hints?
VG timmo

Version:
org.opencontainers.image.version | v3.17-with-influxdb

[2024-03-23 13:57:08] pid=1 ppid=0 RscpMqttMain.cpp(2515) Connecting to server 192.168.178.58:5033
[2024-03-23 13:57:08] pid=1 ppid=0 RscpMqttMain.cpp(2522) Success: E3DC connected.
[2024-03-23 13:57:08] pid=1 ppid=0 RscpMqttMain.cpp(1930) Error: Maximum buffer size exceeded 69632

Nach dem Restart des Docker Containers kommen folgende Logs, In influx kommen wieder Daten an:

rscp2mqtt [v3.17.influxdb]
E3DC system >192.168.178.58:5033< user: >(private)<
MQTT broker >localhost:1883< qos = >0< retain = >false< client id >✗< prefix >e3dc<
INFLUXDB v2 >localhost:8086< orga = >home< bucket = >e3dc_new< measurement = >e3dc<
Fetching data every 15 seconds.
Requesting PVI ✓ | PM (0) | DCB ✓ (1 battery string) | Wallbox (0) ✓ | Autorefresh ✗
Log level = 0
Stdout to pipe/file
[2024-03-23 14:00:39] pid=1 ppid=0 RscpMqttMain.cpp(2515) Connecting to server 192.168.178.58:5033
[2024-03-23 14:00:39] pid=1 ppid=0 RscpMqttMain.cpp(2522) Success: E3DC connected.
[2024-03-23 14:00:39] pid=1 ppid=0 RscpMqttMain.cpp(1533) RSCP authentication level 10
[2024-03-23 14:00:39] pid=1 ppid=0 RscpMqttMain.cpp(2063) Connecting to broker localhost:1883
[2024-03-23 14:00:39] pid=1 ppid=0 RscpMqttMain.cpp(313) MQTT: starting listener loop
[2024-03-23 14:00:39] pid=1 ppid=0 RscpMqttMain.cpp(2075) Success: MQTT broker connected.
[2024-03-23 14:00:44] pid=1 ppid=0 RscpMqttMain.cpp(1943) Error: Response receive timeout (retry)
[2024-03-23 14:00:48] pid=1 ppid=0 RscpMqttMain.cpp(1943) Error: Response receive timeout (retry)

Setting reserve to 100% doesn't work

Hallo Thomas,

wenn man bei der E3DC-Anlage die Reserve auf 100 % setzen möchte ("e3dc/set/reserve/percent 100"), dann reagiert die Anlage nicht. Bei Werten von 0 bis 99 funktioniert es. Ist das ein Bug bei rscp2mqtt oder liegt es an E3DC?

Gruß,
Oli

missing some Wallboxdata

Thank you for including the wallboxdata.

but I am missing two Datapoints.

To access them, we need to set "TAG_EMS_BATTERY_BEVORE_CAR_MODE" and "TAG_EMS_BATTERY_TO_CAR_MODE". Here we can enter the discharge level of the battery in sunmode. Maybe you have an clu how we get the data?

The 2nd Datapoint is to dis/allow to discharge the battery in mixed mode.
Best regards
Wallbox

How to expand the code with other RSCP tags?

I am also using rscpgui (https://github.com/rxhan/RSCPGui) to get familiar with RSCP communication to my E3DC S10E System. As you might know, this project has some more (maybe officially undocumented) tags implemented.
Escpecially I would be interested to to get some basic information about the installed battery capacity, etc.

    BAT_SPECIFIED_CAPACITY = 0x03800125
    BAT_SPECIFIED_DSCHARGE_POWER = 0x03800126
    BAT_SPECIFIED_CHARGE_POWER = 0x03800127
    BAT_SPECIFIED_MAX_DCB_COUNT = 0x03800128
    BAT_ROLE = 0x03800129

I already tried, but I failed, to implement other RSCP tags into your code.
My attempt was to define a new tag into RscpTags.h and then add a mapping into RscpMqttMapping.h, but I failed.

Can you help me?

Influxdb2 - Definition von topic

Hi Tom
noch eine Frage - bei der Configuration von Influxdb2 schreibt das Modul einfach alle Daten in die DB (Klappt prima).

Gibt es eine Möglichkeit, hier nur ausgewählte Topics (entlang von FORCEPUB - aber halt als PUB2INFLUX) zu schreiben - oder empfiehlst Du, dann über den MQTT Broker zu gehen, und Telegraf die Auswahl zu überlssen?

Viele Grüße - Timmo

Make run into an error

hello,

i would try to compile your latest version under Raspbian Buster and on a x86/x64 system Ubuntu focal (20.04) and jammy (22.04), but run into this error.

rm: cannot remove 'rscp2mqtt': No such file or directory
make: [Makefile:11: clean] Error 1 (ignored)
g++ -O3 RscpMqttMain.cpp RscpProtocol.cpp AES.cpp SocketConnection.cpp -lmosquitto -o rscp2mqtt
RscpMqttMain.cpp: In function ‘int createRequest(SRscpFrameBuffer*)’:
RscpMqttMain.cpp:308:104: error: ‘config_t’ {aka ‘struct _config_t’} has no member named ‘logfile’
 (it->topic, "e3dc/set/log")) logCache(RSCP_MQTT::RscpMqttCache, cfg.logfile, buffer);
                                                                     ^~~~~~~

RscpMqttMain.cpp: In function ‘int main(int, char**)’:
RscpMqttMain.cpp:689:16: error: ‘config_t’ {aka ‘struct _config_t’} has no member named ‘logfile’
     strcpy(cfg.logfile, "");
                ^~~~~~~
RscpMqttMain.cpp:720:28: error: ‘config_t’ {aka ‘struct _config_t’} has no member named ‘logfile’
                 strcpy(cfg.logfile, value);
                            ^~~~~~~

make: *** [Makefile:7: rscp2mqtt] Error 1

Any ideas?

best regards

Timouts...

Hi Tom,

probiere mal wieder... bin jetzt erstmal ohne Docker unterwegs. Funktioniert soweit, ich bekomme nur ab und an Timeouts.. kannst Du sagen, was den Timeout erzeugt (e3dc, influx etc?)

pi@sturmserver:/opt/rscp2mqtt $ ./rscp2mqtt
rscp2mqtt [v3.19]
E3DC system >192.168.178.58:5033< user: >Timmo.Sturm<
MQTT broker >localhost:1883< qos = >0< retain = >false< client id >✗< prefix >e3dc<
Fetching data every 10 seconds.
Requesting PVI ✓ | PM (0) | DCB ✓ (1 battery string) | Wallbox (0) ✓ | Autorefresh ✗
Log level = 1
Stdout to terminal

[2024-04-14 13:12:23] pid=1067620 ppid=982363 RscpMqttMain.cpp(2717) Connecting to server 192.168.178.58:5033
[2024-04-14 13:12:23] pid=1067620 ppid=982363 RscpMqttMain.cpp(2724) Success: E3DC connected.
[2024-04-14 13:12:23] pid=1067620 ppid=982363 RscpMqttMain.cpp(1688) RSCP authentication level 10
[2024-04-14 13:12:23] pid=1067620 ppid=982363 RscpMqttMain.cpp(2221) Connecting to broker localhost:1883
[2024-04-14 13:12:23] pid=1067620 ppid=982363 RscpMqttMain.cpp(2233) Success: MQTT broker connected.
[2024-04-14 13:12:23] pid=1067620 ppid=982363 RscpMqttMain.cpp(345) MQTT: starting listener loop
[2024-04-14 13:12:24] pid=1067620 ppid=982363 RscpMqttMain.cpp(1806) Error: Container 0x02840000 Tag 0x02000060 received error code 6.
[2024-04-14 13:12:24] pid=1067620 ppid=982363 RscpMqttMain.cpp(1806) Error: Container 0x02840000 Tag 0x02000070 received error code 6.
[2024-04-14 13:12:24] pid=1067620 ppid=982363 RscpMqttMain.cpp(1806) Error: Container 0x02840000 Tag 0x02000080 received error code 6.
[2024-04-14 13:12:28] pid=1067620 ppid=982363 RscpMqttMain.cpp(2100) Error: Response receive timeout (retry)
[2024-04-14 13:12:32] pid=1067620 ppid=982363 RscpMqttMain.cpp(2100) Error: Response receive timeout (retry)

meine config:

#-E3DC Access
#--IP address and port of your home power station
E3DC_IP=192.168.178.58
E3DC_PORT=5033

#--your E3/DC web account and the RSCP/AES password configured in the device (Issue #31)
E3DC_USER={private}
E3DC_PASSWORD={private}
E3DC_AES_PASSWORD={private}

#-MQTT Broker
#--Name or IP address and port of your MQTT broker
MQTT_HOST=localhost
MQTT_PORT=1883
#--MQTT parameters
MQTT_CLIENT_ID=
MQTT_QOS=0
MQTT_RETAIN=false
#--MQTT authentication if necessary set MQTT_AUTH=true and enter user and password
MQTT_AUTH=false
MQTT_USER=
MQTT_PASSWORD=

#-System
#--cycle interval in seconds (max 300 seconds)
INTERVAL=10
#--log level, set "1" to get detailled logging
LOG_LEVEL=1
#--log files
LOGFILE=/tmp/rscp2mqtt.log
TOPIC_LOG_FILE=/tmp/rscp2mqtt.history
#--dry run
DISABLE_MQTT_PUBLISH=false
#--set power mode
AUTO_REFRESH=false
#--Start of Operation
HISTORY_START_YEAR=2017
#--Request daily historical values
DAILY_VALUES=true
#--Publish statistic values
STATISTIC_VALUES=true

#-MQTT Topics
#--Topic prefix (max 24 characters), default is e3dc
PREFIX=e3dc

#-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)
PM_EXTERN=false
PM_INDEX=0
PM_REQUESTS=true

#-Photovoltaic Inverter
PVI_REQUESTS=true
#--Number of PVI strings/trackers (disables the auto detection)
PVI_TRACKER=2

#-Battery Settings
#--Number of Battery Strings, default is 1
BATTERY_STRINGS=1
#--Battery Modules
DCB_REQUESTS=true

#-Battery SOC limiter
#SOC_LIMITER=true
#LIMIT_CHARGE_SOC=0
#LIMIT_DISCHARGE_SOC=0
#LIMIT_CHARGE_DURABLE=false
#LIMIT_DISCHARGE_DURABLE=false
#LIMIT_DISCHARGE_BY_HOME_POWER=0

#-Wallbox Support for the wallbox with the specified index
#--only one WB_INDEX entry is supported, default is 0
WALLBOX=true
WB_INDEX=0

#-Forced Topics
#--will be published with every cycle
FORCE_PUB=e3dc/[a-z]+/power
#FORCE_PUB=e3dc/pvi/.*/string_[1,2]
FORCE_PUB=e3dc/solar/energy
FORCE_PUB=e3dc/battery/soc
FORCE_PUB=e3dc/battery/energy/discharge
FORCE_PUB=e3dc/battery/energy/charge
FORCE_PUB=e3dc/home/energy
FORCE_PUB=e3dc/grid/energy/in
FORCE_PUB=e3dc/grid/energy/out

#-Topic Logging
#--logging to extra log file configured by TOPIC_LOG_FILE
#TOPIC_LOG=e3dc/history/.*
#TOPIC_LOG=e3dc/battery/dcb/[1-4]/soh
#TOPIC_LOG=e3dc/system/software

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.