Hallo,
ich habe das über den slimmelezer gelöst (habe auch einen P1-fähigen Zähler in D und das Kabel anschließen lassen)
https://www.zuidwijk.com/product/slimmelezer-plus/
https://www.zuidwijk.com/esphome/
Dann hier noch die ESPHome-Konfiguration (für meinen speziellen Zähler). Die Werte übergebe ich per MQTT(siehe onraw) an die OpenWB.
Statt dem D0 (für meine speziellen OBIS Werte mit 4 Tarifen und Ausgabe der Einspeisung über 2.8.0 anstatt 2.8.1) kann man bei Dir ggf. auch das dsmr nutzen:
https://esphome.io/components/sensor/dsmr.html
Bei meinem PV-Einspeisungszähler mache ich es genauso...
Das schwierige war, die Werte umzurechnen und so zu schicken, wie die OpenWB das will...
Hoffe, die Infos helfen...
Code: Alles auswählen
substitutions:
devicename: hauptstromzaehler
upper_devicename: Hauptstromzaehler
device_description: "Hauptstromzähler im Hauswirtschaftsraum"
external_components:
- source:
type: git
url: https://github.com/BMOD89/esphome_compontens
ref: main
components: [ d0 ]
esphome:
name: $devicename
comment: "${device_description}"
platform: ESP8266
esp8266_restore_from_flash: true
board: d1_mini
logger:
#level: VERBOSE #Change the log level as required; during testing verbose is helpful.
baud_rate: 0
api:
reboot_timeout: 2min
encryption:
key: !secret encryption_key
ota:
password: !secret ota_password
wifi:
reboot_timeout: 2min
ssid: !secret wifi_ssid
password: !secret wifi_password
power_save_mode: none
uart:
baud_rate: 9600
data_bits: 7
parity: EVEN
stop_bits: 1
rx_pin: D7
id: uart_bus
d0:
id: obis
uart_id: uart_bus
mqtt:
broker: 192.168.175.44
port: 1883
discovery: false
id: mqtt_client
sensor:
- platform: d0
name: ${upper_devicename} Energy Consumed Tarif 1
id: energy_consumed_tarif1
d0_id: obis
obis_code: "1-0:1.8.1"
state_class: "total_increasing"
device_class: "energy"
unit_of_measurement: "kWh"
accuracy_decimals: 3
- platform: d0
name: ${upper_devicename} Energy Consumed Tarif 2
id: energy_consumed_tarif2
d0_id: obis
obis_code: "1-0:1.8.2"
state_class: "total_increasing"
device_class: "energy"
unit_of_measurement: "kWh"
accuracy_decimals: 3
- platform: d0
name: ${upper_devicename} Energy Consumed Tarif 3
id: energy_consumed_tarif3
d0_id: obis
obis_code: "1-0:1.8.3"
state_class: "total_increasing"
device_class: "energy"
unit_of_measurement: "kWh"
accuracy_decimals: 3
- platform: d0
name: ${upper_devicename} Energy Consumed Tarif 4
id: energy_consumed_tarif4
d0_id: obis
obis_code: "1-0:1.8.4"
state_class: "total_increasing"
device_class: "energy"
unit_of_measurement: "kWh"
accuracy_decimals: 3
- platform: d0
name: ${upper_devicename} Energy Consumed Total
id: energy_consumed_total
d0_id: obis
obis_code: "1-0:1.8.0"
state_class: "total_increasing"
device_class: "energy"
unit_of_measurement: "kWh"
accuracy_decimals: 3
on_value: # openWB/set/evu/WhImported Bezogene Energie in Wh, float, Punkt als Trenner, nur positiv
- lambda: |-
char text[16];
dtostrf( (double) (x*1000),1,1,text);
id(mqtt_client).publish("openWB/set/evu/WhImported",text);
- platform: d0
name: ${upper_devicename} Energy Produced Total
id: energy_produced_total
d0_id: obis
obis_code: "1-0:2.8.0"
state_class: "total_increasing"
device_class: "energy"
unit_of_measurement: "kWh"
accuracy_decimals: 3
on_value: # openWB/set/evu/WhImported Bezogene Energie in Wh, float, Punkt als Trenner, nur positiv
- lambda: |-
char text[16];
dtostrf( (double) (x*1000),1,1,text);
id(mqtt_client).publish("openWB/set/evu/WhExported",text);
- platform: d0
name: ${upper_devicename} Power Consumed
id: power_consumed
d0_id: obis
obis_code: "1-0:1.7.0"
state_class: "measurement"
device_class: "power"
unit_of_measurement: "W"
accuracy_decimals: 0
filters:
- multiply: 1000
on_value: # openWB/set/evu/W Bezugsleistung in Watt, int, positiv Bezug, negativ Einspeisung
- lambda: |-
if (x > 0) {
char text[8];
dtostrf( (double) x,1,0,text);
id(mqtt_client).publish("openWB/set/evu/W",text);
}
- platform: d0
name: ${upper_devicename} Power Produced
id: power_produced
d0_id: obis
obis_code: "1-0:2.7.0"
state_class: "measurement"
device_class: "power"
unit_of_measurement: "W"
accuracy_decimals: 0
filters:
- multiply: 1000
on_value: # openWB/set/evu/W Bezugsleistung in Watt, int, positiv Bezug, negativ Einspeisung
- lambda: |-
if (x > 0) {
char text[8];
dtostrf( (double) (-x),1,0,text);
id(mqtt_client).publish("openWB/set/evu/W",text);
}
PV-Zähler:
Code: Alles auswählen
on_raw_value: # openWB/set/pv/1/WhCounter Erzeugte Energie in Wh, float, nur positiv
- lambda: |-
char text[16];
dtostrf( (double) (x*0.1),1,0,text);
id(mqtt_client).publish("openWB/set/pv/1/WhCounter",text);
on_raw_value: # openWB/set/pv/1/W PV-Erzeugungsleistung in Watt, int, positiv
- lambda: |-
if (x < 0) {
char text[8];
dtostrf( (double) (-x),1,0,text);
id(mqtt_client).publish("openWB/set/pv/1/W",text);
}
else {
id(mqtt_client).publish("openWB/set/pv/1/W","0");
}