From 908b72370b4017b01f96790360775cc6b5192ce4 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Tue, 21 Jul 2020 21:36:21 +0200 Subject: [PATCH] Correct arguments to MQTT will_set (#38036) --- homeassistant/components/mqtt/__init__.py | 3 ++- tests/components/mqtt/test_init.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/mqtt/__init__.py b/homeassistant/components/mqtt/__init__.py index b88c536d6a3..dac6527b268 100644 --- a/homeassistant/components/mqtt/__init__.py +++ b/homeassistant/components/mqtt/__init__.py @@ -716,7 +716,8 @@ class MQTT: self._mqttc.will_set( # pylint: disable=no-value-for-parameter *attr.astuple( will_message, - filter=lambda attr, value: attr.name != "subscribed_topic", + filter=lambda attr, value: attr.name + not in ["subscribed_topic", "timestamp"], ) ) diff --git a/tests/components/mqtt/test_init.py b/tests/components/mqtt/test_init.py index 3dee1dc874b..a6eb7e46f59 100644 --- a/tests/components/mqtt/test_init.py +++ b/tests/components/mqtt/test_init.py @@ -799,13 +799,13 @@ async def test_no_birth_message(hass, mqtt_client_mock, mqtt_mock): ) async def test_custom_will_message(hass, mqtt_client_mock, mqtt_mock): """Test will message.""" - mqtt_client_mock.will_set.assert_called_with("death", "death", 0, False, None) + mqtt_client_mock.will_set.assert_called_with("death", "death", 0, False) async def test_default_will_message(hass, mqtt_client_mock, mqtt_mock): """Test will message.""" mqtt_client_mock.will_set.assert_called_with( - "homeassistant/status", "offline", 0, False, None + "homeassistant/status", "offline", 0, False )