def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the NAD platform.""" if config.get(CONF_TYPE) == 'RS232': from nad_receiver import NADReceiver add_entities([ NAD(config.get(CONF_NAME), NADReceiver( config.get(CONF_SERIAL_PORT)), config.get(CONF_MIN_VOLUME), config.get(CONF_MAX_VOLUME), config.get(CONF_SOURCE_DICT)) ], True) elif config.get(CONF_TYPE) == 'Telnet': from nad_receiver import NADReceiverTelnet add_entities([ NAD( config.get(CONF_NAME), NADReceiverTelnet(config.get(CONF_HOST), config.get(CONF_PORT)), config.get(CONF_MIN_VOLUME), config.get(CONF_MAX_VOLUME), config.get(CONF_SOURCE_DICT)) ], True) else: from nad_receiver import NADReceiverTCP add_entities([ NADtcp( config.get(CONF_NAME), NADReceiverTCP(config.get(CONF_HOST)), config.get(CONF_MIN_VOLUME), config.get(CONF_MAX_VOLUME), config.get(CONF_VOLUME_STEP), ) ], True)
def _instantiate_nad_receiver(self) -> NADReceiver: if self.config[CONF_TYPE] == "RS232": self._nad_receiver = NADReceiver(self.config[CONF_SERIAL_PORT]) else: host = self.config.get(CONF_HOST) port = self.config[CONF_PORT] self._nad_receiver = NADReceiverTelnet(host, port)
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the NAD platform.""" from nad_receiver import NADReceiver add_entities([ NAD(config.get(CONF_NAME), NADReceiver(config.get(CONF_SERIAL_PORT)), config.get(CONF_MIN_VOLUME), config.get(CONF_MAX_VOLUME), config.get(CONF_SOURCE_DICT)) ], True)
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the NAD platform.""" if config.get(CONF_TYPE) == "RS232": add_entities( [ NAD( config.get(CONF_NAME), NADReceiver(config.get(CONF_SERIAL_PORT)), config.get(CONF_MIN_VOLUME), config.get(CONF_MAX_VOLUME), config.get(CONF_SOURCE_DICT), ) ], True, ) elif config.get(CONF_TYPE) == "Telnet": add_entities( [ NAD( config.get(CONF_NAME), NADReceiverTelnet(config.get(CONF_HOST), config.get(CONF_PORT)), config.get(CONF_MIN_VOLUME), config.get(CONF_MAX_VOLUME), config.get(CONF_SOURCE_DICT), ) ], True, ) else: add_entities( [ NADtcp( config.get(CONF_NAME), NADReceiverTCP(config.get(CONF_HOST)), config.get(CONF_MIN_VOLUME), config.get(CONF_MAX_VOLUME), config.get(CONF_VOLUME_STEP), ) ], True, )