Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions example/ct_ratio_automation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
alias: Set CT Ratio Based on Netzanschluss Leistung
description: Adjust sun12k_general_ct_ratio based on netzanschluss_leistung
triggers:
- entity_id: sensor.netzanschluss_leistung
below: -8000
for: "00:00:10"
trigger: numeric_state
- entity_id: sensor.netzanschluss_leistung
above: -1000
for: "00:00:10"
trigger: numeric_state
- trigger: time_pattern
seconds: "30"
actions:
- choose:
- conditions:
- condition: numeric_state
entity_id: sensor.netzanschluss_leistung
below: -8000
sequence:
- target:
entity_id: number.sun12k_general_ct_ratio
data:
value: 1000
action: number.set_value
- conditions:
- condition: numeric_state
entity_id: sensor.netzanschluss_leistung
above: -1000
sequence:
- target:
entity_id: number.sun12k_general_ct_ratio
data:
value: 2000
action: number.set_value
mode: restart
87 changes: 87 additions & 0 deletions example/deye.yaml
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where I am more concerned.

I originally structured the Repository in:

  • esphome-config-common.yaml
  • esphome-config-master.yaml
  • esphome-config-slave.yaml

Your example/deye.yaml is probably esphome-config-common.yaml merged within esphome-config-master.yaml but somewhat on a complementary Side (it's another Implementation for you who is Grid Connected, you also moved several Settings from separate Config Files into the "main" File).

Not sure how / if we should restructure everything to make it a bit more Consistent, since it's a bit of à La Carte Menu, where everybody can choose the different Components they would like. And obviously no 2 Configurations will ever be the same.

Any Tips ?

Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
substitutions:
name: deye #name in ESPhome
esp_name: deye
device_description: "Esphome component for Deye sun-12k-sg04lp3" #Description in ESPhome
modbus_controller_id: deye_modbus_controller #just a random name for the modbus controler - this is the high frequency controller for live values
device_type: sun12k #all entities in Home Assistant will start with this text to help identify the entitys
entities_id_prefix: SUN12K
entities_name_prefix: SUN12K
esphome:
name: ${name}

esp32:
board: wt32-eth01
framework:
type: esp-idf

# Enable logging
logger:
level: INFO
baud_rate: 0

# Enable Home Assistant API
ota:
platform: esphome
password: !secret ota_password

# Enable Home Assistant API
api:
encryption:
key: !secret api_encryption

ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO0_IN
phy_addr: 1
power_pin: GPIO16

time:
- platform: homeassistant

uart:
- id: uart_deye
tx_pin: GPIO17
rx_pin: GPIO05
baud_rate: 115200
stop_bits: 1
rx_buffer_size: 4096

modbus:
- id: modbus_deye
uart_id: uart_deye

modbus_controller:
- id: ${modbus_controller_id}
address: 0x1
modbus_id: modbus_deye
setup_priority: -10
update_interval: 1sec

packages:
# Different modules for the different sections of the inverter
solar: !include esphome-for-deye/modules/solar.yaml
battery: !include esphome-for-deye/modules/battery.yaml

load: !include esphome-for-deye/modules/load.yaml
generator: !include esphome-for-deye/modules/generator.yaml # Generator, Micro Inverter or Smart Load
general: !include esphome-for-deye/modules/general.yaml
status: !include esphome-for-deye/modules/status.yaml
internal: !include esphome-for-deye/modules/internal.yaml # Internal CTs Current/Power Measurement
inverter: !include esphome-for-deye/modules/inverter.yaml
ups: !include esphome-for-deye/modules/ups.yaml
out-of-grid: !include esphome-for-deye/modules/out-of-grid.yaml

#
# Enable for grid-connected systems
grid: !include esphome-for-deye/modules/grid.yaml
external: !include esphome-for-deye/modules/external.yaml # External CTs Current/Power Measurement


advanced: !include esphome-for-deye/modules/advanced_readwrite_select.yaml
# Time of Use for Grid-Connected Systems
time-of-use-common: !include esphome-for-deye/modules/time-of-use-common.yaml
# Only Include ONE of these (select OR number)
time-of-use-time-as-select: !include esphome-for-deye/modules/time-of-use-time-as-select.yaml
#time-of-use-time-as-number: !include modules/time-of-use-time-as-number.yaml
10 changes: 10 additions & 0 deletions example/template_sensor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
template:
sensor:
- name: "Netzanschluss Leistung"
unit_of_measurement: "W"
state: >
{% set netz_deye = states('sensor.sun12k_external_ct_active_power_total') | float %}
{% set ratio = states('number.sun12k_general_ct_ratio') | float %}

{{ (netz_deye * 2000 / ratio) | round(1, default=0) }}
device_class: power