def _get_devices(hass, discovery_type, keys, proxy):
 device_arr = []
 for key in keys:
  device = hass.data[DATA_HOMEMATIC].devices[proxy][key]
  class_name = device.__class__.__name__
  metadata = {}
  if (class_name not in HM_DEVICE_TYPES[discovery_type]):
   continue
  if (discovery_type == DISCOVER_SENSORS):
   metadata.update(device.SENSORNODE)
  elif (discovery_type == DISCOVER_BINARY_SENSORS):
   metadata.update(device.BINARYNODE)
  else:
   metadata.update({None: device.ELEMENT})
  if metadata:
   for (param, channels) in metadata.items():
    if (param in HM_IGNORE_DISCOVERY_NODE):
     continue
    _LOGGER.debug('%s: Handling %s: %s: %s', discovery_type, key, param, channels)
    for channel in channels:
     name = _create_ha_name(name=device.NAME, channel=channel, param=param, count=len(channels))
     device_dict = {CONF_PLATFORM: 'homematic', ATTR_ADDRESS: key, ATTR_PROXY: proxy, ATTR_NAME: name, ATTR_CHANNEL: channel}
     if (param is not None):
      device_dict[ATTR_PARAM] = param
     try:
      DEVICE_SCHEMA(device_dict)
      device_arr.append(device_dict)
     except vol.MultipleInvalid as err:
      _LOGGER.error('Invalid device config: %s', str(err))
  else:
   _LOGGER.debug('Got no params for %s', key)
 _LOGGER.debug('%s autodiscovery done: %s', discovery_type, str(device_arr))
 return device_arr

def _get_devices ( hass , discovery_type , keys , proxy ) : device_arr = [ ] for key in keys : device = hass . data [ DATA_HOMEMATIC ] . devices [ proxy ] [ key ] class_name = device . __class__ . __name__ metadata = { } if ( class_name not in HM_DEVICE_TYPES [ discovery_type ] ) : continue if ( discovery_type == DISCOVER_SENSORS ) : metadata . update ( device . SENSORNODE ) elif ( discovery_type == DISCOVER_BINARY_SENSORS ) : metadata . update ( device . BINARYNODE ) else : metadata . update ( { None : device . ELEMENT } ) if metadata : for ( param , channels ) in metadata . items ( ) : if ( param in HM_IGNORE_DISCOVERY_NODE ) : continue _LOGGER . debug ( '%s: Handling %s: %s: %s' , discovery_type , key , param , channels ) for channel in channels : name = _create_ha_name ( name = device . NAME , channel = channel , param = param , count = len ( channels ) ) device_dict = { CONF_PLATFORM : 'homematic' , ATTR_ADDRESS : key , ATTR_PROXY : proxy , ATTR_NAME : name , ATTR_CHANNEL : channel } if ( param is not None ) : device_dict [ ATTR_PARAM ] = param try : DEVICE_SCHEMA ( device_dict ) device_arr . append ( device_dict ) except vol . MultipleInvalid as err : _LOGGER . error ( 'Invalid device config: %s' , str ( err ) ) else : _LOGGER . debug ( 'Got no params for %s' , key ) _LOGGER . debug ( '%s autodiscovery done: %s' , discovery_type , str ( device_arr ) ) return device_arr
parse device(s) id(s) from the common params .