reserve85 / HoymilesZeroExport

Zero Export Script for Hoymiles Inverters using AhoyDTU / OpenDTU and Tasmota Smart Meter inferface / Shelly 3EM / SHRDZM / Emlog / ioBroker
GNU General Public License v3.0
134 stars 31 forks source link

Inbetriebnahme unter Docker #227

Closed trombose009 closed 3 weeks ago

trombose009 commented 3 weeks ago

Hallo zusammen,

ich habe vor, das script in docker auf einen raspberry laufen zu lassen. Ich habe es mit docker compose auch hinbekommen, dass ein entsprechender container erstellt wird. Jetzt habe ich ein paar Fragen und ein Problem. 1.) sollte das script da die ganze Zeit laufen bzw sollte der container die ganze Zeit laufen und empfängt dann permanent mqtt zählerwerte und ändert entsprechend den wechselrichter-output in einem bestimmten intervall. Oder, sollte das script in einem bestimmten intervall immer wieder von außen angetriggert werden? letzteres vermutlich eher unwahrscheinlich.

ok, jetzt aber zu dem problem. wie gesagt, der container wird erstellt, ich kann ihn auch starten und dann beendet er sich automatisch wieder. Folgenden Log-Output habe ich.

      ^^^^^^^^^^^

File "/app/HoymilesZeroExport.py", line 1492, in CreateDTU raise Exception("Error: no DTU defined!") Exception: Error: no DTU defined! 2024-08-21 07:47:02 INFO Log write to file: False 2024-08-21 07:47:02 INFO Python Version: 3.11.9 (main, Jul 24 2024, 11:19:24) [GCC 13.2.1 20240309] 2024-08-21 07:47:02 INFO Author: Tobias Kraft / Script Version: 1.98 2024-08-21 07:47:02 INFO read config file: /app/HoymilesZeroExport_Config.ini 2024-08-21 07:47:02 INFO read additional config file: /home/pi/IOTstack/HoymilesZeroExport_Config.ini 2024-08-21 07:47:02 INFO Config file V 1.97 Traceback (most recent call last): File "/app/HoymilesZeroExport.py", line 1523, in DTU = CreateDTU() ^^^^^^^^^^^ File "/app/HoymilesZeroExport.py", line 1492, in CreateDTU raise Exception("Error: no DTU defined!") Exception: Error: no DTU defined!

ich erstelle den container so:

docker run -d --name hoymileszeroexport -v source=${PWD}/HoymilesZeroExport_Config.ini,destination=/app/HoymilesZeroExport_Config_Override.ini,readonly ghcr.io/reserve85/hoymileszeroexport:main -c /home/pi/IOTstack/HoymilesZeroExport_Config.ini

image

bei mir heißt die config datei HoymilesZeroExport_Config.ini (also ohne das override.

was muss ich tun bzw. was ist falsch? Kann mir jemand helfen? bin natürlich nooob.

Vielen Dank.

sibelle-labs commented 3 weeks ago

Hi, create a file docker-compose.yml on your path (eg. /home/pi/HoymilesZeroExport) with this content.

services:
  hoymileszeroexport:
    image: ghcr.io/reserve85/hoymileszeroexport:main
    volumes:
      - ./HoymilesZeroExport_Config_Override.ini:/app/config.ini
    command: -c /app/config.ini

create a file HoymilesZeroExport_Config_Override.ini on same path with your custom configuration.

# define your dtu, smartmeter, etc as on HoymilesZeroExport_Config.ini
# example for AhoyDTU & Hichi Tasmota IR Adapter
[SELECT_DTU]
USE_AHOY = true

[SELECT_POWERMETER]
USE_TASMOTA = true

[AHOY_DTU]
AHOY_IP = 192.168.10.57

[TASMOTA]
TASMOTA_IP = 192.168.10.90

then docker compose up -d # start detached

show logs with docker compose logs -f |grep -i hoymiles

stop docker compose down

RealNBB commented 3 weeks ago

Zu 1.) Selbstverständlich muss das Skript die ganze Zeit (im Hintergrund) unter Docker laufen. Wenn es sich automatisch beendet, läuft irgendwas falsch.

Bezüglich deiner Override_Config...hier hilft lesen! Steht nämlcih genau beschrieben unter "Docker" auf der Hauptseite hier:

_By default the Docker image uses a base configuration in HoymilesZeroExport_Config.ini. You need to provide a configuration where you override individual values. To do that, create a new HoymilesZeroExport_Config_Override.ini and set the configuration values from HoymilesZeroExportConfig.ini you'd like to override. The minimum config file for using AhoyDTU with a Tasmota powermeter looks like this:

trombose009 commented 3 weeks ago

super, vielen dank. ich werde das gleich testen.

trombose009 commented 3 weeks ago

Great guys. the thing sibelle-labs has written is working! No Errors so far.

But I do not use tasmota. So I changed the override file to following:

[SELECT_DTU] USE_AHOY = true

[SELECT_POWERMETER] USE_MQTT = true

[AHOY_DTU] AHOY_IP = 192.168.178.98

[MQTT_POWERMETER] MQTT_BROKER = 192.168.178.44 MQTT_PORT = 1883 MQTT_TOPIC_INCOMING = sensor/display/solar

Log:

2024-08-21 08:50:21 INFO Ahoy: Inverter "HM-1500": setting new limit from -1 Watt to 75 Watt 2024-08-21 08:50:22 INFO Ahoy: Inverter "HM-1500": Limit acknowledged 2024-08-21 08:50:22 INFO intermediate meter AhoyDTU: 63 Watt 2024-08-21 08:50:27 ERROR Exception at GetPowermeterWatts 2024-08-21 08:50:27 ERROR Timeout waiting for MQTT incoming message 2024-08-21 08:50:47 INFO ---Start Zero Export--- 2024-08-21 08:50:47 INFO Ahoy: Inverter "HM-1500" Available: True 2024-08-21 08:50:52 ERROR Exception at GetPowermeterWatts 2024-08-21 08:50:52 ERROR Timeout waiting for MQTT incoming message 2024-08-21 08:51:12 INFO Ahoy: Inverter "HM-1500" Available: True

at this point I do not receive any mqtt messages. Everything else looks good. Any further ideas?

trombose009 commented 3 weeks ago

solved! typo in mqtt topic

trombose009 commented 3 weeks ago

Guys, this is such a great support. Thank you very much!