mirror of
https://github.com/home-assistant/core.git
synced 2026-12-02 19:57:03 -04:00
Bump aiohpprinter to 3.7.0 (#191097)
This commit is contained in:
@@ -11,11 +11,16 @@ from .coordinator import HpPrinterConfigEntry
|
||||
|
||||
TO_REDACT = {
|
||||
CONF_HOST,
|
||||
"friendly_name",
|
||||
# Job log entries: the print driver's user and document name.
|
||||
"name",
|
||||
"printer_id",
|
||||
"serial_number",
|
||||
"ssid_prefix",
|
||||
"supply_serial_number",
|
||||
"unique_id",
|
||||
"user_id",
|
||||
"uuid",
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
"iot_class": "local_polling",
|
||||
"loggers": ["aiohpprinter"],
|
||||
"quality_scale": "bronze",
|
||||
"requirements": ["aiohpprinter==3.1.1"]
|
||||
"requirements": ["aiohpprinter==3.7.0"]
|
||||
}
|
||||
|
||||
@@ -43,10 +43,20 @@ SENSORS: tuple[HpPrinterSensorEntityDescription, ...] = (
|
||||
key="status",
|
||||
translation_key="status",
|
||||
device_class=SensorDeviceClass.ENUM,
|
||||
options=[status.value for status in HpDeviceStatus],
|
||||
# The printer's own "unknown" status maps to Home Assistant's unknown state.
|
||||
options=[
|
||||
status.value
|
||||
for status in HpDeviceStatus
|
||||
if status is not HpDeviceStatus.UNKNOWN
|
||||
],
|
||||
# Unknown statuses are reported as None, which must not hide the sensor.
|
||||
always_create=True,
|
||||
value_fn=lambda data: data.status.status if data.status else None,
|
||||
value_fn=lambda data: (
|
||||
status
|
||||
if data.status
|
||||
and (status := data.status.status) is not HpDeviceStatus.UNKNOWN
|
||||
else None
|
||||
),
|
||||
),
|
||||
HpPrinterSensorEntityDescription(
|
||||
key="total_pages",
|
||||
|
||||
@@ -97,12 +97,15 @@
|
||||
"name": "Status",
|
||||
"state": {
|
||||
"cancel_job": "Canceling job",
|
||||
"close_door_or_cover": "Close door or cover",
|
||||
"copying": "Copying",
|
||||
"in_power_save": "Power save",
|
||||
"initializing": "Initializing",
|
||||
"off": "[%key:common::state::off%]",
|
||||
"processing": "Printing",
|
||||
"ready": "Ready",
|
||||
"scan_processing": "Scanning",
|
||||
"shutting_down": "Shutting down",
|
||||
"tray_empty": "Paper tray empty"
|
||||
}
|
||||
},
|
||||
|
||||
Generated
+1
-1
@@ -316,7 +316,7 @@ aiohomekit==4.0.1
|
||||
aiohortos==0.3.1
|
||||
|
||||
# homeassistant.components.hp_printer
|
||||
aiohpprinter==3.1.1
|
||||
aiohpprinter==3.7.0
|
||||
|
||||
# homeassistant.components.mcp_server
|
||||
aiohttp_sse==2.2.0
|
||||
|
||||
@@ -8,10 +8,12 @@ from aiohpprinter import (
|
||||
HpConsumable,
|
||||
HpCopyUsage,
|
||||
HpFaxUsage,
|
||||
HpJob,
|
||||
HpPrinterData,
|
||||
HpPrinterDevice,
|
||||
HpPrinterStatus,
|
||||
HpPrinterUsage,
|
||||
HpProductLogs,
|
||||
HpScannerUsage,
|
||||
)
|
||||
import pytest
|
||||
@@ -45,6 +47,8 @@ def mock_device() -> HpPrinterDevice:
|
||||
product_number="226Y0B",
|
||||
manufacturer_name="HP",
|
||||
manufactured_at=datetime(2023, 3, 13),
|
||||
uuid="1c852a4d-b800-1f08-abcd-0123456789ab",
|
||||
friendly_name="Office printer",
|
||||
)
|
||||
|
||||
|
||||
@@ -120,6 +124,16 @@ def mock_data(mock_device: HpPrinterDevice) -> HpPrinterData:
|
||||
color_impressions=18,
|
||||
),
|
||||
fax_usage=HpFaxUsage(total_impressions=0),
|
||||
logs=HpProductLogs(
|
||||
jobs=[
|
||||
HpJob(
|
||||
application_id="Microsoft Word",
|
||||
user_id="jane.doe",
|
||||
name="Quarterly report.docx",
|
||||
total_impressions=3,
|
||||
)
|
||||
]
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -11,13 +11,17 @@
|
||||
'consumable_type': 'ink',
|
||||
'counterfeit_refilled_count': None,
|
||||
'estimated_pages_remaining': None,
|
||||
'family_name': None,
|
||||
'genuine_refilled_count': None,
|
||||
'installed_at': None,
|
||||
'low_threshold': None,
|
||||
'manufactured_at': None,
|
||||
'manufacturer_name': None,
|
||||
'marker_color': 'Cyan',
|
||||
'max_capacity': None,
|
||||
'measured_quantity_state': None,
|
||||
'percentage_level_remaining': 40.0,
|
||||
'previous_cartridge': None,
|
||||
'product_number': None,
|
||||
'raw_percentage_level_remaining': None,
|
||||
'selectibility_number': None,
|
||||
@@ -36,13 +40,17 @@
|
||||
'consumable_type': 'printhead',
|
||||
'counterfeit_refilled_count': None,
|
||||
'estimated_pages_remaining': None,
|
||||
'family_name': None,
|
||||
'genuine_refilled_count': None,
|
||||
'installed_at': None,
|
||||
'low_threshold': None,
|
||||
'manufactured_at': None,
|
||||
'manufacturer_name': None,
|
||||
'marker_color': None,
|
||||
'max_capacity': None,
|
||||
'measured_quantity_state': None,
|
||||
'percentage_level_remaining': None,
|
||||
'previous_cartridge': None,
|
||||
'product_number': None,
|
||||
'raw_percentage_level_remaining': None,
|
||||
'selectibility_number': None,
|
||||
@@ -61,13 +69,17 @@
|
||||
'consumable_type': 'ink',
|
||||
'counterfeit_refilled_count': None,
|
||||
'estimated_pages_remaining': 550,
|
||||
'family_name': None,
|
||||
'genuine_refilled_count': None,
|
||||
'installed_at': None,
|
||||
'low_threshold': None,
|
||||
'manufactured_at': None,
|
||||
'manufacturer_name': None,
|
||||
'marker_color': 'Black',
|
||||
'max_capacity': None,
|
||||
'measured_quantity_state': None,
|
||||
'percentage_level_remaining': 80.0,
|
||||
'previous_cartridge': None,
|
||||
'product_number': None,
|
||||
'raw_percentage_level_remaining': None,
|
||||
'selectibility_number': None,
|
||||
@@ -86,13 +98,17 @@
|
||||
'consumable_type': 'ink',
|
||||
'counterfeit_refilled_count': None,
|
||||
'estimated_pages_remaining': None,
|
||||
'family_name': None,
|
||||
'genuine_refilled_count': None,
|
||||
'installed_at': None,
|
||||
'low_threshold': None,
|
||||
'manufactured_at': None,
|
||||
'manufacturer_name': None,
|
||||
'marker_color': 'Magenta',
|
||||
'max_capacity': None,
|
||||
'measured_quantity_state': None,
|
||||
'percentage_level_remaining': 40.0,
|
||||
'previous_cartridge': None,
|
||||
'product_number': None,
|
||||
'raw_percentage_level_remaining': None,
|
||||
'selectibility_number': None,
|
||||
@@ -111,13 +127,17 @@
|
||||
'consumable_type': 'ink',
|
||||
'counterfeit_refilled_count': None,
|
||||
'estimated_pages_remaining': None,
|
||||
'family_name': None,
|
||||
'genuine_refilled_count': None,
|
||||
'installed_at': None,
|
||||
'low_threshold': None,
|
||||
'manufactured_at': None,
|
||||
'manufacturer_name': None,
|
||||
'marker_color': 'Yellow',
|
||||
'max_capacity': None,
|
||||
'measured_quantity_state': None,
|
||||
'percentage_level_remaining': 40.0,
|
||||
'previous_cartridge': None,
|
||||
'product_number': None,
|
||||
'raw_percentage_level_remaining': None,
|
||||
'selectibility_number': None,
|
||||
@@ -139,13 +159,24 @@
|
||||
'total_impressions': 20,
|
||||
}),
|
||||
'device': dict({
|
||||
'admin_password_set': None,
|
||||
'duplex_unit': None,
|
||||
'firmware_date': None,
|
||||
'firmware_revision': None,
|
||||
'friendly_name': '**REDACTED**',
|
||||
'language_pack_version': None,
|
||||
'make_and_model': 'HP OfficeJet Pro 9020 series',
|
||||
'make_and_model_family': 'HP OfficeJet Pro 9020 series',
|
||||
'manufactured_at': '2023-03-13T00:00:00',
|
||||
'manufacturer_name': 'HP',
|
||||
'power_save': None,
|
||||
'power_save_timeout': None,
|
||||
'product_number': '226Y0B',
|
||||
'serial_number': '**REDACTED**',
|
||||
'service_id': None,
|
||||
'shutdown_delay': None,
|
||||
'sku_identifier': '9022e',
|
||||
'uuid': '**REDACTED**',
|
||||
}),
|
||||
'eprint': None,
|
||||
'fax_usage': dict({
|
||||
@@ -154,6 +185,24 @@
|
||||
'images_received_from_pc': None,
|
||||
'total_impressions': 0,
|
||||
}),
|
||||
'genuine_supplies_only': None,
|
||||
'io_config': None,
|
||||
'logs': dict({
|
||||
'error_log': None,
|
||||
'events': list([
|
||||
]),
|
||||
'jobs': list([
|
||||
dict({
|
||||
'application_id': 'Microsoft Word',
|
||||
'color_impressions': None,
|
||||
'monochrome_impressions': None,
|
||||
'name': '**REDACTED**',
|
||||
'submitted_at': None,
|
||||
'total_impressions': 3,
|
||||
'user_id': '**REDACTED**',
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
'online': True,
|
||||
'printer_usage': dict({
|
||||
'color_impressions': 649,
|
||||
@@ -161,9 +210,12 @@
|
||||
'jam_events': 2,
|
||||
'mispick_events': 24,
|
||||
'monochrome_impressions': 226,
|
||||
'original_hp_color_impressions': None,
|
||||
'original_hp_monochrome_impressions': None,
|
||||
'simplex_sheets': 697,
|
||||
'total_impressions': 875,
|
||||
}),
|
||||
'scan_usage': None,
|
||||
'scanner_usage': dict({
|
||||
'adf_images': 2947,
|
||||
'duplex_sheets': 589,
|
||||
@@ -174,6 +226,7 @@
|
||||
}),
|
||||
'status': dict({
|
||||
'device_status': 'inpowersave',
|
||||
'message': None,
|
||||
}),
|
||||
'wifi': None,
|
||||
}),
|
||||
|
||||
@@ -1030,12 +1030,15 @@
|
||||
'capabilities': dict({
|
||||
<SensorEntityCapabilityAttribute.OPTIONS: 'options'>: list([
|
||||
'cancel_job',
|
||||
'close_door_or_cover',
|
||||
'copying',
|
||||
'initializing',
|
||||
'in_power_save',
|
||||
'off',
|
||||
'processing',
|
||||
'ready',
|
||||
'scan_processing',
|
||||
'shutting_down',
|
||||
'tray_empty',
|
||||
]),
|
||||
}),
|
||||
@@ -1076,12 +1079,15 @@
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'HP OfficeJet Pro 9020 series Status',
|
||||
<SensorEntityCapabilityAttribute.OPTIONS: 'options'>: list([
|
||||
'cancel_job',
|
||||
'close_door_or_cover',
|
||||
'copying',
|
||||
'initializing',
|
||||
'in_power_save',
|
||||
'off',
|
||||
'processing',
|
||||
'ready',
|
||||
'scan_processing',
|
||||
'shutting_down',
|
||||
'tray_empty',
|
||||
]),
|
||||
}),
|
||||
|
||||
@@ -77,6 +77,9 @@ async def test_sensors_added_when_data_appears(
|
||||
"status",
|
||||
[
|
||||
pytest.param(HpPrinterStatus(device_status="somethingnew"), id="unknown"),
|
||||
pytest.param(
|
||||
HpPrinterStatus(device_status="unknown"), id="reported_as_unknown"
|
||||
),
|
||||
pytest.param(HpPrinterStatus(device_status=None), id="missing"),
|
||||
pytest.param(None, id="no_status"),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user