mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Add entity translations to Syncthru (#142774)
* Add entity translations to Syncthru * Add entity translations to Syncthru * Fix
This commit is contained in:
parent
06d6155862
commit
6feb9d4b4e
@ -87,7 +87,6 @@ class SyncThruBinarySensor(SyncthruEntity, BinarySensorEntity):
|
||||
serial_number = coordinator.data.serial_number()
|
||||
assert serial_number is not None
|
||||
self._attr_unique_id = f"{serial_number}_{entity_description.key}"
|
||||
self._attr_name = name
|
||||
|
||||
@property
|
||||
def is_on(self) -> bool | None:
|
||||
|
@ -10,6 +10,8 @@ from . import DOMAIN, SyncthruCoordinator
|
||||
class SyncthruEntity(CoordinatorEntity[SyncthruCoordinator]):
|
||||
"""Base class for Syncthru entities."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(self, coordinator: SyncthruCoordinator) -> None:
|
||||
"""Initialize the Syncthru entity."""
|
||||
super().__init__(coordinator)
|
||||
|
@ -41,7 +41,7 @@ def get_toner_entity_description(color: str) -> SyncThruSensorDescription:
|
||||
"""Get toner entity description for a specific color."""
|
||||
return SyncThruSensorDescription(
|
||||
key=f"toner_{color}",
|
||||
name=f"Toner {color}",
|
||||
translation_key=f"toner_{color}",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
value_fn=lambda printer: printer.toner_status().get(color, {}).get("remaining"),
|
||||
extra_state_attributes_fn=lambda printer: printer.toner_status().get(color, {}),
|
||||
@ -52,7 +52,7 @@ def get_drum_entity_description(color: str) -> SyncThruSensorDescription:
|
||||
"""Get drum entity description for a specific color."""
|
||||
return SyncThruSensorDescription(
|
||||
key=f"drum_{color}",
|
||||
name=f"Drum {color}",
|
||||
translation_key=f"drum_{color}",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
value_fn=lambda printer: printer.drum_status().get(color, {}).get("remaining"),
|
||||
extra_state_attributes_fn=lambda printer: printer.drum_status().get(color, {}),
|
||||
@ -61,9 +61,16 @@ def get_drum_entity_description(color: str) -> SyncThruSensorDescription:
|
||||
|
||||
def get_input_tray_entity_description(tray: str) -> SyncThruSensorDescription:
|
||||
"""Get input tray entity description for a specific tray."""
|
||||
placeholders = {}
|
||||
translation_key = f"tray_{tray}"
|
||||
if "_" in tray:
|
||||
_, identifier = tray.split("_")
|
||||
placeholders["tray_number"] = identifier
|
||||
translation_key = "tray"
|
||||
return SyncThruSensorDescription(
|
||||
key=f"tray_{tray}",
|
||||
name=f"Tray {tray}",
|
||||
translation_key=translation_key,
|
||||
translation_placeholders=placeholders,
|
||||
value_fn=(
|
||||
lambda printer: printer.input_tray_status().get(tray, {}).get("newError")
|
||||
or "Ready"
|
||||
@ -78,7 +85,8 @@ def get_output_tray_entity_description(tray: int) -> SyncThruSensorDescription:
|
||||
"""Get output tray entity description for a specific tray."""
|
||||
return SyncThruSensorDescription(
|
||||
key=f"output_tray_{tray}",
|
||||
name=f"Output Tray {tray}",
|
||||
translation_key="output_tray",
|
||||
translation_placeholders={"tray_number": str(tray)},
|
||||
value_fn=(
|
||||
lambda printer: printer.output_tray_status().get(tray, {}).get("status")
|
||||
or "Ready"
|
||||
@ -94,12 +102,12 @@ def get_output_tray_entity_description(tray: int) -> SyncThruSensorDescription:
|
||||
SENSOR_TYPES: tuple[SyncThruSensorDescription, ...] = (
|
||||
SyncThruSensorDescription(
|
||||
key="active_alerts",
|
||||
name="Active Alerts",
|
||||
translation_key="active_alerts",
|
||||
value_fn=lambda printer: printer.raw().get("GXI_ACTIVE_ALERT_TOTAL"),
|
||||
),
|
||||
SyncThruSensorDescription(
|
||||
key="main",
|
||||
name="",
|
||||
name=None,
|
||||
value_fn=lambda printer: SYNCTHRU_STATE_HUMAN[printer.device_status()],
|
||||
extra_state_attributes_fn=lambda printer: {
|
||||
"display_text": printer.device_status_details(),
|
||||
@ -153,7 +161,6 @@ class SyncThruSensor(SyncthruEntity, SensorEntity):
|
||||
super().__init__(coordinator)
|
||||
self.entity_description = entity_description
|
||||
self.syncthru = coordinator.data
|
||||
self._attr_name = f"{name} {entity_description.name}".strip()
|
||||
serial_number = coordinator.data.serial_number()
|
||||
assert serial_number is not None
|
||||
self._attr_unique_id = f"{serial_number}_{entity_description.key}"
|
||||
|
@ -23,5 +23,49 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"toner_black": {
|
||||
"name": "Black toner level"
|
||||
},
|
||||
"toner_cyan": {
|
||||
"name": "Cyan toner level"
|
||||
},
|
||||
"toner_magenta": {
|
||||
"name": "Magenta toner level"
|
||||
},
|
||||
"toner_yellow": {
|
||||
"name": "Yellow toner level"
|
||||
},
|
||||
"drum_black": {
|
||||
"name": "Black drum level"
|
||||
},
|
||||
"drum_cyan": {
|
||||
"name": "Cyan drum level"
|
||||
},
|
||||
"drum_magenta": {
|
||||
"name": "Magenta drum level"
|
||||
},
|
||||
"drum_yellow": {
|
||||
"name": "Yellow drum level"
|
||||
},
|
||||
"tray_mp": {
|
||||
"name": "Multi-purpose tray"
|
||||
},
|
||||
"tray_manual": {
|
||||
"name": "Manual feed tray"
|
||||
},
|
||||
"tray": {
|
||||
"name": "Input tray {tray_number}"
|
||||
},
|
||||
"output_tray": {
|
||||
"name": "Output tray {tray_number}"
|
||||
},
|
||||
"active_alerts": {
|
||||
"name": "Active alerts",
|
||||
"unit_of_measurement": "alerts"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
# serializer version: 1
|
||||
# name: test_all_entities[binary_sensor.my_printer-entry]
|
||||
# name: test_all_entities[binary_sensor.sec84251907c415_connectivity-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
@ -12,8 +12,8 @@
|
||||
'disabled_by': None,
|
||||
'domain': 'binary_sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'binary_sensor.my_printer',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'binary_sensor.sec84251907c415_connectivity',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
@ -24,7 +24,7 @@
|
||||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.CONNECTIVITY: 'connectivity'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'My Printer',
|
||||
'original_name': 'Connectivity',
|
||||
'platform': 'syncthru',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
@ -33,21 +33,21 @@
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[binary_sensor.my_printer-state]
|
||||
# name: test_all_entities[binary_sensor.sec84251907c415_connectivity-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'connectivity',
|
||||
'friendly_name': 'My Printer',
|
||||
'friendly_name': 'SEC84251907C415 Connectivity',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'binary_sensor.my_printer',
|
||||
'entity_id': 'binary_sensor.sec84251907c415_connectivity',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[binary_sensor.my_printer_2-entry]
|
||||
# name: test_all_entities[binary_sensor.sec84251907c415_problem-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
@ -60,8 +60,8 @@
|
||||
'disabled_by': None,
|
||||
'domain': 'binary_sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'binary_sensor.my_printer_2',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'binary_sensor.sec84251907c415_problem',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
@ -72,7 +72,7 @@
|
||||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.PROBLEM: 'problem'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'My Printer',
|
||||
'original_name': 'Problem',
|
||||
'platform': 'syncthru',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
@ -81,14 +81,14 @@
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[binary_sensor.my_printer_2-state]
|
||||
# name: test_all_entities[binary_sensor.sec84251907c415_problem-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'problem',
|
||||
'friendly_name': 'My Printer',
|
||||
'friendly_name': 'SEC84251907C415 Problem',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'binary_sensor.my_printer_2',
|
||||
'entity_id': 'binary_sensor.sec84251907c415_problem',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
|
@ -1,5 +1,5 @@
|
||||
# serializer version: 1
|
||||
# name: test_all_entities[sensor.my_printer-entry]
|
||||
# name: test_all_entities[sensor.sec84251907c415-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
@ -12,8 +12,8 @@
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.my_printer',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'sensor.sec84251907c415',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
@ -24,7 +24,7 @@
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': 'mdi:printer',
|
||||
'original_name': 'My Printer',
|
||||
'original_name': None,
|
||||
'platform': 'syncthru',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
@ -33,22 +33,22 @@
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.my_printer-state]
|
||||
# name: test_all_entities[sensor.sec84251907c415-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'display_text': '',
|
||||
'friendly_name': 'My Printer',
|
||||
'friendly_name': 'SEC84251907C415',
|
||||
'icon': 'mdi:printer',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.my_printer',
|
||||
'entity_id': 'sensor.sec84251907c415',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'warning',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.my_printer_active_alerts-entry]
|
||||
# name: test_all_entities[sensor.sec84251907c415_active_alerts-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
@ -61,8 +61,8 @@
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.my_printer_active_alerts',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'sensor.sec84251907c415_active_alerts',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
@ -73,30 +73,31 @@
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': 'mdi:printer',
|
||||
'original_name': 'My Printer Active Alerts',
|
||||
'original_name': 'Active alerts',
|
||||
'platform': 'syncthru',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'translation_key': 'active_alerts',
|
||||
'unique_id': '08HRB8GJ3F019DD_active_alerts',
|
||||
'unit_of_measurement': None,
|
||||
'unit_of_measurement': 'alerts',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.my_printer_active_alerts-state]
|
||||
# name: test_all_entities[sensor.sec84251907c415_active_alerts-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'My Printer Active Alerts',
|
||||
'friendly_name': 'SEC84251907C415 Active alerts',
|
||||
'icon': 'mdi:printer',
|
||||
'unit_of_measurement': 'alerts',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.my_printer_active_alerts',
|
||||
'entity_id': 'sensor.sec84251907c415_active_alerts',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '2',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.my_printer_output_tray_1-entry]
|
||||
# name: test_all_entities[sensor.sec84251907c415_black_toner_level-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
@ -109,8 +110,8 @@
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.my_printer_output_tray_1',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'sensor.sec84251907c415_black_toner_level',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
@ -121,71 +122,20 @@
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': 'mdi:printer',
|
||||
'original_name': 'My Printer Output Tray 1',
|
||||
'original_name': 'Black toner level',
|
||||
'platform': 'syncthru',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '08HRB8GJ3F019DD_output_tray_1',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.my_printer_output_tray_1-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'capacity': 50,
|
||||
'friendly_name': 'My Printer Output Tray 1',
|
||||
'icon': 'mdi:printer',
|
||||
'name': 1,
|
||||
'status': '',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.my_printer_output_tray_1',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'Ready',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.my_printer_toner_black-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.my_printer_toner_black',
|
||||
'has_entity_name': False,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': 'mdi:printer',
|
||||
'original_name': 'My Printer Toner black',
|
||||
'platform': 'syncthru',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'translation_key': 'toner_black',
|
||||
'unique_id': '08HRB8GJ3F019DD_toner_black',
|
||||
'unit_of_measurement': '%',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.my_printer_toner_black-state]
|
||||
# name: test_all_entities[sensor.sec84251907c415_black_toner_level-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'cnt': 1176,
|
||||
'friendly_name': 'My Printer Toner black',
|
||||
'friendly_name': 'SEC84251907C415 Black toner level',
|
||||
'icon': 'mdi:printer',
|
||||
'newError': 'C1-5110',
|
||||
'opt': 1,
|
||||
@ -193,14 +143,14 @@
|
||||
'unit_of_measurement': '%',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.my_printer_toner_black',
|
||||
'entity_id': 'sensor.sec84251907c415_black_toner_level',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '8',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.my_printer_toner_cyan-entry]
|
||||
# name: test_all_entities[sensor.sec84251907c415_cyan_toner_level-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
@ -213,8 +163,8 @@
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.my_printer_toner_cyan',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'sensor.sec84251907c415_cyan_toner_level',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
@ -225,20 +175,20 @@
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': 'mdi:printer',
|
||||
'original_name': 'My Printer Toner cyan',
|
||||
'original_name': 'Cyan toner level',
|
||||
'platform': 'syncthru',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'translation_key': 'toner_cyan',
|
||||
'unique_id': '08HRB8GJ3F019DD_toner_cyan',
|
||||
'unit_of_measurement': '%',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.my_printer_toner_cyan-state]
|
||||
# name: test_all_entities[sensor.sec84251907c415_cyan_toner_level-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'cnt': 25,
|
||||
'friendly_name': 'My Printer Toner cyan',
|
||||
'friendly_name': 'SEC84251907C415 Cyan toner level',
|
||||
'icon': 'mdi:printer',
|
||||
'newError': '',
|
||||
'opt': 1,
|
||||
@ -246,14 +196,14 @@
|
||||
'unit_of_measurement': '%',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.my_printer_toner_cyan',
|
||||
'entity_id': 'sensor.sec84251907c415_cyan_toner_level',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '98',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.my_printer_toner_magenta-entry]
|
||||
# name: test_all_entities[sensor.sec84251907c415_input_tray_1-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
@ -266,8 +216,8 @@
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.my_printer_toner_magenta',
|
||||
'has_entity_name': False,
|
||||
'entity_id': 'sensor.sec84251907c415_input_tray_1',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
@ -278,126 +228,20 @@
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': 'mdi:printer',
|
||||
'original_name': 'My Printer Toner magenta',
|
||||
'original_name': 'Input tray 1',
|
||||
'platform': 'syncthru',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '08HRB8GJ3F019DD_toner_magenta',
|
||||
'unit_of_measurement': '%',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.my_printer_toner_magenta-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'cnt': 25,
|
||||
'friendly_name': 'My Printer Toner magenta',
|
||||
'icon': 'mdi:printer',
|
||||
'newError': '',
|
||||
'opt': 1,
|
||||
'remaining': 98,
|
||||
'unit_of_measurement': '%',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.my_printer_toner_magenta',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '98',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.my_printer_toner_yellow-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.my_printer_toner_yellow',
|
||||
'has_entity_name': False,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': 'mdi:printer',
|
||||
'original_name': 'My Printer Toner yellow',
|
||||
'platform': 'syncthru',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '08HRB8GJ3F019DD_toner_yellow',
|
||||
'unit_of_measurement': '%',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.my_printer_toner_yellow-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'cnt': 27,
|
||||
'friendly_name': 'My Printer Toner yellow',
|
||||
'icon': 'mdi:printer',
|
||||
'newError': '',
|
||||
'opt': 1,
|
||||
'remaining': 97,
|
||||
'unit_of_measurement': '%',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.my_printer_toner_yellow',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '97',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.my_printer_tray_tray_1-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.my_printer_tray_tray_1',
|
||||
'has_entity_name': False,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': 'mdi:printer',
|
||||
'original_name': 'My Printer Tray tray_1',
|
||||
'platform': 'syncthru',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'translation_key': 'tray',
|
||||
'unique_id': '08HRB8GJ3F019DD_tray_tray_1',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.my_printer_tray_tray_1-state]
|
||||
# name: test_all_entities[sensor.sec84251907c415_input_tray_1-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'capa': 150,
|
||||
'friendly_name': 'My Printer Tray tray_1',
|
||||
'friendly_name': 'SEC84251907C415 Input tray 1',
|
||||
'icon': 'mdi:printer',
|
||||
'newError': '',
|
||||
'opt': 1,
|
||||
@ -408,10 +252,167 @@
|
||||
'paper_type2': 0,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.my_printer_tray_tray_1',
|
||||
'entity_id': 'sensor.sec84251907c415_input_tray_1',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'Ready',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.sec84251907c415_magenta_toner_level-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.sec84251907c415_magenta_toner_level',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': 'mdi:printer',
|
||||
'original_name': 'Magenta toner level',
|
||||
'platform': 'syncthru',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'toner_magenta',
|
||||
'unique_id': '08HRB8GJ3F019DD_toner_magenta',
|
||||
'unit_of_measurement': '%',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.sec84251907c415_magenta_toner_level-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'cnt': 25,
|
||||
'friendly_name': 'SEC84251907C415 Magenta toner level',
|
||||
'icon': 'mdi:printer',
|
||||
'newError': '',
|
||||
'opt': 1,
|
||||
'remaining': 98,
|
||||
'unit_of_measurement': '%',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.sec84251907c415_magenta_toner_level',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '98',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.sec84251907c415_output_tray_1-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.sec84251907c415_output_tray_1',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': 'mdi:printer',
|
||||
'original_name': 'Output tray 1',
|
||||
'platform': 'syncthru',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'output_tray',
|
||||
'unique_id': '08HRB8GJ3F019DD_output_tray_1',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.sec84251907c415_output_tray_1-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'capacity': 50,
|
||||
'friendly_name': 'SEC84251907C415 Output tray 1',
|
||||
'icon': 'mdi:printer',
|
||||
'name': 1,
|
||||
'status': '',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.sec84251907c415_output_tray_1',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'Ready',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.sec84251907c415_yellow_toner_level-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.sec84251907c415_yellow_toner_level',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': 'mdi:printer',
|
||||
'original_name': 'Yellow toner level',
|
||||
'platform': 'syncthru',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'toner_yellow',
|
||||
'unique_id': '08HRB8GJ3F019DD_toner_yellow',
|
||||
'unit_of_measurement': '%',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.sec84251907c415_yellow_toner_level-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'cnt': 27,
|
||||
'friendly_name': 'SEC84251907C415 Yellow toner level',
|
||||
'icon': 'mdi:printer',
|
||||
'newError': '',
|
||||
'opt': 1,
|
||||
'remaining': 97,
|
||||
'unit_of_measurement': '%',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.sec84251907c415_yellow_toner_level',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '97',
|
||||
})
|
||||
# ---
|
||||
|
Loading…
x
Reference in New Issue
Block a user