From 23446fa1c0a8579ae314151651b6973af600df09 Mon Sep 17 00:00:00 2001 From: Simone Chemelli Date: Tue, 19 Apr 2022 12:49:07 +0200 Subject: [PATCH] Fix file size last_updated (#70114) Co-authored-by: J. Nick Koston --- homeassistant/components/filesize/sensor.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/filesize/sensor.py b/homeassistant/components/filesize/sensor.py index 97fe5f5511d..22b8cd60d79 100644 --- a/homeassistant/components/filesize/sensor.py +++ b/homeassistant/components/filesize/sensor.py @@ -137,9 +137,10 @@ class FileSizeCoordinator(DataUpdateCoordinator): raise UpdateFailed(f"Can not retrieve file statistics {error}") from error size = statinfo.st_size - last_updated = datetime.fromtimestamp(statinfo.st_mtime).replace( + last_updated = datetime.utcfromtimestamp(statinfo.st_mtime).replace( tzinfo=dt_util.UTC ) + _LOGGER.debug("size %s, last updated %s", size, last_updated) data: dict[str, int | float | datetime] = { "file": round(size / 1e6, 2),