    def to_dict(self):
        """Convert class to serialisable dict for dump_devices."""
        out = {}
        for var, val in vars(self).items():
            if var == "scanners":
                scanout = {}
                for address, scanner in self.scanners.items():
                    scanout[address] = scanner.to_dict()
                # FIXME: val is overwritten
                val = scanout  # noqa
            out[var] = val
        return out
Convert class to serialisable dict for dump_devices.
custom_components/bermuda/bermuda_device.py