mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
parent
650aae49fe
commit
fd05d949cc
@ -61,7 +61,7 @@ class DemoBinarySensor(BinarySensorEntity):
|
|||||||
self._unique_id = unique_id
|
self._unique_id = unique_id
|
||||||
self._attr_name = name
|
self._attr_name = name
|
||||||
self._state = state
|
self._state = state
|
||||||
self._sensor_type = device_class
|
self._attr_device_class = device_class
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_info(self) -> DeviceInfo:
|
def device_info(self) -> DeviceInfo:
|
||||||
@ -79,11 +79,6 @@ class DemoBinarySensor(BinarySensorEntity):
|
|||||||
"""Return the unique id."""
|
"""Return the unique id."""
|
||||||
return self._unique_id
|
return self._unique_id
|
||||||
|
|
||||||
@property
|
|
||||||
def device_class(self) -> BinarySensorDeviceClass:
|
|
||||||
"""Return the class of this sensor."""
|
|
||||||
return self._sensor_type
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self) -> bool:
|
def is_on(self) -> bool:
|
||||||
"""Return true if the binary sensor is on."""
|
"""Return true if the binary sensor is on."""
|
||||||
|
@ -85,7 +85,7 @@ class DemoCover(CoverEntity):
|
|||||||
self._unique_id = unique_id
|
self._unique_id = unique_id
|
||||||
self._attr_name = name
|
self._attr_name = name
|
||||||
self._position = position
|
self._position = position
|
||||||
self._device_class = device_class
|
self._attr_device_class = device_class
|
||||||
self._supported_features = supported_features
|
self._supported_features = supported_features
|
||||||
self._set_position: int | None = None
|
self._set_position: int | None = None
|
||||||
self._set_tilt_position: int | None = None
|
self._set_tilt_position: int | None = None
|
||||||
@ -142,11 +142,6 @@ class DemoCover(CoverEntity):
|
|||||||
"""Return if the cover is opening."""
|
"""Return if the cover is opening."""
|
||||||
return self._is_opening
|
return self._is_opening
|
||||||
|
|
||||||
@property
|
|
||||||
def device_class(self) -> CoverDeviceClass | None:
|
|
||||||
"""Return the class of this device, from component DEVICE_CLASSES."""
|
|
||||||
return self._device_class
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_features(self) -> int:
|
def supported_features(self) -> int:
|
||||||
"""Flag supported features."""
|
"""Flag supported features."""
|
||||||
|
@ -120,7 +120,7 @@ class AbstractDemoPlayer(MediaPlayerEntity):
|
|||||||
self._shuffle = False
|
self._shuffle = False
|
||||||
self._sound_mode_list = SOUND_MODE_LIST
|
self._sound_mode_list = SOUND_MODE_LIST
|
||||||
self._sound_mode = DEFAULT_SOUND_MODE
|
self._sound_mode = DEFAULT_SOUND_MODE
|
||||||
self._device_class = device_class
|
self._attr_device_class = device_class
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self) -> str:
|
def state(self) -> str:
|
||||||
@ -152,11 +152,6 @@ class AbstractDemoPlayer(MediaPlayerEntity):
|
|||||||
"""Return a list of available sound modes."""
|
"""Return a list of available sound modes."""
|
||||||
return self._sound_mode_list
|
return self._sound_mode_list
|
||||||
|
|
||||||
@property
|
|
||||||
def device_class(self) -> MediaPlayerDeviceClass | None:
|
|
||||||
"""Return the device class of the media player."""
|
|
||||||
return self._device_class
|
|
||||||
|
|
||||||
def turn_on(self) -> None:
|
def turn_on(self) -> None:
|
||||||
"""Turn the media player on."""
|
"""Turn the media player on."""
|
||||||
self._player_state = MediaPlayerState.PLAYING
|
self._player_state = MediaPlayerState.PLAYING
|
||||||
@ -427,12 +422,11 @@ class DemoTVShowPlayer(AbstractDemoPlayer):
|
|||||||
|
|
||||||
# We only implement the methods that we support
|
# We only implement the methods that we support
|
||||||
|
|
||||||
_attr_device_class = MediaPlayerDeviceClass.TV
|
|
||||||
_attr_media_content_type = MediaType.TVSHOW
|
_attr_media_content_type = MediaType.TVSHOW
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
"""Initialize the demo device."""
|
"""Initialize the demo device."""
|
||||||
super().__init__("Lounge room")
|
super().__init__("Lounge room", MediaPlayerDeviceClass.TV)
|
||||||
self._cur_episode = 1
|
self._cur_episode = 1
|
||||||
self._episode_count = 13
|
self._episode_count = 13
|
||||||
self._source = "dvd"
|
self._source = "dvd"
|
||||||
|
@ -221,7 +221,7 @@ DEMO_DEVICES = [
|
|||||||
"action.devices.traits.TransportControl",
|
"action.devices.traits.TransportControl",
|
||||||
"action.devices.traits.MediaState",
|
"action.devices.traits.MediaState",
|
||||||
],
|
],
|
||||||
"type": "action.devices.types.SETTOP",
|
"type": "action.devices.types.TV",
|
||||||
"willReportState": False,
|
"willReportState": False,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user