Skip to content

Commit

Permalink
fixed media_pos_updated_at for nest
Browse files Browse the repository at this point in the history
  • Loading branch information
KoljaWindeler committed Dec 9, 2021
1 parent bd38fc3 commit 5b4b87a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions custom_components/ytube_music_player/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,12 @@ async def async_sync_player(self, entity_id=None, old_state=None, new_state=None
self._media_duration = _player.attributes['media_duration']
if('media_position' in _player.attributes):
self._media_position = _player.attributes['media_position']
if('media_position_updated_at' in _player.attributes):
if(isinstance(_player.attributes['media_position_updated_at'],datetime.datetime)):
self._media_position_updated = _player.attributes['media_position_updated_at']
else:
self._media_position_updated = datetime.datetime.now(datetime.timezone.utc)
else:
self._media_position_updated = datetime.datetime.now(datetime.timezone.utc)

if('app_id' in _player.attributes):
Expand Down

0 comments on commit 5b4b87a

Please sign in to comment.