Skip to content

Commit

Permalink
Merge pull request #27 from koenhendriks/26-retain-topics-for-labels-…
Browse files Browse the repository at this point in the history
…and-top_labels

Retain label values when published over MQTT
  • Loading branch information
koenhendriks authored Jan 5, 2024
2 parents c89d991 + 38e4056 commit b962c88
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion custom_components/button_plus/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit b962c88

Please sign in to comment.