In diesem Teil wird die Steuerung mit einem steuerbaren DCDC Regler DPS5020 beschrieben.
In diesem Fall kann der Microwechselrichter nicht sebst regeln, sondern wird über den DPS5020 über ESPHome und Red Node in Home Assistant gesteuert. Diesen Regler kann man hier bestellen: https://amzn.to/3YbqIZd
Der ESP32 (https://amzn.to/44DFXwm) wird mit dem Image von syssi / esphome-dps programmiert. Unter https://github.com/syssi/esphome-dps wird genau beschrieben, wie man den ESP32 mit dem DPS5020 verbinden muss. Man sollte genau diese GPIs verwenden, die im Projekt beschrieben werden und nicht die RX/TX Ports vom ESP32. Es funktioniert ansonsten nicht.
Zusätzlich wird ein Stromzähler verwendet und zu messen, wie viel man aktuell einspeisen soll. Wir haben den Shelly 3EM verwendet. https://amzn.to/473qNC8
Der ESP32 ESPHome Code ist unten im Beitrag.
Falls es Probleme bei der Grundsätzlichen Installation von Home Assistant oder ESPHome kommt, einfach in die Kommentare schreiben.
Die Steuerung erfolgt dann über Node Red.
Hier der Node Red Code zum Importieren. Der Code soll nur als Beispiel dienen. Am eigenen System müssen die einzelnen Punkte angepasst werden, da sie vermutlich einen anderen Namen haben.
Gegenüber der OptenDTU Steuerung ist diese Lösung viel schneller bei der Regelung. Die OptenDTU kann leider nur ca alle 15 Sekunden den Wert ändern.
ESPHome Code
substitutions:
name: dpshv
device_description: "Monitor and control a RDTech Digital Control Power Supply (DPS) via UART-TTL"
external_components_source: github://syssi/esphome-dps@main
tx_pin: GPIO4
rx_pin: GPIO5
esphome:
name: ${name}
comment: ${device_description}
project:
name: "syssi.esphome-dps"
version: 1.0.0
esp8266:
board: esp01_1m
external_components:
- source: ${external_components_source}
refresh: 0s
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ota:
# Enable Home Assistant API
api:
encryption:
key: "S8tQrqvdUDatto4SkIgrWc+uKuG9Z79kY0PvMUwaCII="
logger:
level: DEBUG
# If you use Home Assistant please remove this `mqtt` section and uncomment the `api` component!
# The native API has many advantages over MQTT: https://esphome.io/components/api.html#advantages-over-mqtt
mqtt:
broker: !secret mqtt_host
username: !secret mqtt_username
password: !secret mqtt_password
id: HV_DPS5020
# api:
uart:
id: uart_0
baud_rate: 9600
tx_pin: ${tx_pin}
rx_pin: ${rx_pin}
modbus:
id: modbus0
uart_id: uart_0
send_wait_time: 0ms
dps:
id: dps0
modbus_id: modbus0
update_interval: 5s
binary_sensor:
- platform: dps
output:
name: "${name} output"
key_lock:
name: "${name} key lock"
constant_current_mode:
name: "${name} constant current mode"
sensor:
- platform: dps
output_voltage:
name: "${name} output voltage"
output_current:
name: "${name} output current"
output_power:
name: "${name} output power"
input_voltage:
name: "${name} input voltage"
voltage_setting:
name: "${name} voltage setting"
current_setting:
name: "${name} current setting"
backlight_brightness:
name: "${name} backlight brightness"
firmware_version:
name: "${name} firmware version"
text_sensor:
- platform: dps
protection_status:
name: "${name} protection status"
device_model:
name: "${name} device model"
switch:
- platform: dps
output:
name: "${name} output"
key_lock:
name: "${name} key lock"
number:
- platform: dps
voltage_setting:
name: "${name} voltage setting"
current_setting:
name: "${name} current setting"
Node Red Code
[{"id":"29dd6e85ec722186","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"1f838834db453a06","type":"server-state-changed","z":"29dd6e85ec722186","name":"PhaseA-Watt","server":"dafadb41.b5bb18","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.stromhv_channel_a_power","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":70,"y":200,"wires":[["7d539bcc5f9bae79"]]},{"id":"aa828ebe4d965cf9","type":"api-call-service","z":"29dd6e85ec722186","name":"Volt1","server":"dafadb41.b5bb18","version":5,"debugenabled":true,"domain":"number","service":"set_value","areaId":["hv"],"deviceId":["e4e0b78dbd1393ff88dc3584f7ff1aff"],"entityId":["number.dpshv_voltage_setting"],"data":"{\t \"value\":msg.payload\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":370,"y":780,"wires":[["24567e4c6103353f"]]},{"id":"0c69f1966ba03496","type":"inject","z":"29dd6e85ec722186","name":"","props":[{"p":"payload"},{"p":"topic","v":"","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"31","payloadType":"num","x":190,"y":780,"wires":[["aa828ebe4d965cf9"]]},{"id":"da4a06b21210f3b5","type":"server-state-changed","z":"29dd6e85ec722186","name":"","server":"dafadb41.b5bb18","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.dpshv_voltage_setting","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":290,"y":860,"wires":[["24567e4c6103353f"]]},{"id":"24567e4c6103353f","type":"debug","z":"29dd6e85ec722186","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":600,"y":820,"wires":[]},{"id":"b318c545c2053a48","type":"api-call-service","z":"29dd6e85ec722186","name":"Amper","server":"dafadb41.b5bb18","version":5,"debugenabled":true,"domain":"number","service":"set_value","areaId":["hv"],"deviceId":["e4e0b78dbd1393ff88dc3584f7ff1aff"],"entityId":["number.dpshv_current_setting"],"data":"{\t \"value\":msg.payload\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":230,"y":40,"wires":[[]]},{"id":"780bc6e9d48189ec","type":"inject","z":"29dd6e85ec722186","name":"","props":[{"p":"payload"},{"p":"topic","v":"","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"8","payloadType":"num","x":72,"y":41,"wires":[["b318c545c2053a48"]]},{"id":"2eea1b7bffb80712","type":"api-call-service","z":"29dd6e85ec722186","name":"Ein","server":"dafadb41.b5bb18","version":5,"debugenabled":true,"domain":"homeassistant","service":"turn_on","areaId":["hv"],"deviceId":["e4e0b78dbd1393ff88dc3584f7ff1aff"],"entityId":["switch.dpshv_output"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":730,"y":100,"wires":[[]]},{"id":"80b175513e63f441","type":"inject","z":"29dd6e85ec722186","name":"","props":[{"p":"payload"},{"p":"topic","v":"","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"ON","payloadType":"str","x":410,"y":100,"wires":[["6938360e9fb8f14a"]]},{"id":"b0755c07804c3bd4","type":"api-call-service","z":"29dd6e85ec722186","name":"Aus","server":"dafadb41.b5bb18","version":5,"debugenabled":true,"domain":"homeassistant","service":"turn_off","areaId":["hv"],"deviceId":["e4e0b78dbd1393ff88dc3584f7ff1aff"],"entityId":["switch.dpshv_output"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":730,"y":40,"wires":[[]]},{"id":"89d581553cd312d5","type":"inject","z":"29dd6e85ec722186","name":"","props":[{"p":"payload"},{"p":"topic","v":"","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"OFF","payloadType":"str","x":410,"y":20,"wires":[["6938360e9fb8f14a"]]},{"id":"6938360e9fb8f14a","type":"switch","z":"29dd6e85ec722186","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"OFF","vt":"str"},{"t":"eq","v":"ON","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":570,"y":60,"wires":[["b0755c07804c3bd4"],["2eea1b7bffb80712"]]},{"id":"7d539bcc5f9bae79","type":"sum","z":"29dd6e85ec722186","name":"","topic":"","x":310,"y":260,"wires":[["ba7d6a685c7208bb","d8c4ccc5f5aca340"]]},{"id":"9ce0069c79bf1940","type":"server-state-changed","z":"29dd6e85ec722186","name":"PhaseB-Watt","server":"dafadb41.b5bb18","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.stromhv_channel_b_power","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":70,"y":260,"wires":[["7d539bcc5f9bae79"]]},{"id":"f31da01c01500313","type":"server-state-changed","z":"29dd6e85ec722186","name":"PhaseC-Watt","server":"dafadb41.b5bb18","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.stromhv_channel_c_power","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":70,"y":320,"wires":[["7d539bcc5f9bae79"]]},{"id":"5feb85f331c14e59","type":"switch","z":"29dd6e85ec722186","name":"","property":"payload","propertyType":"msg","rules":[{"t":"btwn","v":"2","vt":"num","v2":"10","v2t":"num"},{"t":"gte","v":"10","vt":"num"},{"t":"lt","v":"1","vt":"num"},{"t":"lt","v":"-1","vt":"num"}],"checkall":"true","repair":false,"outputs":4,"x":150,"y":520,"wires":[["26b23558109acffb"],["27c4d2fd6801cd33"],["9dddcb3f615b364f"],["f9b3be87c857e922"]]},{"id":"27c4d2fd6801cd33","type":"change","z":"29dd6e85ec722186","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"10","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":580,"wires":[["26b23558109acffb"]]},{"id":"55fd9814bea7117b","type":"smooth","z":"29dd6e85ec722186","name":"","property":"payload","action":"mean","count":"3","round":"1","mult":"single","reduce":false,"x":620,"y":260,"wires":[["15f1772ba0aa7906","a720205aa06598a1"]]},{"id":"ba7d6a685c7208bb","type":"calculator","z":"29dd6e85ec722186","name":"","inputMsgField":"payload","outputMsgField":"payload","operation":"div","constant":"30","round":true,"decimals":"1","x":470,"y":260,"wires":[["55fd9814bea7117b","5d7d733a5d915384"]]},{"id":"e3d2f08c47a170f5","type":"api-call-service","z":"29dd6e85ec722186","name":"Amper","server":"dafadb41.b5bb18","version":5,"debugenabled":true,"domain":"number","service":"set_value","areaId":["hv"],"deviceId":["e4e0b78dbd1393ff88dc3584f7ff1aff"],"entityId":["number.dpshv_current_setting"],"data":"{\t \"value\":msg.payload\t}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":610,"y":580,"wires":[["f7b37ac8f37e954f"]]},{"id":"f7b37ac8f37e954f","type":"debug","z":"29dd6e85ec722186","name":"debug 2","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":700,"y":680,"wires":[]},{"id":"d8c4ccc5f5aca340","type":"debug","z":"29dd6e85ec722186","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":340,"y":200,"wires":[]},{"id":"15f1772ba0aa7906","type":"debug","z":"29dd6e85ec722186","name":"debug 4","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":700,"y":200,"wires":[]},{"id":"9dddcb3f615b364f","type":"change","z":"29dd6e85ec722186","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"2","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":190,"y":620,"wires":[["26b23558109acffb"]]},{"id":"26b23558109acffb","type":"delay","z":"29dd6e85ec722186","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"5","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":460,"y":640,"wires":[["e3d2f08c47a170f5"]]},{"id":"5d7d733a5d915384","type":"debug","z":"29dd6e85ec722186","name":"debug 5","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":520,"y":200,"wires":[]},{"id":"8ea259cddf9faa4a","type":"debug","z":"29dd6e85ec722186","name":"debug 6","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":860,"y":400,"wires":[]},{"id":"f9b3be87c857e922","type":"change","z":"29dd6e85ec722186","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"2","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":190,"y":660,"wires":[["26b23558109acffb"]]},{"id":"284146a8db7f38a1","type":"server-state-changed","z":"29dd6e85ec722186","name":"IST Current","server":"dafadb41.b5bb18","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"number.dpshv_current_setting","entityidfiltertype":"exact","outputinitially":true,"state_type":"num","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":70,"y":380,"wires":[["051f2f6b5d28478f"]]},{"id":"a720205aa06598a1","type":"change","z":"29dd6e85ec722186","name":"topic: A1","rules":[{"t":"set","p":"topic","pt":"msg","to":"A1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":340,"wires":[["06bf8371b0b5f857"]]},{"id":"051f2f6b5d28478f","type":"change","z":"29dd6e85ec722186","name":"topic: A2","rules":[{"t":"set","p":"topic","pt":"msg","to":"A2","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":420,"wires":[["06bf8371b0b5f857"]]},{"id":"06bf8371b0b5f857","type":"join","z":"29dd6e85ec722186","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":422,"y":388,"wires":[["56e539fa11e69427","bbc77accf9f1d944"]]},{"id":"56e539fa11e69427","type":"change","z":"29dd6e85ec722186","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.A1 + payload.A2","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"Summe von A1,A2","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":380,"wires":[["8ea259cddf9faa4a","5feb85f331c14e59"]]},{"id":"bbc77accf9f1d944","type":"debug","z":"29dd6e85ec722186","name":"debug 7","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":500,"y":460,"wires":[]},{"id":"dafadb41.b5bb18","type":"server","name":"Home Assistant","addon":true}]