mirror of
https://github.com/suaveolent/hoymiles-wifi.git
synced 2024-09-20 03:10:11 +00:00
change ip_address to host parameter
This commit is contained in:
parent
092420bbdb
commit
477cf993db
@ -4,22 +4,26 @@ import time
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Hoymiles HMS Monitoring")
|
||||
parser.add_argument("ip_address", type=str, help="IP address or hostname of the inverter")
|
||||
parser.add_argument("--host", type=str, required=True, help="IP address or hostname of the inverter")
|
||||
parser.add_argument("command", type=str, choices=['get-real-data-new', 'get-real-data-hms', 'get-real-data', 'get-config', 'network-info', 'app-information-data', 'app-get-hist-power'], help="Command to execute")
|
||||
args = parser.parse_args()
|
||||
|
||||
inverter = Inverter(args.ip_address)
|
||||
inverter = Inverter(args.host)
|
||||
|
||||
# Execute the specified command
|
||||
response = getattr(inverter, args.command.replace('-', '_'), lambda: None)()
|
||||
|
||||
if response:
|
||||
print(f"{args.command.capitalize()} Response: {response}")
|
||||
else:
|
||||
print(f"Unable to retrieve {args.command.replace('_', ' ')}")
|
||||
try:
|
||||
while True:
|
||||
# Execute the specified command
|
||||
response = getattr(inverter, args.command, lambda: None)()
|
||||
|
||||
if response:
|
||||
print(f"{args.command.capitalize()} Response: {response}")
|
||||
else:
|
||||
print(f"Unable to retrieve {args.command.replace('_', ' ')}")
|
||||
|
||||
# Sleep for a while before the next update
|
||||
time.sleep(60)
|
||||
# Sleep for a while before the next update
|
||||
time.sleep(60)
|
||||
except KeyboardInterrupt:
|
||||
print("Exiting.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
Loading…
Reference in New Issue
Block a user