mirror of
https://github.com/XiaoMi/ha_xiaomi_home.git
synced 2025-12-17 19:02:14 +08:00
fix: playing state of media player entity (#1552)
This commit is contained in:
@@ -435,10 +435,11 @@ class FeatureState(MIoTServiceEntity, MediaPlayerEntity):
|
|||||||
@property
|
@property
|
||||||
def state(self) -> Optional[MediaPlayerState]:
|
def state(self) -> Optional[MediaPlayerState]:
|
||||||
"""The current state."""
|
"""The current state."""
|
||||||
return (self.get_map_value(map_=self._playing_state_map,
|
current_state = self.get_prop_value(
|
||||||
key=self.get_prop_value(
|
prop=self._prop_playing_state) if self._prop_playing_state else None
|
||||||
prop=self._prop_playing_state))
|
return (MediaPlayerState.ON if
|
||||||
if self._prop_playing_state else MediaPlayerState.ON)
|
(current_state is None) else self.get_map_value(
|
||||||
|
map_=self._playing_state_map, key=current_state))
|
||||||
|
|
||||||
|
|
||||||
class WifiSpeaker(FeatureVolumeSet, FeatureVolumeMute, FeaturePlay,
|
class WifiSpeaker(FeatureVolumeSet, FeatureVolumeMute, FeaturePlay,
|
||||||
|
|||||||
@@ -325,10 +325,12 @@ SPEC_DEVICE_TRANS_MAP: dict = {
|
|||||||
},
|
},
|
||||||
'play-control': {
|
'play-control': {
|
||||||
'required': {
|
'required': {
|
||||||
|
'properties': {
|
||||||
|
'playing-state': {'read'}
|
||||||
|
},
|
||||||
'actions': {'play'}
|
'actions': {'play'}
|
||||||
},
|
},
|
||||||
'optional': {
|
'optional': {
|
||||||
'properties': {'playing-state'},
|
|
||||||
'actions': {'pause', 'stop', 'next', 'previous'}
|
'actions': {'pause', 'stop', 'next', 'previous'}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user