mirror of
https://github.com/home-assistant/core.git
synced 2026-12-02 19:57:03 -04:00
Bump py-opendisplay to 8.2.0 (#193729)
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
import dataclasses
|
||||
from typing import Any
|
||||
|
||||
from opendisplay import GlobalConfig
|
||||
|
||||
from homeassistant.components.diagnostics import async_redact_data
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
@@ -20,11 +22,20 @@ TO_REDACT = {
|
||||
"custom_string_2",
|
||||
"custom_string_3",
|
||||
"encryption_key",
|
||||
"findmy_config_raw",
|
||||
"length_prefixed_packets",
|
||||
# Raw bytes of config packets the library does not recognise: unknown
|
||||
# content, so never expose it.
|
||||
"unparsed_tail",
|
||||
}
|
||||
|
||||
DRIVE_DATA = (
|
||||
"display_modes",
|
||||
"display_luts",
|
||||
"display_calibrations",
|
||||
"display_panels",
|
||||
)
|
||||
|
||||
|
||||
def _asdict(obj: Any) -> Any:
|
||||
"""Recursively convert a dataclass to a dict, encoding bytes as hex strings."""
|
||||
@@ -32,11 +43,19 @@ def _asdict(obj: Any) -> Any:
|
||||
return {f.name: _asdict(getattr(obj, f.name)) for f in dataclasses.fields(obj)}
|
||||
if isinstance(obj, bytes):
|
||||
return obj.hex()
|
||||
if isinstance(obj, list):
|
||||
if isinstance(obj, (list, tuple)):
|
||||
return [_asdict(item) for item in obj]
|
||||
return obj
|
||||
|
||||
|
||||
def _device_config(config: GlobalConfig) -> dict[str, Any]:
|
||||
"""Return the config with the drive data the library parses, by name."""
|
||||
data = _asdict(config)
|
||||
for name in DRIVE_DATA:
|
||||
data[name] = _asdict(getattr(config, name))
|
||||
return async_redact_data(data, TO_REDACT)
|
||||
|
||||
|
||||
async def async_get_config_entry_diagnostics(
|
||||
hass: HomeAssistant, entry: OpenDisplayConfigEntry
|
||||
) -> dict[str, Any]:
|
||||
@@ -52,5 +71,5 @@ async def async_get_config_entry_diagnostics(
|
||||
"sha": fw["sha"],
|
||||
},
|
||||
"is_flex": runtime.is_flex,
|
||||
"device_config": async_redact_data(_asdict(runtime.device_config), TO_REDACT),
|
||||
"device_config": _device_config(runtime.device_config),
|
||||
}
|
||||
|
||||
@@ -17,5 +17,5 @@
|
||||
"iot_class": "local_push",
|
||||
"loggers": ["opendisplay"],
|
||||
"quality_scale": "silver",
|
||||
"requirements": ["py-opendisplay==8.1.0"]
|
||||
"requirements": ["py-opendisplay==8.2.0"]
|
||||
}
|
||||
|
||||
Generated
+1
-1
@@ -2064,7 +2064,7 @@ py-nightscout==1.2.2
|
||||
py-nymta==0.4.3
|
||||
|
||||
# homeassistant.components.opendisplay
|
||||
py-opendisplay==8.1.0
|
||||
py-opendisplay==8.2.0
|
||||
|
||||
# homeassistant.components.schluter
|
||||
py-schluter==0.1.7
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"""Tests for the OpenDisplay integration."""
|
||||
|
||||
import struct
|
||||
from time import time
|
||||
|
||||
from bleak.backends.scanner import AdvertisementData
|
||||
@@ -10,6 +11,7 @@ from opendisplay import (
|
||||
DataExtended,
|
||||
DisplayConfig,
|
||||
GlobalConfig,
|
||||
LengthPrefixedPacket,
|
||||
ManufacturerData,
|
||||
PowerOption,
|
||||
SecurityConfig,
|
||||
@@ -100,6 +102,29 @@ DEVICE_CONFIG = GlobalConfig(
|
||||
reset_pin=0xFF,
|
||||
reserved=b"\x00" * 43,
|
||||
),
|
||||
findmy_config_raw=b"\x00\x2d" + b"\x11" * 128,
|
||||
length_prefixed_packets=[
|
||||
LengthPrefixedPacket(
|
||||
0,
|
||||
0xAE,
|
||||
struct.pack(
|
||||
"<BB12sBBbbB8s8sH",
|
||||
0,
|
||||
0,
|
||||
b"full",
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
50,
|
||||
0,
|
||||
b"\x00" + b"\xff" * 7,
|
||||
bytes(8),
|
||||
3,
|
||||
)
|
||||
+ b"\x01\x12\x00",
|
||||
),
|
||||
LengthPrefixedPacket(1, 0xF0, b"\x22" * 8),
|
||||
],
|
||||
data_extended=DataExtended.from_strings(
|
||||
manufacturer_name="Seeed Studio",
|
||||
model_name="XIAO EN04(NRF52840)",
|
||||
|
||||
@@ -19,6 +19,31 @@
|
||||
'model_name': '5849414f20454e3034284e524635323834302900000000000000000000000000',
|
||||
'serial_number': '**REDACTED**',
|
||||
}),
|
||||
'display_calibrations': list([
|
||||
]),
|
||||
'display_luts': list([
|
||||
]),
|
||||
'display_modes': list([
|
||||
dict({
|
||||
'color_scheme': 1,
|
||||
'instance_number': 0,
|
||||
'lut_slots': list([
|
||||
0,
|
||||
]),
|
||||
'mode_index': 0,
|
||||
'name': 'full',
|
||||
'passes': 1,
|
||||
'sequence': '011200',
|
||||
'temp_max_c': 50,
|
||||
'temp_min_c': 0,
|
||||
'temp_policy': 0,
|
||||
'vsn1': list([
|
||||
0,
|
||||
]),
|
||||
}),
|
||||
]),
|
||||
'display_panels': list([
|
||||
]),
|
||||
'displays': list([
|
||||
dict({
|
||||
'active_height_mm': 29,
|
||||
@@ -44,10 +69,12 @@
|
||||
'transmission_modes': 1,
|
||||
}),
|
||||
]),
|
||||
'findmy_config_raw': '**REDACTED**',
|
||||
'flash_configs': list([
|
||||
]),
|
||||
'leds': list([
|
||||
]),
|
||||
'length_prefixed_packets': '**REDACTED**',
|
||||
'loaded': False,
|
||||
'manufacturer': dict({
|
||||
'board_revision': 0,
|
||||
|
||||
Reference in New Issue
Block a user