Show media progress in sisyphus (#42996)
This is newly possible in recent Sisyphus table firmwares. If it doesn't work for you, make sure you're running at least firmware 1.10.73.
This commit is contained in:
parent
560afc31ad
commit
8f59104c71
2 changed files with 26 additions and 0 deletions
|
@ -38,6 +38,10 @@ class SisyphusLight(LightEntity):
|
||||||
"""Add listeners after this object has been initialized."""
|
"""Add listeners after this object has been initialized."""
|
||||||
self._table.add_listener(self.async_write_ha_state)
|
self._table.add_listener(self.async_write_ha_state)
|
||||||
|
|
||||||
|
async def async_update(self):
|
||||||
|
"""Force update the table state."""
|
||||||
|
await self._table.refresh()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def available(self):
|
def available(self):
|
||||||
"""Return true if the table is responding to heartbeats."""
|
"""Return true if the table is responding to heartbeats."""
|
||||||
|
|
|
@ -65,6 +65,10 @@ class SisyphusPlayer(MediaPlayerEntity):
|
||||||
"""Add listeners after this object has been initialized."""
|
"""Add listeners after this object has been initialized."""
|
||||||
self._table.add_listener(self.async_write_ha_state)
|
self._table.add_listener(self.async_write_ha_state)
|
||||||
|
|
||||||
|
async def async_update(self):
|
||||||
|
"""Force update table state."""
|
||||||
|
await self._table.refresh()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unique_id(self):
|
def unique_id(self):
|
||||||
"""Return the UUID of the table."""
|
"""Return the UUID of the table."""
|
||||||
|
@ -129,6 +133,24 @@ class SisyphusPlayer(MediaPlayerEntity):
|
||||||
"""Return the track ID of the current track."""
|
"""Return the track ID of the current track."""
|
||||||
return self._table.active_track.id if self._table.active_track else None
|
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
|
@property
|
||||||
def supported_features(self):
|
def supported_features(self):
|
||||||
"""Return the features supported by this table."""
|
"""Return the features supported by this table."""
|
||||||
|
|
Loading…
Add table
Reference in a new issue