mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Two fixes (#54102)
This commit is contained in:
parent
adc9f75493
commit
582f2ae2f6
@ -81,12 +81,12 @@ def _retrieve_max_kb_s_received_state(status: FritzStatus, last_value: str) -> f
|
|||||||
|
|
||||||
def _retrieve_gb_sent_state(status: FritzStatus, last_value: str) -> float:
|
def _retrieve_gb_sent_state(status: FritzStatus, last_value: str) -> float:
|
||||||
"""Return upload total data."""
|
"""Return upload total data."""
|
||||||
return round(status.bytes_sent * 8 / 1000 / 1000 / 1000, 1) # type: ignore[no-any-return]
|
return round(status.bytes_sent / 1000 / 1000 / 1000, 1) # type: ignore[no-any-return]
|
||||||
|
|
||||||
|
|
||||||
def _retrieve_gb_received_state(status: FritzStatus, last_value: str) -> float:
|
def _retrieve_gb_received_state(status: FritzStatus, last_value: str) -> float:
|
||||||
"""Return download total data."""
|
"""Return download total data."""
|
||||||
return round(status.bytes_received * 8 / 1000 / 1000 / 1000, 1) # type: ignore[no-any-return]
|
return round(status.bytes_received / 1000 / 1000 / 1000, 1) # type: ignore[no-any-return]
|
||||||
|
|
||||||
|
|
||||||
class SensorData(TypedDict, total=False):
|
class SensorData(TypedDict, total=False):
|
||||||
|
@ -13,7 +13,6 @@ from fritzconnection.core.exceptions import (
|
|||||||
FritzSecurityError,
|
FritzSecurityError,
|
||||||
FritzServiceError,
|
FritzServiceError,
|
||||||
)
|
)
|
||||||
import slugify as unicode_slug
|
|
||||||
import xmltodict
|
import xmltodict
|
||||||
|
|
||||||
from homeassistant.components.network import async_get_source_ip
|
from homeassistant.components.network import async_get_source_ip
|
||||||
@ -248,10 +247,18 @@ def wifi_entities_list(
|
|||||||
)
|
)
|
||||||
if network_info:
|
if network_info:
|
||||||
ssid = network_info["NewSSID"]
|
ssid = network_info["NewSSID"]
|
||||||
if unicode_slug.slugify(ssid, lowercase=False) in networks.values():
|
_LOGGER.debug("SSID from device: <%s>", ssid)
|
||||||
|
if (
|
||||||
|
slugify(
|
||||||
|
ssid,
|
||||||
|
)
|
||||||
|
in [slugify(v) for v in networks.values()]
|
||||||
|
):
|
||||||
|
_LOGGER.debug("SSID duplicated, adding suffix")
|
||||||
networks[i] = f'{ssid} {std_table[network_info["NewStandard"]]}'
|
networks[i] = f'{ssid} {std_table[network_info["NewStandard"]]}'
|
||||||
else:
|
else:
|
||||||
networks[i] = ssid
|
networks[i] = ssid
|
||||||
|
_LOGGER.debug("SSID normalized: <%s>", networks[i])
|
||||||
|
|
||||||
return [
|
return [
|
||||||
FritzBoxWifiSwitch(fritzbox_tools, device_friendly_name, net, network_name)
|
FritzBoxWifiSwitch(fritzbox_tools, device_friendly_name, net, network_name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user