def find_devices(): devices = HdhrUtility.discover_find_devices_custom() for device in devices: print("Found: %s" % (device)) return devices
def __init__(self, parent_info, device_str): """Initialize the sensor.""" self._id = device_str self._device_info = parent_info self._adapter = HdhrDeviceQuery( HdhrUtility.device_create_from_str(device_str)) self._state = None
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up HDHomeRun from a config entry.""" hosts = hass.data[DOMAIN].get(SENSOR_DOMAIN) devices = [] if hosts: # Priority 1: manual config for host in hosts: ip = host[CONF_HOST] _LOGGER.debug('Fetching devices for manually-configured host: ' + ip) devices.extend(HdhrUtility.discover_find_devices_custom(ip=ip)) else: # Priority 2: scanned devices _LOGGER.debug('Scanning network for HDHomeRun devices') devices = HdhrUtility.discover_find_devices_custom() entities = [] for device in devices: device_id = device.nice_device_id tuner_count = device.tuner_count _LOGGER.debug("Detected %d tuners for device: %s" % (tuner_count, device_id)) adapter = HdhrDeviceQuery( HdhrUtility.device_create_from_str(device_id)) device_info = { 'identifiers': {(DOMAIN, device_id)}, 'name': 'HDHomeRun ' + device_id, 'manufacturer': 'SiliconDust', 'model': adapter.get_model_str(), 'sw_version': adapter.get_version(), } for tuner in range(0, tuner_count): tuner_str = "%s-%d" % (device_id, tuner) entities.append(TunerSensor(device_info, tuner_str)) async_add_entities(entities, update_before_add=True) return True
def get_count(): return HdhrUtility.get_channels_in_range(MAP_US_CABLE)
def get_count(): return HdhrUtility.get_channels_in_range(MAP_US_CABLE) devices = find_devices() if not devices: print("Could not find any devices.") exit() i = 0 for device in devices: print("%d: %s" % (i, device)) hd = HdhrUtility.device_create_from_str(device.nice_device_id) device_adapter = HdhrDeviceQuery(hd) hw_model = device_adapter.get_hw_model_str() print("HW Model: %s" % (hw_model)) model = device_adapter.get_model_str() print("Model: %s" % (model)) version = device_adapter.get_version() print("Version: %s" % (version)) features = device_adapter.get_supported() print("Features: %s" % (features)) i += 1
async def _async_has_devices(hass): """Return if there are devices that can be discovered.""" hdhr_devices = HdhrUtility.discover_find_devices_custom() return len(hdhr_devices) > 0