Prevent unnecessary updates of sun component (#38169)

This commit is contained in:
Daniel Hjelseth Høyer 2020-07-24 22:46:05 +02:00 committed by GitHub
parent 8943954b18
commit 9fe142a114
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -100,7 +100,10 @@ class Sun(Entity):
self._next_change = None
def update_location(_event):
self.location = get_astral_location(self.hass)
location = get_astral_location(self.hass)
if location == self.location:
return
self.location = location
self.update_events(dt_util.utcnow())
update_location(None)