Allow bytearray for mqtt payload type (#132906)

This commit is contained in:
Marc Mueller 2024-12-11 11:51:16 +01:00 committed by GitHub
parent b26583b0bf
commit dc8b7cfede
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View File

@ -119,7 +119,7 @@ MAX_PACKETS_TO_READ = 500
type SocketType = socket.socket | ssl.SSLSocket | mqtt.WebsocketWrapper | Any
type SubscribePayloadType = str | bytes # Only bytes if encoding is None
type SubscribePayloadType = str | bytes | bytearray # Only bytes if encoding is None
def publish(

View File

@ -91,7 +91,7 @@ class MqttSwitch(MqttEntity, SwitchEntity, RestoreEntity):
_entity_id_format = switch.ENTITY_ID_FORMAT
_optimistic: bool
_is_on_map: dict[str | bytes, bool | None]
_is_on_map: dict[str | bytes | bytearray, bool | None]
_command_template: Callable[[PublishPayloadType], PublishPayloadType]
_value_template: Callable[[ReceivePayloadType], ReceivePayloadType]

View File

@ -4,7 +4,7 @@ from dataclasses import dataclass
from homeassistant.data_entry_flow import BaseServiceInfo
type ReceivePayloadType = str | bytes
type ReceivePayloadType = str | bytes | bytearray
@dataclass(slots=True)