def entity_id_to_number(self, entity_id):
    'Get a unique number for the entity id.'
    if (self.type == TYPE_ALEXA):
        return entity_id
    if (self.numbers is None):
        self.numbers = _load_json(self.hass.config.path(NUMBERS_FILE))
    for (number, ent_id) in self.numbers.items():
        if (entity_id == ent_id):
            return number
    number = '1'
    if self.numbers:
        number = str((max((int(k) for k in self.numbers)) + 1))
    self.numbers[number] = entity_id
    save_json(self.hass.config.path(NUMBERS_FILE), self.numbers)
    return number
Get a unique number for the entity id.
def entity_id_to_number(self, entity_id):
    
    if (self.type == TYPE_ALEXA):
        return entity_id
    if (self.numbers is None):
        self.numbers = _load_json(self.hass.config.path(NUMBERS_FILE))
    for (number, ent_id) in self.numbers.items():
        if (entity_id == ent_id):
            return number
    number = '1'
    if self.numbers:
        number = str((max((int(k) for k in self.numbers)) + 1))
    self.numbers[number] = entity_id
    save_json(self.hass.config.path(NUMBERS_FILE), self.numbers)
    return number