mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Don't create DSL sensor for devices that don't support DSL (#55269)
This commit is contained in:
parent
f942cb03a4
commit
c3316df31d
@ -5,7 +5,12 @@ import datetime
|
|||||||
import logging
|
import logging
|
||||||
from typing import Callable, TypedDict
|
from typing import Callable, TypedDict
|
||||||
|
|
||||||
from fritzconnection.core.exceptions import FritzConnectionException
|
from fritzconnection.core.exceptions import (
|
||||||
|
FritzActionError,
|
||||||
|
FritzActionFailedError,
|
||||||
|
FritzConnectionException,
|
||||||
|
FritzServiceError,
|
||||||
|
)
|
||||||
from fritzconnection.lib.fritzstatus import FritzStatus
|
from fritzconnection.lib.fritzstatus import FritzStatus
|
||||||
|
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import (
|
||||||
@ -260,12 +265,16 @@ async def async_setup_entry(
|
|||||||
return
|
return
|
||||||
|
|
||||||
entities = []
|
entities = []
|
||||||
|
dsl: bool = False
|
||||||
|
try:
|
||||||
dslinterface = await hass.async_add_executor_job(
|
dslinterface = await hass.async_add_executor_job(
|
||||||
fritzbox_tools.connection.call_action,
|
fritzbox_tools.connection.call_action,
|
||||||
"WANDSLInterfaceConfig:1",
|
"WANDSLInterfaceConfig:1",
|
||||||
"GetInfo",
|
"GetInfo",
|
||||||
)
|
)
|
||||||
dsl: bool = dslinterface["NewEnable"]
|
dsl = dslinterface["NewEnable"]
|
||||||
|
except (FritzActionError, FritzActionFailedError, FritzServiceError):
|
||||||
|
pass
|
||||||
|
|
||||||
for sensor_type, sensor_data in SENSOR_DATA.items():
|
for sensor_type, sensor_data in SENSOR_DATA.items():
|
||||||
if not dsl and sensor_data.get("connection_type") == DSL_CONNECTION:
|
if not dsl and sensor_data.get("connection_type") == DSL_CONNECTION:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user