From ae278d3c80985667c88f563d7f90a1aabf9a0968 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Mon, 1 Jun 2026 14:58:46 +0200 Subject: [PATCH] Sanitize surrogate characters in MeteoAlarm alert attributes (#172545) --- homeassistant/components/meteoalarm/binary_sensor.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/meteoalarm/binary_sensor.py b/homeassistant/components/meteoalarm/binary_sensor.py index fb39425e1ae1..876b22f06901 100644 --- a/homeassistant/components/meteoalarm/binary_sensor.py +++ b/homeassistant/components/meteoalarm/binary_sensor.py @@ -80,5 +80,12 @@ class MeteoAlertBinarySensor(BinarySensorEntity): expiration_date = dt_util.parse_datetime(alert["expires"]) if expiration_date is not None and expiration_date > dt_util.utcnow(): - self._attr_extra_state_attributes = alert + self._attr_extra_state_attributes = { + key: ( + value.encode("utf-8", errors="replace").decode("utf-8") + if isinstance(value, str) + else value + ) + for key, value in alert.items() + } self._attr_is_on = True