mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 17:27:10 +00:00
Fix Hue linking with non ASCII chars in location (#29213)
* Fix Hue linking with non ASCII chars in location * Use slugify
This commit is contained in:
parent
8908dba5b4
commit
2bdf7fc8f5
@ -3,6 +3,7 @@ import asyncio
|
|||||||
|
|
||||||
import aiohue
|
import aiohue
|
||||||
import async_timeout
|
import async_timeout
|
||||||
|
import slugify as unicode_slug
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
@ -173,7 +174,11 @@ async def get_bridge(hass, host, username=None):
|
|||||||
with async_timeout.timeout(10):
|
with async_timeout.timeout(10):
|
||||||
# Create username if we don't have one
|
# Create username if we don't have one
|
||||||
if not username:
|
if not username:
|
||||||
await bridge.create_user(f"home-assistant#{hass.config.location_name}")
|
device_name = unicode_slug.slugify(
|
||||||
|
hass.config.location_name, max_length=19
|
||||||
|
)
|
||||||
|
await bridge.create_user(f"home-assistant#{device_name}")
|
||||||
|
|
||||||
# Initialize bridge (and validate our username)
|
# Initialize bridge (and validate our username)
|
||||||
await bridge.initialize()
|
await bridge.initialize()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user