mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 05:47:10 +00:00
Use entity name translations in SFR Box (#90698)
This commit is contained in:
parent
5835ae03bc
commit
f9e4fe016f
@ -42,28 +42,28 @@ class SFRBoxBinarySensorEntityDescription(
|
|||||||
DSL_SENSOR_TYPES: tuple[SFRBoxBinarySensorEntityDescription[DslInfo], ...] = (
|
DSL_SENSOR_TYPES: tuple[SFRBoxBinarySensorEntityDescription[DslInfo], ...] = (
|
||||||
SFRBoxBinarySensorEntityDescription[DslInfo](
|
SFRBoxBinarySensorEntityDescription[DslInfo](
|
||||||
key="status",
|
key="status",
|
||||||
name="DSL status",
|
|
||||||
device_class=BinarySensorDeviceClass.CONNECTIVITY,
|
device_class=BinarySensorDeviceClass.CONNECTIVITY,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
value_fn=lambda x: x.status == "up",
|
value_fn=lambda x: x.status == "up",
|
||||||
|
translation_key="dsl_status",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
FTTH_SENSOR_TYPES: tuple[SFRBoxBinarySensorEntityDescription[FtthInfo], ...] = (
|
FTTH_SENSOR_TYPES: tuple[SFRBoxBinarySensorEntityDescription[FtthInfo], ...] = (
|
||||||
SFRBoxBinarySensorEntityDescription[FtthInfo](
|
SFRBoxBinarySensorEntityDescription[FtthInfo](
|
||||||
key="status",
|
key="status",
|
||||||
name="FTTH status",
|
|
||||||
device_class=BinarySensorDeviceClass.CONNECTIVITY,
|
device_class=BinarySensorDeviceClass.CONNECTIVITY,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
value_fn=lambda x: x.status == "up",
|
value_fn=lambda x: x.status == "up",
|
||||||
|
translation_key="ftth_status",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
WAN_SENSOR_TYPES: tuple[SFRBoxBinarySensorEntityDescription[WanInfo], ...] = (
|
WAN_SENSOR_TYPES: tuple[SFRBoxBinarySensorEntityDescription[WanInfo], ...] = (
|
||||||
SFRBoxBinarySensorEntityDescription[WanInfo](
|
SFRBoxBinarySensorEntityDescription[WanInfo](
|
||||||
key="status",
|
key="status",
|
||||||
name="WAN status",
|
|
||||||
device_class=BinarySensorDeviceClass.CONNECTIVITY,
|
device_class=BinarySensorDeviceClass.CONNECTIVITY,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
value_fn=lambda x: x.status == "up",
|
value_fn=lambda x: x.status == "up",
|
||||||
|
translation_key="wan_status",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ BUTTON_TYPES: tuple[SFRBoxButtonEntityDescription, ...] = (
|
|||||||
device_class=ButtonDeviceClass.RESTART,
|
device_class=ButtonDeviceClass.RESTART,
|
||||||
entity_category=EntityCategory.CONFIG,
|
entity_category=EntityCategory.CONFIG,
|
||||||
key="system_reboot",
|
key="system_reboot",
|
||||||
name="Reboot",
|
translation_key="reboot",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -46,84 +46,83 @@ class SFRBoxSensorEntityDescription(SensorEntityDescription, SFRBoxSensorMixin[_
|
|||||||
DSL_SENSOR_TYPES: tuple[SFRBoxSensorEntityDescription[DslInfo], ...] = (
|
DSL_SENSOR_TYPES: tuple[SFRBoxSensorEntityDescription[DslInfo], ...] = (
|
||||||
SFRBoxSensorEntityDescription[DslInfo](
|
SFRBoxSensorEntityDescription[DslInfo](
|
||||||
key="linemode",
|
key="linemode",
|
||||||
name="DSL line mode",
|
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
|
translation_key="dsl_linemode",
|
||||||
value_fn=lambda x: x.linemode,
|
value_fn=lambda x: x.linemode,
|
||||||
),
|
),
|
||||||
SFRBoxSensorEntityDescription[DslInfo](
|
SFRBoxSensorEntityDescription[DslInfo](
|
||||||
key="counter",
|
key="counter",
|
||||||
name="DSL counter",
|
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
|
translation_key="dsl_counter",
|
||||||
value_fn=lambda x: x.counter,
|
value_fn=lambda x: x.counter,
|
||||||
),
|
),
|
||||||
SFRBoxSensorEntityDescription[DslInfo](
|
SFRBoxSensorEntityDescription[DslInfo](
|
||||||
key="crc",
|
key="crc",
|
||||||
name="DSL CRC",
|
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
|
translation_key="dsl_crc",
|
||||||
value_fn=lambda x: x.crc,
|
value_fn=lambda x: x.crc,
|
||||||
),
|
),
|
||||||
SFRBoxSensorEntityDescription[DslInfo](
|
SFRBoxSensorEntityDescription[DslInfo](
|
||||||
key="noise_down",
|
key="noise_down",
|
||||||
name="DSL noise down",
|
|
||||||
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS,
|
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
|
translation_key="dsl_noise_down",
|
||||||
value_fn=lambda x: x.noise_down,
|
value_fn=lambda x: x.noise_down,
|
||||||
),
|
),
|
||||||
SFRBoxSensorEntityDescription[DslInfo](
|
SFRBoxSensorEntityDescription[DslInfo](
|
||||||
key="noise_up",
|
key="noise_up",
|
||||||
name="DSL noise up",
|
|
||||||
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS,
|
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
|
translation_key="dsl_noise_up",
|
||||||
value_fn=lambda x: x.noise_up,
|
value_fn=lambda x: x.noise_up,
|
||||||
),
|
),
|
||||||
SFRBoxSensorEntityDescription[DslInfo](
|
SFRBoxSensorEntityDescription[DslInfo](
|
||||||
key="attenuation_down",
|
key="attenuation_down",
|
||||||
name="DSL attenuation down",
|
|
||||||
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS,
|
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
|
translation_key="dsl_attenuation_down",
|
||||||
value_fn=lambda x: x.attenuation_down,
|
value_fn=lambda x: x.attenuation_down,
|
||||||
),
|
),
|
||||||
SFRBoxSensorEntityDescription[DslInfo](
|
SFRBoxSensorEntityDescription[DslInfo](
|
||||||
key="attenuation_up",
|
key="attenuation_up",
|
||||||
name="DSL attenuation up",
|
|
||||||
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS,
|
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
|
translation_key="dsl_attenuation_up",
|
||||||
value_fn=lambda x: x.attenuation_up,
|
value_fn=lambda x: x.attenuation_up,
|
||||||
),
|
),
|
||||||
SFRBoxSensorEntityDescription[DslInfo](
|
SFRBoxSensorEntityDescription[DslInfo](
|
||||||
key="rate_down",
|
key="rate_down",
|
||||||
name="DSL rate down",
|
|
||||||
device_class=SensorDeviceClass.DATA_RATE,
|
device_class=SensorDeviceClass.DATA_RATE,
|
||||||
native_unit_of_measurement=UnitOfDataRate.KILOBITS_PER_SECOND,
|
native_unit_of_measurement=UnitOfDataRate.KILOBITS_PER_SECOND,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
|
translation_key="dsl_rate_down",
|
||||||
value_fn=lambda x: x.rate_down,
|
value_fn=lambda x: x.rate_down,
|
||||||
),
|
),
|
||||||
SFRBoxSensorEntityDescription[DslInfo](
|
SFRBoxSensorEntityDescription[DslInfo](
|
||||||
key="rate_up",
|
key="rate_up",
|
||||||
name="DSL rate up",
|
|
||||||
device_class=SensorDeviceClass.DATA_RATE,
|
device_class=SensorDeviceClass.DATA_RATE,
|
||||||
native_unit_of_measurement=UnitOfDataRate.KILOBITS_PER_SECOND,
|
native_unit_of_measurement=UnitOfDataRate.KILOBITS_PER_SECOND,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
|
translation_key="dsl_rate_up",
|
||||||
value_fn=lambda x: x.rate_up,
|
value_fn=lambda x: x.rate_up,
|
||||||
),
|
),
|
||||||
SFRBoxSensorEntityDescription[DslInfo](
|
SFRBoxSensorEntityDescription[DslInfo](
|
||||||
key="line_status",
|
key="line_status",
|
||||||
name="DSL line status",
|
|
||||||
device_class=SensorDeviceClass.ENUM,
|
device_class=SensorDeviceClass.ENUM,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
@ -135,12 +134,11 @@ DSL_SENSOR_TYPES: tuple[SFRBoxSensorEntityDescription[DslInfo], ...] = (
|
|||||||
"loss_of_signal_quality",
|
"loss_of_signal_quality",
|
||||||
"unknown",
|
"unknown",
|
||||||
],
|
],
|
||||||
translation_key="line_status",
|
translation_key="dsl_line_status",
|
||||||
value_fn=lambda x: x.line_status.lower().replace(" ", "_"),
|
value_fn=lambda x: x.line_status.lower().replace(" ", "_"),
|
||||||
),
|
),
|
||||||
SFRBoxSensorEntityDescription[DslInfo](
|
SFRBoxSensorEntityDescription[DslInfo](
|
||||||
key="training",
|
key="training",
|
||||||
name="DSL training",
|
|
||||||
device_class=SensorDeviceClass.ENUM,
|
device_class=SensorDeviceClass.ENUM,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
@ -156,14 +154,13 @@ DSL_SENSOR_TYPES: tuple[SFRBoxSensorEntityDescription[DslInfo], ...] = (
|
|||||||
"showtime",
|
"showtime",
|
||||||
"unknown",
|
"unknown",
|
||||||
],
|
],
|
||||||
translation_key="training",
|
translation_key="dsl_training",
|
||||||
value_fn=lambda x: x.training.lower().replace(" ", "_").replace(".", "_"),
|
value_fn=lambda x: x.training.lower().replace(" ", "_").replace(".", "_"),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
SYSTEM_SENSOR_TYPES: tuple[SFRBoxSensorEntityDescription[SystemInfo], ...] = (
|
SYSTEM_SENSOR_TYPES: tuple[SFRBoxSensorEntityDescription[SystemInfo], ...] = (
|
||||||
SFRBoxSensorEntityDescription[SystemInfo](
|
SFRBoxSensorEntityDescription[SystemInfo](
|
||||||
key="net_infra",
|
key="net_infra",
|
||||||
name="Network infrastructure",
|
|
||||||
device_class=SensorDeviceClass.ENUM,
|
device_class=SensorDeviceClass.ENUM,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
@ -178,27 +175,26 @@ SYSTEM_SENSOR_TYPES: tuple[SFRBoxSensorEntityDescription[SystemInfo], ...] = (
|
|||||||
),
|
),
|
||||||
SFRBoxSensorEntityDescription[SystemInfo](
|
SFRBoxSensorEntityDescription[SystemInfo](
|
||||||
key="alimvoltage",
|
key="alimvoltage",
|
||||||
name="Voltage",
|
|
||||||
device_class=SensorDeviceClass.VOLTAGE,
|
device_class=SensorDeviceClass.VOLTAGE,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
native_unit_of_measurement=UnitOfElectricPotential.MILLIVOLT,
|
native_unit_of_measurement=UnitOfElectricPotential.MILLIVOLT,
|
||||||
|
translation_key="voltage",
|
||||||
value_fn=lambda x: x.alimvoltage,
|
value_fn=lambda x: x.alimvoltage,
|
||||||
),
|
),
|
||||||
SFRBoxSensorEntityDescription[SystemInfo](
|
SFRBoxSensorEntityDescription[SystemInfo](
|
||||||
key="temperature",
|
key="temperature",
|
||||||
name="Temperature",
|
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||||
|
translation_key="temperature",
|
||||||
value_fn=lambda x: x.temperature / 1000,
|
value_fn=lambda x: x.temperature / 1000,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
WAN_SENSOR_TYPES: tuple[SFRBoxSensorEntityDescription[WanInfo], ...] = (
|
WAN_SENSOR_TYPES: tuple[SFRBoxSensorEntityDescription[WanInfo], ...] = (
|
||||||
SFRBoxSensorEntityDescription[WanInfo](
|
SFRBoxSensorEntityDescription[WanInfo](
|
||||||
key="mode",
|
key="mode",
|
||||||
name="WAN mode",
|
|
||||||
device_class=SensorDeviceClass.ENUM,
|
device_class=SensorDeviceClass.ENUM,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
|
@ -31,8 +31,40 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"entity": {
|
"entity": {
|
||||||
|
"binary_sensor": {
|
||||||
|
"dsl_status": {
|
||||||
|
"name": "DSL status"
|
||||||
|
},
|
||||||
|
"ftth_status": {
|
||||||
|
"name": "FTTH status"
|
||||||
|
},
|
||||||
|
"wan_status": {
|
||||||
|
"name": "WAN status"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"button": {
|
||||||
|
"reboot": {
|
||||||
|
"name": "[%key:component::button::entity_component::restart::name%]"
|
||||||
|
}
|
||||||
|
},
|
||||||
"sensor": {
|
"sensor": {
|
||||||
"line_status": {
|
"dsl_attenuation_down": {
|
||||||
|
"name": "DSL attenuation down"
|
||||||
|
},
|
||||||
|
"dsl_attenuation_up": {
|
||||||
|
"name": "DSL attenuation up"
|
||||||
|
},
|
||||||
|
"dsl_crc": {
|
||||||
|
"name": "DSL CRC"
|
||||||
|
},
|
||||||
|
"dsl_counter": {
|
||||||
|
"name": "DSL counter"
|
||||||
|
},
|
||||||
|
"dsl_linemode": {
|
||||||
|
"name": "DSL line mode"
|
||||||
|
},
|
||||||
|
"dsl_line_status": {
|
||||||
|
"name": "DSL line status",
|
||||||
"state": {
|
"state": {
|
||||||
"no_defect": "No Defect",
|
"no_defect": "No Defect",
|
||||||
"of_frame": "Of Frame",
|
"of_frame": "Of Frame",
|
||||||
@ -42,15 +74,20 @@
|
|||||||
"unknown": "Unknown"
|
"unknown": "Unknown"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"net_infra": {
|
"dsl_noise_down": {
|
||||||
"state": {
|
"name": "DSL noise down"
|
||||||
"adsl": "ADSL",
|
|
||||||
"ftth": "FTTH",
|
|
||||||
"gprs": "GPRS",
|
|
||||||
"unknown": "Unknown"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"training": {
|
"dsl_noise_up": {
|
||||||
|
"name": "DSL noise up"
|
||||||
|
},
|
||||||
|
"dsl_rate_down": {
|
||||||
|
"name": "DSL rate down"
|
||||||
|
},
|
||||||
|
"dsl_rate_up": {
|
||||||
|
"name": "DSL rate up"
|
||||||
|
},
|
||||||
|
"dsl_training": {
|
||||||
|
"name": "DSL training",
|
||||||
"state": {
|
"state": {
|
||||||
"idle": "Idle",
|
"idle": "Idle",
|
||||||
"g_994_training": "G.994 Training",
|
"g_994_training": "G.994 Training",
|
||||||
@ -64,7 +101,23 @@
|
|||||||
"unknown": "Unknown"
|
"unknown": "Unknown"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"net_infra": {
|
||||||
|
"name": "Network infrastructure",
|
||||||
|
"state": {
|
||||||
|
"adsl": "ADSL",
|
||||||
|
"ftth": "FTTH",
|
||||||
|
"gprs": "GPRS",
|
||||||
|
"unknown": "Unknown"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"temperature": {
|
||||||
|
"name": "[%key:component::sensor::entity_component::temperature::name%]"
|
||||||
|
},
|
||||||
|
"voltage": {
|
||||||
|
"name": "[%key:component::sensor::entity_component::voltage::name%]"
|
||||||
|
},
|
||||||
"wan_mode": {
|
"wan_mode": {
|
||||||
|
"name": "WAN mode",
|
||||||
"state": {
|
"state": {
|
||||||
"adsl_ppp": "ADSL (PPP)",
|
"adsl_ppp": "ADSL (PPP)",
|
||||||
"adsl_routed": "ADSL (Routed)",
|
"adsl_routed": "ADSL (Routed)",
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
'original_name': 'WAN status',
|
'original_name': 'WAN status',
|
||||||
'platform': 'sfr_box',
|
'platform': 'sfr_box',
|
||||||
'supported_features': 0,
|
'supported_features': 0,
|
||||||
'translation_key': None,
|
'translation_key': 'wan_status',
|
||||||
'unique_id': 'e4:5d:51:00:11:22_wan_status',
|
'unique_id': 'e4:5d:51:00:11:22_wan_status',
|
||||||
'unit_of_measurement': None,
|
'unit_of_measurement': None,
|
||||||
}),
|
}),
|
||||||
@ -82,7 +82,7 @@
|
|||||||
'original_name': 'DSL status',
|
'original_name': 'DSL status',
|
||||||
'platform': 'sfr_box',
|
'platform': 'sfr_box',
|
||||||
'supported_features': 0,
|
'supported_features': 0,
|
||||||
'translation_key': None,
|
'translation_key': 'dsl_status',
|
||||||
'unique_id': 'e4:5d:51:00:11:22_dsl_status',
|
'unique_id': 'e4:5d:51:00:11:22_dsl_status',
|
||||||
'unit_of_measurement': None,
|
'unit_of_measurement': None,
|
||||||
}),
|
}),
|
||||||
@ -169,7 +169,7 @@
|
|||||||
'original_name': 'WAN status',
|
'original_name': 'WAN status',
|
||||||
'platform': 'sfr_box',
|
'platform': 'sfr_box',
|
||||||
'supported_features': 0,
|
'supported_features': 0,
|
||||||
'translation_key': None,
|
'translation_key': 'wan_status',
|
||||||
'unique_id': 'e4:5d:51:00:11:22_wan_status',
|
'unique_id': 'e4:5d:51:00:11:22_wan_status',
|
||||||
'unit_of_measurement': None,
|
'unit_of_measurement': None,
|
||||||
}),
|
}),
|
||||||
@ -197,7 +197,7 @@
|
|||||||
'original_name': 'FTTH status',
|
'original_name': 'FTTH status',
|
||||||
'platform': 'sfr_box',
|
'platform': 'sfr_box',
|
||||||
'supported_features': 0,
|
'supported_features': 0,
|
||||||
'translation_key': None,
|
'translation_key': 'ftth_status',
|
||||||
'unique_id': 'e4:5d:51:00:11:22_ftth_status',
|
'unique_id': 'e4:5d:51:00:11:22_ftth_status',
|
||||||
'unit_of_measurement': None,
|
'unit_of_measurement': None,
|
||||||
}),
|
}),
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
'disabled_by': None,
|
'disabled_by': None,
|
||||||
'domain': 'button',
|
'domain': 'button',
|
||||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||||
'entity_id': 'button.sfr_box_reboot',
|
'entity_id': 'button.sfr_box_restart',
|
||||||
'has_entity_name': True,
|
'has_entity_name': True,
|
||||||
'hidden_by': None,
|
'hidden_by': None,
|
||||||
'icon': None,
|
'icon': None,
|
||||||
@ -51,23 +51,23 @@
|
|||||||
}),
|
}),
|
||||||
'original_device_class': <ButtonDeviceClass.RESTART: 'restart'>,
|
'original_device_class': <ButtonDeviceClass.RESTART: 'restart'>,
|
||||||
'original_icon': None,
|
'original_icon': None,
|
||||||
'original_name': 'Reboot',
|
'original_name': 'Restart',
|
||||||
'platform': 'sfr_box',
|
'platform': 'sfr_box',
|
||||||
'supported_features': 0,
|
'supported_features': 0,
|
||||||
'translation_key': None,
|
'translation_key': 'reboot',
|
||||||
'unique_id': 'e4:5d:51:00:11:22_system_reboot',
|
'unique_id': 'e4:5d:51:00:11:22_system_reboot',
|
||||||
'unit_of_measurement': None,
|
'unit_of_measurement': None,
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
# ---
|
# ---
|
||||||
# name: test_buttons[button.sfr_box_reboot]
|
# name: test_buttons[button.sfr_box_restart]
|
||||||
StateSnapshot({
|
StateSnapshot({
|
||||||
'attributes': ReadOnlyDict({
|
'attributes': ReadOnlyDict({
|
||||||
'device_class': 'restart',
|
'device_class': 'restart',
|
||||||
'friendly_name': 'SFR Box Reboot',
|
'friendly_name': 'SFR Box Restart',
|
||||||
}),
|
}),
|
||||||
'context': <ANY>,
|
'context': <ANY>,
|
||||||
'entity_id': 'button.sfr_box_reboot',
|
'entity_id': 'button.sfr_box_restart',
|
||||||
'last_changed': <ANY>,
|
'last_changed': <ANY>,
|
||||||
'last_updated': <ANY>,
|
'last_updated': <ANY>,
|
||||||
'state': 'unknown',
|
'state': 'unknown',
|
||||||
|
@ -87,7 +87,7 @@
|
|||||||
'original_name': 'Voltage',
|
'original_name': 'Voltage',
|
||||||
'platform': 'sfr_box',
|
'platform': 'sfr_box',
|
||||||
'supported_features': 0,
|
'supported_features': 0,
|
||||||
'translation_key': None,
|
'translation_key': 'voltage',
|
||||||
'unique_id': 'e4:5d:51:00:11:22_system_alimvoltage',
|
'unique_id': 'e4:5d:51:00:11:22_system_alimvoltage',
|
||||||
'unit_of_measurement': <UnitOfElectricPotential.MILLIVOLT: 'mV'>,
|
'unit_of_measurement': <UnitOfElectricPotential.MILLIVOLT: 'mV'>,
|
||||||
}),
|
}),
|
||||||
@ -115,7 +115,7 @@
|
|||||||
'original_name': 'Temperature',
|
'original_name': 'Temperature',
|
||||||
'platform': 'sfr_box',
|
'platform': 'sfr_box',
|
||||||
'supported_features': 0,
|
'supported_features': 0,
|
||||||
'translation_key': None,
|
'translation_key': 'temperature',
|
||||||
'unique_id': 'e4:5d:51:00:11:22_system_temperature',
|
'unique_id': 'e4:5d:51:00:11:22_system_temperature',
|
||||||
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
||||||
}),
|
}),
|
||||||
@ -179,7 +179,7 @@
|
|||||||
'original_name': 'DSL line mode',
|
'original_name': 'DSL line mode',
|
||||||
'platform': 'sfr_box',
|
'platform': 'sfr_box',
|
||||||
'supported_features': 0,
|
'supported_features': 0,
|
||||||
'translation_key': None,
|
'translation_key': 'dsl_linemode',
|
||||||
'unique_id': 'e4:5d:51:00:11:22_dsl_linemode',
|
'unique_id': 'e4:5d:51:00:11:22_dsl_linemode',
|
||||||
'unit_of_measurement': None,
|
'unit_of_measurement': None,
|
||||||
}),
|
}),
|
||||||
@ -207,7 +207,7 @@
|
|||||||
'original_name': 'DSL counter',
|
'original_name': 'DSL counter',
|
||||||
'platform': 'sfr_box',
|
'platform': 'sfr_box',
|
||||||
'supported_features': 0,
|
'supported_features': 0,
|
||||||
'translation_key': None,
|
'translation_key': 'dsl_counter',
|
||||||
'unique_id': 'e4:5d:51:00:11:22_dsl_counter',
|
'unique_id': 'e4:5d:51:00:11:22_dsl_counter',
|
||||||
'unit_of_measurement': None,
|
'unit_of_measurement': None,
|
||||||
}),
|
}),
|
||||||
@ -235,7 +235,7 @@
|
|||||||
'original_name': 'DSL CRC',
|
'original_name': 'DSL CRC',
|
||||||
'platform': 'sfr_box',
|
'platform': 'sfr_box',
|
||||||
'supported_features': 0,
|
'supported_features': 0,
|
||||||
'translation_key': None,
|
'translation_key': 'dsl_crc',
|
||||||
'unique_id': 'e4:5d:51:00:11:22_dsl_crc',
|
'unique_id': 'e4:5d:51:00:11:22_dsl_crc',
|
||||||
'unit_of_measurement': None,
|
'unit_of_measurement': None,
|
||||||
}),
|
}),
|
||||||
@ -265,7 +265,7 @@
|
|||||||
'original_name': 'DSL noise down',
|
'original_name': 'DSL noise down',
|
||||||
'platform': 'sfr_box',
|
'platform': 'sfr_box',
|
||||||
'supported_features': 0,
|
'supported_features': 0,
|
||||||
'translation_key': None,
|
'translation_key': 'dsl_noise_down',
|
||||||
'unique_id': 'e4:5d:51:00:11:22_dsl_noise_down',
|
'unique_id': 'e4:5d:51:00:11:22_dsl_noise_down',
|
||||||
'unit_of_measurement': 'dB',
|
'unit_of_measurement': 'dB',
|
||||||
}),
|
}),
|
||||||
@ -295,7 +295,7 @@
|
|||||||
'original_name': 'DSL noise up',
|
'original_name': 'DSL noise up',
|
||||||
'platform': 'sfr_box',
|
'platform': 'sfr_box',
|
||||||
'supported_features': 0,
|
'supported_features': 0,
|
||||||
'translation_key': None,
|
'translation_key': 'dsl_noise_up',
|
||||||
'unique_id': 'e4:5d:51:00:11:22_dsl_noise_up',
|
'unique_id': 'e4:5d:51:00:11:22_dsl_noise_up',
|
||||||
'unit_of_measurement': 'dB',
|
'unit_of_measurement': 'dB',
|
||||||
}),
|
}),
|
||||||
@ -325,7 +325,7 @@
|
|||||||
'original_name': 'DSL attenuation down',
|
'original_name': 'DSL attenuation down',
|
||||||
'platform': 'sfr_box',
|
'platform': 'sfr_box',
|
||||||
'supported_features': 0,
|
'supported_features': 0,
|
||||||
'translation_key': None,
|
'translation_key': 'dsl_attenuation_down',
|
||||||
'unique_id': 'e4:5d:51:00:11:22_dsl_attenuation_down',
|
'unique_id': 'e4:5d:51:00:11:22_dsl_attenuation_down',
|
||||||
'unit_of_measurement': 'dB',
|
'unit_of_measurement': 'dB',
|
||||||
}),
|
}),
|
||||||
@ -355,7 +355,7 @@
|
|||||||
'original_name': 'DSL attenuation up',
|
'original_name': 'DSL attenuation up',
|
||||||
'platform': 'sfr_box',
|
'platform': 'sfr_box',
|
||||||
'supported_features': 0,
|
'supported_features': 0,
|
||||||
'translation_key': None,
|
'translation_key': 'dsl_attenuation_up',
|
||||||
'unique_id': 'e4:5d:51:00:11:22_dsl_attenuation_up',
|
'unique_id': 'e4:5d:51:00:11:22_dsl_attenuation_up',
|
||||||
'unit_of_measurement': 'dB',
|
'unit_of_measurement': 'dB',
|
||||||
}),
|
}),
|
||||||
@ -385,7 +385,7 @@
|
|||||||
'original_name': 'DSL rate down',
|
'original_name': 'DSL rate down',
|
||||||
'platform': 'sfr_box',
|
'platform': 'sfr_box',
|
||||||
'supported_features': 0,
|
'supported_features': 0,
|
||||||
'translation_key': None,
|
'translation_key': 'dsl_rate_down',
|
||||||
'unique_id': 'e4:5d:51:00:11:22_dsl_rate_down',
|
'unique_id': 'e4:5d:51:00:11:22_dsl_rate_down',
|
||||||
'unit_of_measurement': <UnitOfDataRate.KILOBITS_PER_SECOND: 'kbit/s'>,
|
'unit_of_measurement': <UnitOfDataRate.KILOBITS_PER_SECOND: 'kbit/s'>,
|
||||||
}),
|
}),
|
||||||
@ -415,7 +415,7 @@
|
|||||||
'original_name': 'DSL rate up',
|
'original_name': 'DSL rate up',
|
||||||
'platform': 'sfr_box',
|
'platform': 'sfr_box',
|
||||||
'supported_features': 0,
|
'supported_features': 0,
|
||||||
'translation_key': None,
|
'translation_key': 'dsl_rate_up',
|
||||||
'unique_id': 'e4:5d:51:00:11:22_dsl_rate_up',
|
'unique_id': 'e4:5d:51:00:11:22_dsl_rate_up',
|
||||||
'unit_of_measurement': <UnitOfDataRate.KILOBITS_PER_SECOND: 'kbit/s'>,
|
'unit_of_measurement': <UnitOfDataRate.KILOBITS_PER_SECOND: 'kbit/s'>,
|
||||||
}),
|
}),
|
||||||
@ -452,7 +452,7 @@
|
|||||||
'original_name': 'DSL line status',
|
'original_name': 'DSL line status',
|
||||||
'platform': 'sfr_box',
|
'platform': 'sfr_box',
|
||||||
'supported_features': 0,
|
'supported_features': 0,
|
||||||
'translation_key': 'line_status',
|
'translation_key': 'dsl_line_status',
|
||||||
'unique_id': 'e4:5d:51:00:11:22_dsl_line_status',
|
'unique_id': 'e4:5d:51:00:11:22_dsl_line_status',
|
||||||
'unit_of_measurement': None,
|
'unit_of_measurement': None,
|
||||||
}),
|
}),
|
||||||
@ -493,7 +493,7 @@
|
|||||||
'original_name': 'DSL training',
|
'original_name': 'DSL training',
|
||||||
'platform': 'sfr_box',
|
'platform': 'sfr_box',
|
||||||
'supported_features': 0,
|
'supported_features': 0,
|
||||||
'translation_key': 'training',
|
'translation_key': 'dsl_training',
|
||||||
'unique_id': 'e4:5d:51:00:11:22_dsl_training',
|
'unique_id': 'e4:5d:51:00:11:22_dsl_training',
|
||||||
'unit_of_measurement': None,
|
'unit_of_measurement': None,
|
||||||
}),
|
}),
|
||||||
|
@ -56,7 +56,7 @@ async def test_reboot(hass: HomeAssistant, config_entry_with_auth: ConfigEntry)
|
|||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
# Reboot success
|
# Reboot success
|
||||||
service_data = {ATTR_ENTITY_ID: "button.sfr_box_reboot"}
|
service_data = {ATTR_ENTITY_ID: "button.sfr_box_restart"}
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.sfr_box.button.SFRBox.system_reboot"
|
"homeassistant.components.sfr_box.button.SFRBox.system_reboot"
|
||||||
) as mock_action:
|
) as mock_action:
|
||||||
@ -68,7 +68,7 @@ async def test_reboot(hass: HomeAssistant, config_entry_with_auth: ConfigEntry)
|
|||||||
assert mock_action.mock_calls[0][1] == ()
|
assert mock_action.mock_calls[0][1] == ()
|
||||||
|
|
||||||
# Reboot failed
|
# Reboot failed
|
||||||
service_data = {ATTR_ENTITY_ID: "button.sfr_box_reboot"}
|
service_data = {ATTR_ENTITY_ID: "button.sfr_box_restart"}
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.sfr_box.button.SFRBox.system_reboot",
|
"homeassistant.components.sfr_box.button.SFRBox.system_reboot",
|
||||||
side_effect=SFRBoxError,
|
side_effect=SFRBoxError,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user