diff --git a/homeassistant/components/sisyphus/light.py b/homeassistant/components/sisyphus/light.py index 6d5fa2fc835..5ed3f046f59 100644 --- a/homeassistant/components/sisyphus/light.py +++ b/homeassistant/components/sisyphus/light.py @@ -38,6 +38,10 @@ class SisyphusLight(LightEntity): """Add listeners after this object has been initialized.""" self._table.add_listener(self.async_write_ha_state) + async def async_update(self): + """Force update the table state.""" + await self._table.refresh() + @property def available(self): """Return true if the table is responding to heartbeats.""" diff --git a/homeassistant/components/sisyphus/media_player.py b/homeassistant/components/sisyphus/media_player.py index 8f55fce1178..21e50b19a1b 100644 --- a/homeassistant/components/sisyphus/media_player.py +++ b/homeassistant/components/sisyphus/media_player.py @@ -65,6 +65,10 @@ class SisyphusPlayer(MediaPlayerEntity): """Add listeners after this object has been initialized.""" self._table.add_listener(self.async_write_ha_state) + async def async_update(self): + """Force update table state.""" + await self._table.refresh() + @property def unique_id(self): """Return the UUID of the table.""" @@ -129,6 +133,24 @@ class SisyphusPlayer(MediaPlayerEntity): """Return the track ID of the current track.""" return self._table.active_track.id if self._table.active_track else None + @property + def media_duration(self): + """Return the total time it will take to run this track at the current speed.""" + return self._table.active_track_total_time.total_seconds() + + @property + def media_position(self): + """Return the current position within the track.""" + return ( + self._table.active_track_total_time + - self._table.active_track_remaining_time + ).total_seconds() + + @property + def media_position_updated_at(self): + """Return the last time we got a position update.""" + return self._table.active_track_remaining_time_as_of + @property def supported_features(self): """Return the features supported by this table."""