From 25adc6dd4fcd93b6c659e0b68d7af7c769d8912d Mon Sep 17 00:00:00 2001 From: Esben Damgaard <51396+Ebbe@users.noreply.github.com> Date: Thu, 21 Jan 2021 12:35:37 +0100 Subject: [PATCH] Don't update systemmonitor static boot time timestamp (#45165) --- homeassistant/components/systemmonitor/sensor.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/systemmonitor/sensor.py b/homeassistant/components/systemmonitor/sensor.py index 00f193f8663..ce856c04c64 100644 --- a/homeassistant/components/systemmonitor/sensor.py +++ b/homeassistant/components/systemmonitor/sensor.py @@ -316,9 +316,11 @@ class SystemMonitorSensor(Entity): else: self._state = None elif self.type == "last_boot": - self._state = dt_util.as_local( - dt_util.utc_from_timestamp(psutil.boot_time()) - ).isoformat() + # Only update on initial setup + if self._state is None: + self._state = dt_util.as_local( + dt_util.utc_from_timestamp(psutil.boot_time()) + ).isoformat() elif self.type == "load_1m": self._state = round(os.getloadavg()[0], 2) elif self.type == "load_5m":