From 040dd3c40999c517d1cd8963e709aa36315a4b14 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Wed, 29 Apr 2015 08:18:53 -0700 Subject: [PATCH] Strip microseconds on state.last_updated --- homeassistant/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/__init__.py b/homeassistant/__init__.py index 7d6a1f03d00..301a403193d 100644 --- a/homeassistant/__init__.py +++ b/homeassistant/__init__.py @@ -496,7 +496,8 @@ class State(object): self.entity_id = entity_id.lower() self.state = state self.attributes = attributes or {} - self.last_updated = last_updated or date_util.utcnow() + self.last_updated = date_util.strip_microseconds( + last_updated or date_util.utcnow()) # Strip microsecond from last_changed else we cannot guarantee # state == State.from_dict(state.as_dict())