diff --git a/hasspy/mqtt.py b/hasspy/mqtt.py index 31c52a0..2eac87d 100644 --- a/hasspy/mqtt.py +++ b/hasspy/mqtt.py @@ -153,12 +153,15 @@ class HassSystemClient(HassClient): match cmd: case "POWER_OFF": - self.publish( - f"{self.node_id}/user/notify", - "System will be shutting down in 1 minute.", - ) + self.publish_notify("System will be shutting down in 1 minute.") case "POWER_ON": - self.publish(f"{self.node_id}/user/notify", "Shutdown cancelled.") + self.publish_notify("Shutdown cancelled.") + + def publish_notify( + self, payload: str, *args: Any, **kwargs: Any + ) -> MQTTMessageInfo: + kwargs.setdefault("retain", False) + return self.publish(f"{self.node_id}/user/notify", payload, *args, **kwargs) @property def state_topic(self) -> str: