pull/54149/head
Simone Chemelli 2021-08-06 04:24:41 +02:00 committed by GitHub
parent adc9f75493
commit 582f2ae2f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View File

@ -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:
"""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:
"""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):

View File

@ -13,7 +13,6 @@ from fritzconnection.core.exceptions import (
FritzSecurityError,
FritzServiceError,
)
import slugify as unicode_slug
import xmltodict
from homeassistant.components.network import async_get_source_ip
@ -248,10 +247,18 @@ def wifi_entities_list(
)
if network_info:
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"]]}'
else:
networks[i] = ssid
_LOGGER.debug("SSID normalized: <%s>", networks[i])
return [
FritzBoxWifiSwitch(fritzbox_tools, device_friendly_name, net, network_name)