E3DC Energy Dashboard - weird spikes

Hello everyone,
for about 2 weeks i am using HA to track my E3DC-Devices (Solar Panel, Wallbox, Battery) via modbus.
However, I am having some troubles with the modbus connection to home assistant.
The first couple of days everything was working perfectly. 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. This is a cutout of the values i got for the e3dc_grid_export_power sensor this morning:

datetime 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') }}"

If you still experience this problem, try my direct RSCP based integration, it should give you better access to the data of the E3DC than Modbus:

Feedback welcome.