Skip to content

Commit

Permalink
Specify number of inverters in config.ini (#148)
Browse files Browse the repository at this point in the history
* Specify number of inverters in config.ini

Added config parameter to  specify amount of computed inverters

* Specify number of inverters in config.ini

Changed config value name.
Updated comments and Readme.md.

* Specify number of inverters in config.ini

Revised Readme and parameter name

* Specify number of inverters in config.ini

Footnotes don't seem to work

* Specify number of inverters in config.ini

Adopted style
  • Loading branch information
OFreddy authored Feb 22, 2024
1 parent 9f01580 commit b94dc8f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
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 |
| 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.
# 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

0 comments on commit b94dc8f

Please sign in to comment.