mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Fixed entity_id for the script component. Alias now does not override the entity_id
Fixed issue: #561
This commit is contained in:
parent
0a36c96a55
commit
de027609d8
@ -75,7 +75,7 @@ def setup(hass, config):
|
||||
_LOGGER.warn("Missing key 'sequence' for script %s", name)
|
||||
continue
|
||||
alias = cfg.get(CONF_ALIAS, name)
|
||||
script = Script(hass, alias, cfg[CONF_SEQUENCE])
|
||||
script = Script(hass, alias, name, cfg[CONF_SEQUENCE])
|
||||
component.add_entities((script,))
|
||||
_, object_id = split_entity_id(script.entity_id)
|
||||
hass.services.register(DOMAIN, object_id, service_handler)
|
||||
@ -100,9 +100,10 @@ def setup(hass, config):
|
||||
|
||||
class Script(ToggleEntity):
|
||||
""" Represents a script. """
|
||||
def __init__(self, hass, name, sequence):
|
||||
def __init__(self, hass, name, entity_id, sequence):
|
||||
self.hass = hass
|
||||
self._name = name
|
||||
self.entity_id = entity_id
|
||||
self.sequence = sequence
|
||||
self._lock = threading.Lock()
|
||||
self._cur = -1
|
||||
|
@ -65,8 +65,10 @@ class EntityComponent(object):
|
||||
if entity is not None and entity not in self.entities.values():
|
||||
entity.hass = self.hass
|
||||
|
||||
entity.entity_id = generate_entity_id(
|
||||
self.entity_id_format, entity.name, self.entities.keys())
|
||||
if entity.entity_id is None:
|
||||
entity.entity_id = generate_entity_id(
|
||||
self.entity_id_format, entity.name,
|
||||
self.entities.keys())
|
||||
|
||||
self.entities[entity.entity_id] = entity
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user