Fix Name of Homematic IP accesspoint in devices, if name is configured (#21617)

* Fix Name of Accesspoint if name is configured

* fix lint

* Simplyfied naming

* applied suggestion

Co-Authored-By: SukramJ <markus@mm-jankowski.de>

* update comment
This commit is contained in:
Markus Jankowski 2019-03-07 11:07:32 +01:00 committed by Martin Hjelmare
parent 9c70b00403
commit a46458d04f

View file

@ -60,11 +60,14 @@ async def async_setup_entry(hass, entry):
# Register hap as device in registry.
device_registry = await dr.async_get_registry(hass)
home = hap.home
# Add the HAP name from configuration if set.
hapname = home.label \
if not home.name else "{} {}".format(home.label, home.name)
device_registry.async_get_or_create(
config_entry_id=home.id,
identifiers={(DOMAIN, home.id)},
manufacturer='eQ-3',
name=home.label,
name=hapname,
model=home.modelType,
sw_version=home.currentAPVersion,
)