diff --git a/examples/masters/dump_masters.py b/examples/masters/dump_masters.py index b03913c9..2cabf061 100644 --- a/examples/masters/dump_masters.py +++ b/examples/masters/dump_masters.py @@ -25,7 +25,11 @@ async def main() -> None: async with Vantage(args.host, args.username, args.password) as vantage: # Print out the id and name of each Vantage controller async for master in vantage.masters: - print(f"[{master.id}] '{master.name}' serial_number={master.serial_number}") + print( + f"[{master.id}] '{master.name}' " + f"serial_number={master.serial_number} " + f"firmware_version={master.firmware_version}" + ) with contextlib.suppress(KeyboardInterrupt): diff --git a/src/aiovantage/controllers/masters.py b/src/aiovantage/controllers/masters.py index d02cb901..0067b301 100644 --- a/src/aiovantage/controllers/masters.py +++ b/src/aiovantage/controllers/masters.py @@ -29,15 +29,9 @@ class MastersController( @override async def fetch_object_state(self, vid: int) -> None: """Fetch the state properties of a Vantage controller.""" - state: dict[str, Any] = {} - - # IntrospectionInterface is not available on 2.x firmware. - with suppress(CommandError): - state["firmware_version"] = ( - await IntrospectionInterface.get_firmware_version( - self, vid, self.Firmware.Application - ) - ) + state: dict[str, Any] = { + "firmware_version": await self.get_version(), + } # ObjectInterface is not available on 2.x firmware. with suppress(CommandError): @@ -58,3 +52,14 @@ def handle_interface_status( } self.update_state(vid, state) + + async def get_version(self) -> str: + """Get the firmware version of a Vantage controller. + + Returns: + The firmware version of the controller. + """ + # VERSION + # -> R:VERSION {version} + response = await self.command_client.command("VERSION") + return response.args[0]