def get_new_device(event, config, device):
 device_id = slugify(event.device.id_string.lower())
 if (device_id in RFX_DEVICES):
  return
 if (not config[ATTR_AUTOMATIC_ADD]):
  return
 pkt_id = ''.join(('{0:02x}'.format(x) for x in event.data))
 _LOGGER.info('Automatic add %s rfxtrx device (Class: %s Sub: %s Packet_id: %s)', device_id, event.device.__class__.__name__, event.device.subtype, pkt_id)
 datas = {ATTR_STATE: False, ATTR_FIREEVENT: False}
 signal_repetitions = config[CONF_SIGNAL_REPETITIONS]
 new_device = device(pkt_id, event, datas, signal_repetitions)
 RFX_DEVICES[device_id] = new_device
 return new_device

def get_new_device ( event , config , device ) : device_id = slugify ( event . device . id_string . lower ( ) ) if ( device_id in RFX_DEVICES ) : return if ( not config [ ATTR_AUTOMATIC_ADD ] ) : return pkt_id = '' . join ( ( '{0:02x}' . format ( x ) for x in event . data ) ) _LOGGER . info ( 'Automatic add %s rfxtrx device (Class: %s Sub: %s Packet_id: %s)' , device_id , event . device . __class__ . __name__ , event . device . subtype , pkt_id ) datas = { ATTR_STATE : False , ATTR_FIREEVENT : False } signal_repetitions = config [ CONF_SIGNAL_REPETITIONS ] new_device = device ( pkt_id , event , datas , signal_repetitions ) RFX_DEVICES [ device_id ] = new_device return new_device
add entity if not exist and the automatic_add is true .