class BaseChromecast(dev.Device):
+ """A base class to represent a Google Chromecase device."""
+
ccasts: List[Any] = []
refresh_ts = None
browser = None
BaseChromecast.ccasts,
BaseChromecast.browser,
) = pychromecast.get_chromecasts(timeout=15.0)
- assert BaseChromecast.browser
+ assert BaseChromecast.browser is not None
atexit.register(BaseChromecast.browser.stop_discovery)
BaseChromecast.refresh_ts = now
self.cast = None
for cc in BaseChromecast.ccasts:
if cc.cast_info.host == ip and cc.cast_info.cast_type != 'group':
- logger.debug(f'Found chromecast at {ip}: {cc}')
+ logger.debug('Found chromecast at %s: %s', ip, cc)
self.cast = cc
self.cast.wait(timeout=1.0)
if self.cast is None:
- raise Exception(
- f'Can\'t find ccast device at {ip}, is that really a ccast device?'
- )
+ raise Exception(f'Can\'t find ccast device at {ip}, is that really a ccast device?')
def is_idle(self):
return self.cast.is_idle