From 6e4d87182eabd87873076b2d034231d3f5249c66 Mon Sep 17 00:00:00 2001 From: Jan Bouwhuis Date: Fri, 31 Jul 2026 10:31:01 +0200 Subject: [PATCH] Fix: Silently ignore empty JSON string object for MQTT IR signal payload (#177664) --- homeassistant/components/mqtt/infrared.py | 2 +- tests/components/mqtt/test_infrared.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/mqtt/infrared.py b/homeassistant/components/mqtt/infrared.py index dd620bf2d3a4..f686f63b10c9 100644 --- a/homeassistant/components/mqtt/infrared.py +++ b/homeassistant/components/mqtt/infrared.py @@ -220,7 +220,7 @@ class MqttInfraredReceiverEntity(MqttEntity, InfraredReceiverEntity): _LOGGER.debug("Ignoring retained infrared signal on topic %s", msg.topic) return payload = self._value_template(msg.payload) - if not payload or payload in (PAYLOAD_NONE, "null"): + if not payload or payload in (PAYLOAD_NONE, "null", '""'): _LOGGER.debug( "Ignoring payload for %s on topic %s, with template %s", self.entity_id, diff --git a/tests/components/mqtt/test_infrared.py b/tests/components/mqtt/test_infrared.py index 3b98f78d3493..7e51fe380225 100644 --- a/tests/components/mqtt/test_infrared.py +++ b/tests/components/mqtt/test_infrared.py @@ -183,6 +183,12 @@ async def test_receiving_command_success_using_value_template( logging.DEBUG, False, ), + ( + '""', + "Ignoring payload for infrared.test on topic test-topic, with template None", + logging.DEBUG, + False, + ), ( "None", "Ignoring payload for infrared.test on topic test-topic, with template None",