Totally stuck with Energy integration, and frustrated too

backtick is different than a quote…sry :wink:

@Janneman
I already played with the thought of trying HACS once, But i thought because I am not really good with HA, maybe I should wait to begin with HACS :wink:
By the way your comprehension of the problem is spot on.

Following the link I provided earlier, your configuration would change to

substitutions:
  device_name: slimmelezer
  device_description: "DIY P1 module to read your smart meter"
     
esphome:
  name: ${device_name}
  comment: "${device_description}"
  platform: ESP8266
  esp8266_restore_from_flash: true
  board: d1_mini
  name_add_mac_suffix: false
  project:
    name: zuidwijk.slimmelezer
    version: "1.0"
  on_boot:
    then:
      - if:
          condition:
            lambda: return id(has_key);
          then:
            - lambda: |-
                std::string key(id(stored_decryption_key), 32);
                id(dsmr_instance).set_decryption_key(key);
          else:
            - logger.log:
                level: info
                format: "Not using decryption key. If you need to set a key use Home Assistant service 'ESPHome:  ${device_name}_set_dsmr_key'"

external_components:
  - source:
      type: git
      url: https://github.com/mmakaay/esphome
      ref: fix-dsmr-read-chunk-size
    components: [ "dsmr" ]
    refresh: 60s
      
wifi:
  networks:
    - ssid: 
      password: 
 
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: ${device_name}
    ap_timeout: 15s
 
captive_portal:
 
# Enable logging
logger:
#  baud_rate:0
 
# Enable Home Assistant API
api:
  services:
    service: set_dsmr_key
    variables:
      private_key: string
    then:
      - logger.log:
          format: Setting private key %s. Set to empty string to disable
          args: [private_key.c_str()]
      - globals.set:
          id: has_key
          value: !lambda "return private_key.length() == 32;"
      - lambda: |-
          if (private_key.length() == 32)
            private_key.copy(id(stored_decryption_key), 32);
          id(dsmr_instance).set_decryption_key(private_key);
 
ota:
 
web_server:
  port: 80
 
uart:
  baud_rate: 115200
  rx_pin: D7
  rx_buffer_size: 1500
  
globals:
  - id: has_key
    type: bool
    restore_value: yes
    initial_value: "false"
  - id: stored_decryption_key
    type: char[32]
    restore_value: yes
 
dsmr:
  id: dsmr_instance
  # For Luxembourg users set here your decryption key. 
  # Enable this when using decryption for Luxembourg;
  # key looks like '00112233445566778899AABBCCDDEEFF'
  #decryption_key: !secret decryption_key 
 
sensor:
  - platform: dsmr
    energy_delivered_tariff1:
      name: "Energy Consumed Tariff 1"
      state_class: total_increasing
    energy_delivered_tariff2:
      name: "Energy Consumed Tariff 2"
      state_class: total_increasing
    energy_returned_tariff1:
      name: "Energy Produced Tariff 1"
      state_class: total_increasing
    energy_returned_tariff2:
      name: "Energy Produced Tariff 2"
      state_class: total_increasing
    power_delivered:
      name: "Power Consumed"
      accuracy_decimals: 3
    power_returned:
      name: "Power Produced"
      accuracy_decimals: 3
    electricity_failures:
      name: "Electricity Failures"
      icon: mdi:alert
    electricity_long_failures:
      name: "Long Electricity Failures"
      icon: mdi:alert
    voltage_l1:
      name: "Voltage Phase 1"
    voltage_l2:
      name: "Voltage Phase 2"
    voltage_l3:
      name: "Voltage Phase 3"
    current_l1:
      name: "Current Phase 1"
    current_l2:
      name: "Current Phase 2"
    current_l3:
      name: "Current Phase 3"
    power_delivered_l1:
	  id: power_consumed_phase_1
      name: "Power Consumed Phase 1"
      accuracy_decimals: 3
    power_delivered_l2:
	  id: power_consumed_phase_2
      name: "Power Consumed Phase 2"
      accuracy_decimals: 3
    power_delivered_l3:
	  id: power_consumed_phase_3
      name: "Power Consumed Phase 3"
      accuracy_decimals: 3
    power_returned_l1:
	  id: power_produced_phase_1
      name: "Power Produced Phase 1"
      accuracy_decimals: 3
    power_returned_l2:
	  id: power_produced_phase_2
      name: "Power Produced Phase 2"
      accuracy_decimals: 3
    power_returned_l3:
	  id: power_produced_phase_3
      name: "Power Produced Phase 3"
      accuracy_decimals: 3
    gas_delivered:
      name: "Gas Consumed"
      state_class: total_increasing
  - platform: uptime
    name: "SlimmeLezer Uptime"
  - platform: wifi_signal
    name: "SlimmeLezer Wi-Fi Signal"
    update_interval: 300s
  - platform: total_daily_energy
    name: "Total Daily Energy Consumed Phase 1"
    power_id: power_consumed_phase_1
  - platform: total_daily_energy
    name: "Total Daily Energy Consumed Phase 2"
    power_id: power_consumed_phase_2
  - platform: total_daily_energy
    name: "Total Daily Energy Consumed Phase 3"
    power_id: power_consumed_phase_3
  - platform: total_daily_energy
    name: "Total Daily Energy Produced Phase 1"
    power_id: power_produced_phase_1
  - platform: total_daily_energy
    name: "Total Daily Energy Produced Phase 2"
    power_id: power_produced_phase_2
  - platform: total_daily_energy
    name: "Total Daily Energy Produced Phase 3"
    power_id: power_produced_phase_3
 
 
text_sensor:
  - platform: dsmr
    identification:
      name: "DSMR Identification"
    p1_version:
      name: "DSMR Version"
  - platform: wifi_info
    ip_address:
      name: "SlimmeLezer IP Address"
    ssid:
      name: "SlimmeLezer Wi-Fi SSID"
    bssid:
      name: "SlimmeLezer Wi-Fi BSSID"
  - platform: version
    name: "ESPHome Version"
    hide_timestamp: true

you might need to add this too

# Enable time component to reset energy at midnight
time:
  - platform: sntp
    id: my_time

Somewhere particular?

By the way, I tried to reply again, but I was at the maximum of 22 replies

your additions to the yaml file result in an error message
it’s about newly added lines like:

	  id: power_consumed_phase_1
      name: "Power Consumed Phase 1"

error message is
afbeelding

@petro I am sorry, replying doesn’t work, I already logged out and in again.

nope, just in the file at the root level. Put it at the end if you’re unsure.

So you’re not connecting the solar panels in strings but you use 1 input of the APS YC 1000 per solar panel?

not sure how that’s failing config check as it’s a valid mapping value. Did you copy/paste what I wrote or did you attempt to add it yourself to your config?

I gave you basic user rights, you should be able to reply.

I finally can reply. I was able to put the config you wrote into my config without problems, it took a while, but I succeeded. After that I could select the phase production and phase consumtion in my energy dashboard. I must wait unit tomoroow if it all works well, but for now i want to thank you! I have struggled with this for such a long time.
I checked this morning and seems like it’s working. I am not sure if the calculations are right though, because my solarpanelapp syas it produced way more than HA energy dashboard shows. But I will look again tomorrow, bcause I changed the ESP config, because of checksum errors, and now there are no errors anymore, so maybe the ESP errors led to a different calculation. There is a difference of more than 1 KWH. The readings were from 12:00

You should really get used to reading the documentation. I’m sure you just copied and pasted what I wrote, but the documentation describes how it calculates the kW → kWh and there’s 3 calculation methods. You’re using the default trapezoidal method, the default method.

Ok I will, and try to understand… But still thanks for what you have done already.

Hi @bertreb ,
I have to rectify something, I found out I am using QS1 inverters en also YC600 inverters, the principal is the same. 4 panels are connected to 1 QS1 inverter and the YC600 only has 2 panels. frontside of the house/roof has 14 panels and they are connected to 1 powergroup and 1 phase in the meterbox, backside of the house/roof has 10 panels, also connected to 1 powergroup and to another phase. so the output is 220/240 volt and can be directly attached to my powergrid.