def setup_platform(hass, config, add_devices, discovery_info=None): """Set up the cartridge sensor.""" host = config.get(CONF_HOST) api = EpsonPrinterAPI(host) if not api.available: raise PlatformNotReady() sensors = [ EpsonPrinterCartridge(api, description) for description in SENSOR_TYPES if description.key in config[CONF_MONITORED_CONDITIONS] ] add_devices(sensors, True)
def setup_platform(hass, config, add_devices, discovery_info=None): """Set up the cartridge sensor.""" host = config.get(CONF_HOST) from epsonprinter_pkg.epsonprinterapi import EpsonPrinterAPI api = EpsonPrinterAPI(host) if not api.available: raise PlatformNotReady() sensors = [ EpsonPrinterCartridge(api, condition) for condition in config[CONF_MONITORED_CONDITIONS] ] add_devices(sensors, True)
def setup_platform( hass: HomeAssistant, config: ConfigType, add_devices: AddEntitiesCallback, discovery_info: DiscoveryInfoType | None = None, ) -> None: """Set up the cartridge sensor.""" host = config.get(CONF_HOST) api = EpsonPrinterAPI(host) if not api.available: raise PlatformNotReady() sensors = [ EpsonPrinterCartridge(api, description) for description in SENSOR_TYPES if description.key in config[CONF_MONITORED_CONDITIONS] ] add_devices(sensors, True)