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 1 commit
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
4 changes: 4 additions & 0 deletions config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ HTTPTimeout=2.5
Username =
Password =

# Number of inverters if not all from json response should be used
Copy link
Owner

Choose a reason for hiding this comment

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

Move it up to line 10, also call it differently to show, that we query only the first amount X of devices. QueryOnlyFirstOfDTUInverter

Comment should be like: 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.

Please also update the README page

# (0=compute number from json response; > 0 use only first x inverters)
NumberOfInverters = 0

### Only needed for OpenDTU and ahoy
# AcPosition 0=AC input 1; 1=AC output; 2=AC output 2
# 1st inverter
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"]["NumberOfInverters"])

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