E3DC in Energy Dashboard

Hello,
thank you very much everyone for sharing your configuration.
I am having some troubles with the modbus connection to home assistant.
The first couple of days everything was working perfectly. However, then i started to notice some weird spikes in the dashboard:

This spike occurs every day for the last week or so. At some days it even reaches about 20kwh grid export at one hour in the morning, which does not make any sense. It also does not make sense, that the battery is charged at this time.

I looked into the home-assistant database values for further investigation. These is a cutout of the values i got for the e3dc_grid_export_power sensor this morning:

datetime(last_updated_ts, ‘unixepoch’, ‘localtime’) state
2023-02-07 03:25:39 8
2023-02-07 03:25:41 4
2023-02-07 03:25:43 1
2023-02-07 03:25:45 8
2023-02-07 03:25:47 1
2023-02-07 03:25:49 13
2023-02-07 03:25:51 0
2023-02-07 03:25:57 5
2023-02-07 03:25:59 4
2023-02-07 03:26:01 0
2023-02-07 05:53:35 1968
2023-02-07 05:53:37 0
2023-02-07 05:53:47 5
2023-02-07 05:53:49 0
2023-02-07 05:53:51 46
2023-02-07 05:53:53 0
2023-02-07 05:53:55 11
2023-02-07 05:53:57 3
2023-02-07 05:53:59 0
2023-02-07 05:54:01 15
2023-02-07 05:54:03 78
2023-02-07 05:54:05 0
2023-02-07 05:54:13 2
2023-02-07 05:54:15 1
2023-02-07 05:54:17 0
2023-02-07 05:54:19 51
2023-02-07 05:54:21 0
2023-02-07 05:54:23 22
2023-02-07 05:54:25 20
2023-02-07 05:54:27 0
2023-02-07 05:54:29 17
2023-02-07 05:54:31 0
2023-02-07 05:54:35 16
2023-02-07 05:54:37 10
2023-02-07 05:54:39 2
2023-02-07 05:54:41 0
2023-02-07 05:54:47 40
2023-02-07 05:54:49 0
2023-02-07 05:54:51 13
2023-02-07 05:54:53 0
2023-02-07 05:54:55 3
2023-02-07 05:54:57 20
2023-02-07 05:54:59 13
2023-02-07 05:55:01 9
2023-02-07 05:55:03 0
2023-02-07 05:55:13 40
2023-02-07 05:55:15 16
2023-02-07 05:55:17 0
2023-02-07 05:55:19 9
2023-02-07 05:55:21 0

As you can see, there are no values for about 2 hours, and then an extreme spike.

However, i could not figure out, where this is coming from and how to solve this problem.
Is anyone else having this problem or knows a fix for this problem?
Thank you very much!

Here are my configuration files:

Modbus.yaml

- name: "E3DC"
  type: tcp
  host: 192.168.0.189
  port: 502
  retry_on_empty: true
  sensors:
    - name: E3DC Serial Number
      unique_id: e3dc_serial_number
      address: 40035
      data_type: string
      count: 8
      scan_interval: 86400
    - name: E3DC Model
      unique_id: e3dc_model
      address: 40019
      data_type: string
      count: 8
      scan_interval: 86400
    - name: E3DC Manufacturer
      unique_id: e3dc_manufacturer
      address: 40003
      data_type: string
      count: 8
      scan_interval: 86400
    - name: E3DC Firmware
      unique_id: e3dc_firmware
      address: 40051
      data_type: string
      count: 8
      scan_interval: 86400
    - name: E3DC Modbus Firmware
      unique_id: e3dc_modbus_firmware
      address: 40001
      data_type: uint16
      scan_interval: 86400
    - name: E3DC Solar Power
      unique_id: e3dc_solar_power
      unit_of_measurement: W
      data_type: int16
      address: 40067
      device_class: power
      scan_interval: 2
    - name: E3DC Wallbox Power
      unit_of_measurement: W
      data_type: int16
      address: 40077
      device_class: power
      scan_interval: 2
    - name: E3DC Battery Power
      unique_id: e3dc_battery_power
      unit_of_measurement: W
      address: 40069
      data_type: int16
      device_class: power
      scan_interval: 2
    - name: E3DC Battery State of Charge
      unique_id: e3dc_battery_state_of_charge
      unit_of_measurement: '%'
      address: 40082
      data_type: uint16
      device_class: battery
      scan_interval: 30
    - name: E3DC Power Consumption House
      unique_id: e3dc_house_consumption_power
      unit_of_measurement: W
      data_type: int16
      address: 40071
      device_class: power
      scan_interval: 2
    - name: E3DC Grid Power
      unique_id: e3dc_grid_power
      unit_of_measurement: W
      data_type: int16
      address: 40073
      device_class: power
      scan_interval: 2
    - name: E3DC Emergency Power State
      unique_id: e3dc_emergency_power_state
      data_type: int16
      address: 40083
      scan_interval: 10
    - name: E3DC Autarky and Consumption
      unique_id: e3dc_autarky_and_consumption
      data_type: uint16
      address: 40081
      scan_interval: 60
    - name: E3DC String 1 Power
      unique_id: e3dc_string_1_power
      data_type: uint16
      address: 40101
      device_class: power
      unit_of_measurement: W
      scan_interval: 10
    - name: E3DC String 2 Power
      unique_id: e3dc_string_2_power
      data_type: uint16
      address: 40102
      device_class: power
      unit_of_measurement: W
      scan_interval: 10
    - name: E3DC String 1 Voltage
      unique_id: e3dc_string_1_voltage
      data_type: uint16
      address: 40095
      device_class: voltage
      unit_of_measurement: V
      scan_interval: 10
    - name: E3DC String 2 Voltage
      unique_id: e3dc_string_2_voltage
      data_type: uint16
      address: 40096
      device_class: voltage
      unit_of_measurement: V
      scan_interval: 10
    - name: E3DC String 1 Current
      unique_id: e3dc_string_1_current
      data_type: uint16
      address: 40098
      device_class: current
      unit_of_measurement: A
      scale: 0.01
      precision: 2
      scan_interval: 10
    - name: E3DC String 2 Current
      unique_id: e3dc_string_2_current
      data_type: uint16
      address: 40099
      device_class: current
      unit_of_measurement: A
      scale: 0.01
      precision: 2
      scan_interval: 10
    - name: E3DC Powermeter 1 L1-L3
      unique_id: e3dc_powermeter_1
      data_type: int16
      address: 40105
      device_class: power
      unit_of_measurement: W
      scan_interval: 10
    - name: E3DC Powermeter 1 L1
      unique_id: e3dc_powermeter_1_L1
      data_type: int16
      address: 40106
      device_class: power
      unit_of_measurement: W
      scan_interval: 10
    - name: E3DC Powermeter 1 L2
      unique_id: e3dc_powermeter_1_L2
      data_type: int16
      address: 40107
      device_class: power
      unit_of_measurement: W
      scan_interval: 10
    - name: E3DC Powermeter 1 L3
      unique_id: e3dc_powermeter_1_L3
      data_type: int16
      address: 40108
      device_class: power
      unit_of_measurement: W
      scan_interval: 10

sensors.yaml

- platform: integration
  source: sensor.e3dc_grid_import_power
  name: E3DC Grid Import Energy
  unit_prefix: k
  round: 2
- platform: integration
  source: sensor.e3dc_grid_export_power
  name: E3DC Grid Export Energy
  unit_prefix: k
  round: 2
- platform: integration
  source: sensor.e3dc_solar_power
  name: E3DC Solar Energy
  unit_prefix: k
  round: 2
- platform: integration
  source: sensor.e3dc_wallbox_power
  name: E3DC Wallbox energy
  unit_prefix: k
  round: 2
- platform: integration
  source: sensor.e3dc_battery_power
  name: E3DC Builtin Battery Energy
  unit_prefix: k
  round: 2
- platform: integration
  source: sensor.e3dc_battery_charge_power
  name: E3DC Battery Charge Energy
  unit_prefix: k
  round: 2
- platform: integration
  source: sensor.e3dc_battery_discharge_power
  name: E3DC Battery Discharge Energy
  unit_prefix: k
  round: 2

- platform: template
  sensors:
    e3dc_grid_export_power:
      unique_id: e3dc_grid_export_power
      friendly_name: E3DC Grid Export Power
      unit_of_measurement: W
      device_class: power
      value_template: >
        {% if states('sensor.e3dc_grid_power') | int > 0 %}
          0
        {% else -%}
          {{ (states('sensor.e3dc_grid_power') | int) | abs }}
        {% endif %}
    e3dc_grid_import_power:
      unique_id: e3dc_grid_import_power
      friendly_name: E3DC Grid Import Power
      unit_of_measurement: W
      device_class: power
      value_template: >
        {% if states('sensor.e3dc_grid_power') | int > 0 %}
          {{ states('sensor.e3dc_grid_power') }}
        {% else -%}
          0
        {% endif %}
    e3dc_battery_charge_power:
      unique_id: e3dc_battery_charge_power
      friendly_name: E3DC Battery Charging Power
      unit_of_measurement: W
      device_class: power
      value_template: >
        {% if states('sensor.e3dc_battery_power') | int >= 0 %}
          {{ states('sensor.e3dc_battery_power') }}
        {% endif %}
    e3dc_battery_discharge_power:
      unique_id: e3dc_battery_discharge_power
      friendly_name: E3DC Battery Discharging Power
      unit_of_measurement: W
      device_class: power
      value_template: >
        {% if states('sensor.e3dc_battery_power') | int <= 0 %}
          {{ (states('sensor.e3dc_battery_power') | int) | abs }}
        {% endif %}
    e3dc_autarky:
      friendly_name: 'E3DC Autarky'
      unique_id: e3dc_autarky
      unit_of_measurement: '%'
      value_template: "{{ (states('sensor.e3dc_autarky_and_consumption')|int / 256)|round(0,'floor') }}"
    e3dc_own_consumption:
      friendly_name: 'E3DC Own Consumption ratio'
      unique_id: e3dc_own_consumption_ratio
      unit_of_measurement: '%'
      value_template: "{{ ((states('sensor.e3dc_autarky_and_consumption')|int / 256 - states('sensor.e3dc_autarky')|int) * 256)|round(0,'floor') }}"

Hello,
first of all thanks for the configs.
Everything worked fine for me.
I uploaded my config with explanation on Github.
Here is the link: GitHub - MrIceman11/e3dc-homeassistant: ADD e3dc Data to your HomeAssistant

1 Like

This is really strange - IT WORKS - but why? reading the Modbus manual is telling me

So what is this register-number-shift doing? Is it common knowledge to substract 1 and set to Int16?

To eliminate the “spikes” try to change the method of the “Riemann sum integral”-Integration to left. Add the following line to each integration-entry within sensors.yaml.

method: left

See Integration - Riemann sum integral - Home Assistant vor more details.

1 Like

Yes, the “shifting” is a part of modbus, depending on the implemented specification. HA has one implementation (without shifting) and E3DC the other (with shifting), so that’s why this does not match.
On the other hand, I think it should be an int32, altough I guess nobody of us needs the int32 size for the solar power.

1 Like

Hey Guys,

maybe one of you can help… I got my E3DC S10 Pro running with modbus in HA. All works fine, but i´ve got 2 E3DC wallboxes. With the modbus address “40077” I get the power of both wallboxes. Can someone tell me how to get the power of each wallbox seperate?

Thanks!

Dear All.
I am sorry to add this kind of tread.
It seams that you all find a solution with Home Assistant. So now - I will start do Install it on my PC.

And of cause i might have to ask you all what is to do to let E3DC run.

Regards Carsten

Dear Julian.
Manby Thanks for your link - but it might have a mistake.
You sayed Copy (generate) die Files into folder “…e3dc”.
But for this Case I do not have a File “modbus.yaml” in “Package”.
It might be something like

  • name: “e3dc”
    type: tcp
    host: < your E3DCs ip here >
    port: 502
    retry_on_empty: true

Regards

You are right, it is packages/e3dc/modbus.yaml. Modify that file.

Hi,
you are right. Will updated it.

Thanks

Good morning, found this thread and trying to setup HASS with my E3DC. Until now i had only the cloud access so i want to show it up in my dashboard.

I get errors - connection refused. So obvious HA is not able to connect to the IP where my E3DC is to be found.

So now i am guessing, are there any settings in the E3DC that i have to make so it is allowed to connect?
(can not find any in the E3DC Cloud dash).

Anyone who can point me out in the right direction?


2023-06-05 04:50:04.194 ERROR (SyncWorker_9) [pymodbus.logging] Connection to (192.168.XXX.XXX, 502) failed: [Errno 111] Connection refused
2023-06-05 04:50:04.230 ERROR (SyncWorker_9) [homeassistant.components.modbus.modbus] Pymodbus: E3DC: Modbus Error: [Connection] Failed to connect[ModbusTcpClient(192.168.XXX.XXX:502)]
2023-06-05 04:50:04.430 ERROR (SyncWorker_10) [pymodbus.logging] Connection to (192.168.XXX.XXX, 502) failed: [Errno 111] Connection refused
2023-06-05 04:50:04.451 ERROR (SyncWorker_6) [pymodbus.logging] Connection to (192.168.XXX.XXX, 502) failed: [Errno 111] Connection refused
2023-06-05 04:50:04.468 ERROR (SyncWorker_7) [pymodbus.logging] Connection to (192.168.XXX.XXX, 502) failed: [Errno 111] Connection refused
2023-06-05 04:50:04.516 ERROR (SyncWorker_2) [pymodbus.logging] Connection to (192.168.XXX.XXX, 502) failed: [Errno 111] Connection refused

I created the folder includes and added all the different files which can be found in this thread.

In modbus.yaml i have

- name: "E3DC"
  type: tcp
  host: 192.168.XXX.XXX
  port: 502
  retry_on_empty: true
  sensors:

Where the E3DC is to be found.

Running HA 2023.5.4

Okay found it. I had to activate the modbus in the S10 E AIO Pro 91 in the main menu. Now the modbus is connected and i get values. Very very cool.

Ich habe seit gut einer Woche das problem, das meine HA keine Daten mehr vom E3DC via Modbus empfängt. Das hat alles wunderbar auf anhieb funktioniert mit der “Anleitung”. Ich muß dazu sagen das ich absoluter Anfänger bin und mich jetzt erst seit knapp einen Monat mit HA beschäftige. Es war schon ein Erfolgserlebnis, dass das auf anhieb geklappt hatte. Schlimmer ist es daher, das ich nicht weiß woran es liegt, das ich die Daten nicht mehr abrufen kann.

Ich hab die Dateien bereits aus dem Ordner packages/E3DC/ entfernt und durch neue ersetzt! Natürlich habe ich die IP Adresse des E3DC wieder eingetragen

Ich habe neben der Version von MrIceman11 auch die HACS Integration am laufen, das hat auch beides Super funktioniert miteinander. Hab beide am laufen um zu sehen welche mir besser gefällt.

Aber auch bei der Version empfange ich viele Informationen nicht. “Nicht verfügbar” wird mir angezeigt.

Hm was ist denn da los - habt Ihr eine Idee?

I’ve had the problem for a week that my HA no longer receives any data from the E3DC via Modbus. It all worked wonderfully right away with the “instructions”. I have to say that I am an absolute beginner and have only been working with HA for about a month. It was a sense of achievement that it worked right away. It’s worse that I don’t know what’s wrong, that I can no longer retrieve the data.

I’ve already removed the files from the packages/E3DC/ folder and replaced them with new ones! Of course I entered the IP address of the E3DC again :wink:

In addition to the version of MrIceman11, I also have the HACS integration running, both of which worked great together. I’m running both to see which one I like better.

But even with the version I do not receive a lot of information. “Not available” is displayed to me.

Hm, what’s going on there - do you have an idea?

Hallo Hubertus,

du könntest mal probieren, die Register aus der E3DC Anlage direkt mittels eines Modbus Clients auszulesen, z.B. ModbusClientX - Modbus Tool download | SourceForge.net
Hier trägst Du bei der IP-Adresse die IP Deiner E3DC Anlage ein und klickst auf Connect.
Dann kannst Du z.B. ab der Staradresse 40000 mal 100 Adressen auslesen, sieht dann z.B. so aus:

Bei Register 40067 kannst Du dann z.B. die aktuelle Power. Durch einen erneuten Klick auf “Read from …” kannst Du die Werte aktualisieren.

Klappt das?

Ach ja, und welche HACS Integration hast du getestet?

Markus

1 Like

You might want to check my new RSCP based direct implemetation of the E3DC system:

It’s goal is to access the E3DC with its native protocol, give far more opportunities when working with it. Feedback welcome.

The values for model and firmware are displayed like this for some time.
image
Any idea what is the reason?

Were you able to resolve this? Pretty sure you’re reading the registers wrong (i.e. off by one and/or byte order is wrong). Can you post your configuration?

Hey there. Good work so far.

Just one additional question:
How can I get statistics for the following sensor:
sensor.e3dc_power_consumption_house

I can’t insert the sensor in a Statistics graph card.

cool, thanks for this integration. I always wanted to do the same thing, but never really found the time for it.
Since I didn’t want to spam your Github repo with a ticket for just a simple question, I thought I’d ask here. Why are the web interface credentials needed? I personally would prefer local communication only, but web credentials are mandatory in the setup wizard.

HI @da-anda

This is a limitation of the E3DC authentication. While it is online, it will always authenticate against E3DC cloud services. Everything else (the complete communication) is executed locally, I do not use the cloud client. The auth-relay is done by the E3DC unit, not my lib, to my knowledge there is no way around it. Pure local authentication is only possible in offline mode when the net is down.

We can have further disucssions in the topic of the integration, if you like:

Also, more details regarding the authentication are available on the pye3dc lib’s readme:

1 Like