diff --git a/smarttub/__main__.py b/smarttub/__main__.py index cfada5b..58dc9fa 100644 --- a/smarttub/__main__.py +++ b/smarttub/__main__.py @@ -14,7 +14,7 @@ async def info_command(spas, args): for spa in spas: print(f"= Spa '{spa.name}' =\n") if args.all or args.status or args.location or args.locks: - status = await spa.get_status() + status = await spa.get_status_full() if args.all or args.status: print("== Status ==") @@ -32,13 +32,13 @@ async def info_command(spas, args): if args.all or args.pumps: print("== Pumps ==") - for pump in await spa.get_pumps(): + for pump in status.pumps: print(pump) print() if args.all or args.lights: print("== Lights ==") - for light in await spa.get_lights(): + for light in status.lights: print(light) print() @@ -70,6 +70,12 @@ async def info_command(spas, args): pprint(await energy_usage_day) print() + if args.all or args.sensors: + print("== Sensors ==") + for sensor in status.sensors: + print(sensor) + print() + if args.all or args.debug: debug_status = await spa.get_debug_status() print("== Debug status ==") @@ -152,6 +158,7 @@ async def main(argv): info_parser.add_argument("--reminders", action="store_true") info_parser.add_argument("--locks", action="store_true") info_parser.add_argument("--debug", action="store_true") + info_parser.add_argument("--sensors", action="store_true") info_parser.add_argument("--energy", action="store_true") set_parser = subparsers.add_parser("set", help="Change settings on the spa") diff --git a/smarttub/api.py b/smarttub/api.py index 5c43c78..9f432ad 100644 --- a/smarttub/api.py +++ b/smarttub/api.py @@ -373,6 +373,9 @@ def __init__(self, spa: Spa, state: dict): self.pumps = [ SpaPump(spa, **pump_props) for pump_props in self.properties["pumps"] ] + self.sensors = [ + SpaSensor(spa, **sensor_props) for sensor_props in self.properties.get("sensors", []) + ] class SpaWaterState(SpaState): @@ -558,6 +561,23 @@ def __str__(self): return f"" +class SpaSensor: + def __init__(self, spa: Spa, **properties): + self.spa = spa + self.address = properties["address"] + self.name = properties["name"] + self.type = properties["type"] + self.subType = properties["subType"] + + self.magnet = properties["magnet"] + self.pressure = properties["pressure"] + self.motion = properties["motion"] + self.fill_drain = properties["fill_drain"] + + def __str__(self): + return f"