From 102beaa044ca0dbdb197909ab07e01ffa03dfb9c Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Tue, 7 May 2019 18:37:08 +0200 Subject: [PATCH] Add debug prints to sun (#23598) * Add debug prints to sun * Review comment --- homeassistant/components/sun/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/sun/__init__.py b/homeassistant/components/sun/__init__.py index 92cdcb0a2e4..90718fd540e 100644 --- a/homeassistant/components/sun/__init__.py +++ b/homeassistant/components/sun/__init__.py @@ -120,15 +120,20 @@ class Sun(Entity): """Run when the state of the sun has changed.""" self.update_sun_position(now) self.update_as_of(now) - self.async_schedule_update_ha_state() + self.async_write_ha_state() + _LOGGER.debug("sun point_in_time_listener@%s: %s, %s", + now, self.state, self.state_attributes) # Schedule next update at next_change+1 second so sun state has changed async_track_point_in_utc_time( self.hass, self.point_in_time_listener, self.next_change + timedelta(seconds=1)) + _LOGGER.debug("next time: %s", self.next_change + timedelta(seconds=1)) @callback def timer_update(self, time): """Needed to update solar elevation and azimuth.""" self.update_sun_position(time) - self.async_schedule_update_ha_state() + self.async_write_ha_state() + _LOGGER.debug("sun timer_update@%s: %s, %s", + time, self.state, self.state_attributes)