Unescape device names (fixes #12)
This commit is contained in:
parent
6e4285f824
commit
6f17edae14
1 changed files with 4 additions and 0 deletions
|
@ -8,6 +8,7 @@ import asyncio
|
||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
import re
|
import re
|
||||||
|
import html
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
|
@ -249,6 +250,9 @@ async def get_devices(hass: HomeAssistant, session: aiohttp.ClientSession, entry
|
||||||
devices_data = response_json["deviceList"]
|
devices_data = response_json["deviceList"]
|
||||||
devices = []
|
devices = []
|
||||||
for device in devices_data:
|
for device in devices_data:
|
||||||
|
# Double unescaping required. Example:
|
||||||
|
# "Benedev's S22" first becomes "Benedev's S22" and then "Benedev's S22"
|
||||||
|
device['modelName'] = html.unescape(html.unescape(device['modelName']))
|
||||||
identifier = (DOMAIN, device['dvceID'])
|
identifier = (DOMAIN, device['dvceID'])
|
||||||
ha_dev = device_registry.async_get(hass).async_get_device({identifier})
|
ha_dev = device_registry.async_get(hass).async_get_device({identifier})
|
||||||
if ha_dev and ha_dev.disabled:
|
if ha_dev and ha_dev.disabled:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue