summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2021-08-08 23:09:15 +0300
committerEvgeny Zinoviev <me@ch1p.io>2021-08-08 23:09:15 +0300
commit55efdb0c77030f2b437f2cb4eb787888b59b8997 (patch)
treeb6bf2d1549880d31a8d209875646bbe7cbe10dd6
parent395f8e59cbdd61d8f9569f6c8aa889035f089add (diff)
support arguments passingHEADmaster
-rw-r--r--README.md3
-rwxr-xr-xinverter-http-proxy6
2 files changed, 7 insertions, 2 deletions
diff --git a/README.md b/README.md
index fd5ab60..cb38bb2 100644
--- a/README.md
+++ b/README.md
@@ -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
diff --git a/inverter-http-proxy b/inverter-http-proxy
index c658e1e..64b9227 100755
--- a/inverter-http-proxy
+++ b/inverter-http-proxy
@@ -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)