mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Fix entity id naming when not using first install (#23606)
* Fix entity id naming when not using first install Currently, the verisure component will use the alias of the first installation to decide entity id of the alarm_control_panel even though a different installation is configured through a specified giid. This fixes that * Fixed pulled request review comments * Remove trailing whitespace * Fix remaining pylint errors
This commit is contained in:
parent
1de0a0bbb9
commit
3d79bf2bfe
@ -6,7 +6,7 @@ import homeassistant.components.alarm_control_panel as alarm
|
|||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED)
|
STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_HOME, STATE_ALARM_DISARMED)
|
||||||
|
|
||||||
from . import CONF_ALARM, CONF_CODE_DIGITS, HUB as hub
|
from . import CONF_ALARM, CONF_CODE_DIGITS, CONF_GIID, HUB as hub
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -45,6 +45,14 @@ class VerisureAlarm(alarm.AlarmControlPanel):
|
|||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
"""Return the name of the device."""
|
"""Return the name of the device."""
|
||||||
|
giid = hub.config.get(CONF_GIID)
|
||||||
|
if giid is not None:
|
||||||
|
aliass = {i['giid']: i['alias'] for i in hub.session.installations}
|
||||||
|
if giid in aliass.keys():
|
||||||
|
return '{} alarm'.format(aliass[giid])
|
||||||
|
|
||||||
|
_LOGGER.error('Verisure installation giid not found: %s', giid)
|
||||||
|
|
||||||
return '{} alarm'.format(hub.session.installations[0]['alias'])
|
return '{} alarm'.format(hub.session.installations[0]['alias'])
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Loading…
x
Reference in New Issue
Block a user