mirror of
https://github.com/home-assistant/core.git
synced 2025-07-11 15:27:08 +00:00
Adding device_class to samsungtv (#28168)
* Adding device_id to samsungtv * Lint * Adding test
This commit is contained in:
parent
c96d4c978d
commit
98ac8a217d
@ -6,7 +6,11 @@ import socket
|
|||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.media_player import MediaPlayerDevice, PLATFORM_SCHEMA
|
from homeassistant.components.media_player import (
|
||||||
|
MediaPlayerDevice,
|
||||||
|
PLATFORM_SCHEMA,
|
||||||
|
DEVICE_CLASS_TV,
|
||||||
|
)
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
MEDIA_TYPE_CHANNEL,
|
MEDIA_TYPE_CHANNEL,
|
||||||
SUPPORT_NEXT_TRACK,
|
SUPPORT_NEXT_TRACK,
|
||||||
@ -227,6 +231,11 @@ class SamsungTVDevice(MediaPlayerDevice):
|
|||||||
return SUPPORT_SAMSUNGTV | SUPPORT_TURN_ON
|
return SUPPORT_SAMSUNGTV | SUPPORT_TURN_ON
|
||||||
return SUPPORT_SAMSUNGTV
|
return SUPPORT_SAMSUNGTV
|
||||||
|
|
||||||
|
@property
|
||||||
|
def device_class(self):
|
||||||
|
"""Set the device class to TV."""
|
||||||
|
return DEVICE_CLASS_TV
|
||||||
|
|
||||||
def turn_off(self):
|
def turn_off(self):
|
||||||
"""Turn off media player."""
|
"""Turn off media player."""
|
||||||
self._end_of_power_off = dt_util.utcnow() + timedelta(seconds=15)
|
self._end_of_power_off = dt_util.utcnow() + timedelta(seconds=15)
|
||||||
|
@ -8,6 +8,7 @@ from asynctest import mock
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import tests.common
|
import tests.common
|
||||||
|
from homeassistant.components.media_player import DEVICE_CLASS_TV
|
||||||
from homeassistant.components.media_player.const import (
|
from homeassistant.components.media_player.const import (
|
||||||
SUPPORT_TURN_ON,
|
SUPPORT_TURN_ON,
|
||||||
MEDIA_TYPE_CHANNEL,
|
MEDIA_TYPE_CHANNEL,
|
||||||
@ -197,6 +198,10 @@ class TestSamsungTv(unittest.TestCase):
|
|||||||
self.device._mac = "fake"
|
self.device._mac = "fake"
|
||||||
assert SUPPORT_SAMSUNGTV | SUPPORT_TURN_ON == self.device.supported_features
|
assert SUPPORT_SAMSUNGTV | SUPPORT_TURN_ON == self.device.supported_features
|
||||||
|
|
||||||
|
def test_device_class(self):
|
||||||
|
"""Test for device_class property."""
|
||||||
|
assert DEVICE_CLASS_TV == self.device.device_class
|
||||||
|
|
||||||
def test_turn_off(self):
|
def test_turn_off(self):
|
||||||
"""Test for turn_off."""
|
"""Test for turn_off."""
|
||||||
self.device.send_key = mock.Mock()
|
self.device.send_key = mock.Mock()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user