support arguments passing
This commit is contained in:
parent
395f8e59cb
commit
55efdb0c77
@ -19,7 +19,8 @@ inverter-http-proxy --inverter-host 192.168.1.2 --host 127.0.0.1 --port 8080
|
||||
Then open https://127.0.0.1:8080/get-status/ in browser. You can replace `get-status`
|
||||
with any command supported by inverterd.
|
||||
|
||||
Command arguments aren't supported at the moment.
|
||||
To pass arguments: https://127.0.0.1:8080/get-day-generated/?args=2021,8,8
|
||||
|
||||
|
||||
## License
|
||||
|
||||
|
@ -14,12 +14,16 @@ inv_port = None
|
||||
async def variable_handler(request):
|
||||
command = request.match_info['command']
|
||||
|
||||
args = []
|
||||
if 'args' in request.query:
|
||||
args = request.query['args'].split(',')
|
||||
|
||||
inverter = InverterClient(host=inv_host, port=inv_port)
|
||||
inverter.connect()
|
||||
inverter.format(Format.JSON)
|
||||
|
||||
try:
|
||||
response = inverter.exec(command)
|
||||
response = inverter.exec(command, arguments=args)
|
||||
except InverterError as e:
|
||||
response = str(e)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user