Skip to content

Commit

Permalink
Fix monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
mhvis committed Jun 24, 2020
1 parent ba89282 commit effd4a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 3 additions & 7 deletions samil/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from samil.inverter import InverterNotFoundError, InverterFinder, Inverter
# @click.group(context_settings={"help_option_names": ["-h", "--help"]})
from samil.pvoutput import add_status
from samil.util import connect_to_inverters, get_bound_inverter_finder
from samil.util import connect_to_inverters, get_bound_inverter_finder, KeepAliveInverter


@click.group()
Expand All @@ -37,10 +37,6 @@ def monitor(interval: float, interface: str):
When you have multiple inverters, run this command multiple times to
connect to all inverters.
"""
if interval > 20:
# Todo
raise ValueError("Interval of more than 20 seconds is not yet supported (requires keep-alive messages).")

_model_keys = {
'device_type': 'Device type',
'va_rating': 'VA rating',
Expand Down Expand Up @@ -95,10 +91,10 @@ def _format_status(d):
t = [(form[0], '{}{}{}'.format(v, ' ' if form[1] else '', form[1])) for form, v in t]
return _format_two_tuple(t)

with InverterFinder(interface_ip=interface or '') as listener:
with InverterFinder(interface_ip=interface or '') as finder:
print("Searching for inverter")
try:
inverter = listener.accept_inverter()
inverter = KeepAliveInverter(*finder.find_inverter())
except InverterNotFoundError:
print("Could not find inverter")
sys.exit()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name="samil",
version="2.1.0a3",
version="2.1.0a4",
author="Maarten Visscher",
author_email="mail@maartenvisscher.nl",
description="Samil Power inverter tool",
Expand Down

0 comments on commit effd4a3

Please sign in to comment.