From 38e40562261d76fa5f5cfaad35af4e14341ffd37 Mon Sep 17 00:00:00 2001 From: Koen Hendriks Date: Fri, 5 Jan 2024 14:15:38 +0100 Subject: [PATCH] Retain label values when published over mqtt --- custom_components/button_plus/text.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/button_plus/text.py b/custom_components/button_plus/text.py index 4c5ea00..b8ca320 100644 --- a/custom_components/button_plus/text.py +++ b/custom_components/button_plus/text.py @@ -102,7 +102,7 @@ async def async_set_value(self, value: str) -> None: label_topic = f"buttonplus/{self._hub_id}/button/{self._btn_id}/{self._text_type}" _LOGGER.debug(f"ButtonPlus label update for {self.entity_id}") _LOGGER.debug(f"ButtonPlus label update to {label_topic} with new value: {value}") - await mqtt.async_publish(hass=self.hass, topic=label_topic, payload=value, qos=0) + await mqtt.async_publish(hass=self.hass, topic=label_topic, payload=value, qos=0, retain=True) self._attr_native_value = value