From ad6e21182ecc3f6ae883fe826fa339e5188ae9e1 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Wed, 27 May 2020 08:16:21 +0200 Subject: [PATCH] Switch default media_player device class to settop for google assistant (#36003) --- homeassistant/components/google_assistant/const.py | 3 ++- tests/components/google_assistant/__init__.py | 8 ++++---- tests/components/google_assistant/test_smart_home.py | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/google_assistant/const.py b/homeassistant/components/google_assistant/const.py index 9a133b5e6b7..47122979173 100644 --- a/homeassistant/components/google_assistant/const.py +++ b/homeassistant/components/google_assistant/const.py @@ -73,6 +73,7 @@ TYPE_DOOR = f"{PREFIX_TYPES}DOOR" TYPE_TV = f"{PREFIX_TYPES}TV" TYPE_SPEAKER = f"{PREFIX_TYPES}SPEAKER" TYPE_ALARM = f"{PREFIX_TYPES}SECURITYSYSTEM" +TYPE_SETTOP = f"{PREFIX_TYPES}SETTOP" SERVICE_REQUEST_SYNC = "request_sync" HOMEGRAPH_URL = "https://homegraph.googleapis.com/" @@ -114,7 +115,7 @@ DOMAIN_TO_GOOGLE_TYPES = { input_boolean.DOMAIN: TYPE_SWITCH, light.DOMAIN: TYPE_LIGHT, lock.DOMAIN: TYPE_LOCK, - media_player.DOMAIN: TYPE_SWITCH, + media_player.DOMAIN: TYPE_SETTOP, scene.DOMAIN: TYPE_SCENE, script.DOMAIN: TYPE_SCENE, switch.DOMAIN: TYPE_SWITCH, diff --git a/tests/components/google_assistant/__init__.py b/tests/components/google_assistant/__init__.py index 8f6b0908f83..cd239f14b27 100644 --- a/tests/components/google_assistant/__init__.py +++ b/tests/components/google_assistant/__init__.py @@ -168,7 +168,7 @@ DEMO_DEVICES = [ "action.devices.traits.Volume", "action.devices.traits.Modes", ], - "type": "action.devices.types.SWITCH", + "type": "action.devices.types.SETTOP", "willReportState": False, }, { @@ -179,14 +179,14 @@ DEMO_DEVICES = [ "action.devices.traits.Volume", "action.devices.traits.Modes", ], - "type": "action.devices.types.SWITCH", + "type": "action.devices.types.SETTOP", "willReportState": False, }, { "id": "media_player.lounge_room", "name": {"name": "Lounge room"}, "traits": ["action.devices.traits.OnOff", "action.devices.traits.Modes"], - "type": "action.devices.types.SWITCH", + "type": "action.devices.types.SETTOP", "willReportState": False, }, { @@ -197,7 +197,7 @@ DEMO_DEVICES = [ "action.devices.traits.Volume", "action.devices.traits.Modes", ], - "type": "action.devices.types.SWITCH", + "type": "action.devices.types.SETTOP", "willReportState": False, }, { diff --git a/tests/components/google_assistant/test_smart_home.py b/tests/components/google_assistant/test_smart_home.py index e619356717f..c9fc159bdf5 100644 --- a/tests/components/google_assistant/test_smart_home.py +++ b/tests/components/google_assistant/test_smart_home.py @@ -743,7 +743,7 @@ async def test_device_class_cover(hass, device_class, google_type): @pytest.mark.parametrize( "device_class,google_type", [ - ("non_existing_class", "action.devices.types.SWITCH"), + ("non_existing_class", "action.devices.types.SETTOP"), ("tv", "action.devices.types.TV"), ], )