add ip address as command line parameter

This commit is contained in:
suaveolent 2023-11-17 13:20:23 +01:00
parent 76e59c9b6d
commit 2d42c2f9bc
2 changed files with 8 additions and 4 deletions

View File

@ -15,7 +15,7 @@ You can integrate the library into your own project, or simply use it in the com
### Command line:
```
hoymiles-wifi
hoymiles-wifi <ip_address>
```
This will retrieve the current inverter state.
@ -25,7 +25,7 @@ This will retrieve the current inverter state.
```
from hoymiles_wifi.inverter import Inverter
inverter = Inverter('192.168.1.190')
inverter = Inverter(<ip_address>)
response = inverter.update_state()
if response:

View File

@ -1,9 +1,13 @@
import argparse
from hoymiles_wifi.inverter import Inverter
import time
def main():
# Replace 'your_inverter_ip' with the actual IP address or hostname of your inverter
inverter = Inverter('192.168.1.190')
parser = argparse.ArgumentParser(description="Hoymiles HMS Monitoring")
parser.add_argument("ip_address", type=str, help="IP address or hostname of the inverter")
args = parser.parse_args()
inverter = Inverter(args.ip_address)
try:
while True: