24 lines
577 B
Python
24 lines
577 B
Python
import asyncio
|
|
import argparse
|
|
import json
|
|
|
|
from enclave_shelly import ShellyBase
|
|
|
|
async def main():
|
|
parser = argparse.ArgumentParser(description="Queries the status of a Shelly device.")
|
|
parser.add_argument("url", type=str, help="The IP or hostname of the Shelly device.")
|
|
|
|
args = parser.parse_args()
|
|
|
|
shelly = ShellyBase(args.url)
|
|
|
|
status = await shelly.get_status()
|
|
print(json.dumps(status, indent=4))
|
|
|
|
device_info = await shelly.get_device_info()
|
|
print(json.dumps(device_info, indent=4))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|