Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify number of inverters in config.ini #148

Merged
merged 5 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ Within the project there is a file `/data/dbus-opendtu/config.ini`. Most importa
|-------------------- | ------------- |
| SignOfLifeLog | Time in minutes how often a status is added to the log-file `current.log` with log-level INFO |
| NumberOfTemplates | Number ob Template Inverter to query |
| DTU | Which DTU to be used ahoy, opendtu or template REST devices Valid options: opendtu, ahoy, template |
| DTU | Which DTU to be used ahoy, opendtu or template REST devices Valid options: opendtu, ahoy, template |
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice 👍

| NumberOfInvertersToQuery | Number of Inverters to query. Set a value larger than "0" when not all inverters should be considered. *1 |
| useYieldDay | send YieldDay instead of YieldTotal. Set this to 1 to prevent VRM from adding the total value to the history on one day. E.g. if you don't start using the inverter at 0. |
| ESP8266PollingIntervall | For ESP8266 reduce polling intervall to reduce load, default 10000ms|
| Logging | Valid options for log level: CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET, to keep logfile small use ERROR or CRITICAL |
Expand All @@ -100,6 +101,8 @@ Within the project there is a file `/data/dbus-opendtu/config.ini`. Most importa
| Username | use if authentication required, leave empty if no authentication needed |
| Password | use if authentication required, leave empty if no authentication needed |

*1: Please assure that the order is correct in the DTU, we can only extract the first one in a row.

#### Inverter options

This applies to each `INVERTER[X]` section. X is the number of Inverter starting with 0. So the first inverter is INVERTER0, the second INVERTER1 and so on.
Expand Down
5 changes: 5 additions & 0 deletions config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ NumberOfTemplates=0
# Which DTU to be used ahoy, opendtu, template
DTU=opendtu

# If you want to exclude Inverter, specify how many of the Inverters you want to query.
0x7878 marked this conversation as resolved.
Show resolved Hide resolved
# Please assure that the order is correct in the DTU, we can only extract the first one in a row.
# (0=compute number from json response; > 0 use only first x inverters)
NumberOfInvertersToQuery = 0

# send YieldDay instead of YieldTotal
useYieldDay=0

Expand Down
4 changes: 3 additions & 1 deletion dbus-opendtu.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def main():
config.read(f"{(os.path.dirname(os.path.realpath(__file__)))}/config.ini")
logging_level = config["DEFAULT"]["Logging"].upper()
dtuvariant = config["DEFAULT"]["DTU"]
number_of_inverters = int(config["DEFAULT"]["NumberOfInvertersToQuery"])

try:
number_of_templates = int(config["DEFAULT"]["NumberOfTemplates"])
Expand Down Expand Up @@ -112,7 +113,8 @@ def _v(_p, value: float) -> str:
actual_inverter=0,
)

number_of_inverters = service.get_number_of_inverters()
if number_of_inverters == 0:
number_of_inverters = service.get_number_of_inverters()

if number_of_inverters > 1:
# start our main-service if there are more than 1 inverter
Expand Down