1
mirror of https://github.com/home-assistant/core synced 2024-09-06 10:29:55 +02:00

Add support for curtain device class to google assistant (#63380)

This commit is contained in:
Erik Montnemery 2022-01-05 15:01:58 +01:00 committed by GitHub
parent 40262c4763
commit 75f8e031df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -62,6 +62,7 @@ DEFAULT_EXPOSED_DOMAINS = [
"vacuum",
]
# https://developers.google.com/assistant/smarthome/guides
PREFIX_TYPES = "action.devices.types."
TYPE_CAMERA = f"{PREFIX_TYPES}CAMERA"
TYPE_LIGHT = f"{PREFIX_TYPES}LIGHT"
@ -85,6 +86,7 @@ TYPE_SETTOP = f"{PREFIX_TYPES}SETTOP"
TYPE_HUMIDIFIER = f"{PREFIX_TYPES}HUMIDIFIER"
TYPE_DEHUMIDIFIER = f"{PREFIX_TYPES}DEHUMIDIFIER"
TYPE_RECEIVER = f"{PREFIX_TYPES}AUDIO_VIDEO_RECEIVER"
TYPE_CURTAIN = f"{PREFIX_TYPES}CURTAIN"
SERVICE_REQUEST_SYNC = "request_sync"
HOMEGRAPH_URL = "https://homegraph.googleapis.com/"
@ -149,6 +151,7 @@ DEVICE_CLASS_TO_GOOGLE_TYPES = {
(cover.DOMAIN, cover.CoverDeviceClass.DOOR): TYPE_DOOR,
(cover.DOMAIN, cover.CoverDeviceClass.AWNING): TYPE_AWNING,
(cover.DOMAIN, cover.CoverDeviceClass.SHUTTER): TYPE_SHUTTER,
(cover.DOMAIN, cover.CoverDeviceClass.CURTAIN): TYPE_CURTAIN,
(switch.DOMAIN, switch.SwitchDeviceClass.SWITCH): TYPE_SWITCH,
(switch.DOMAIN, switch.SwitchDeviceClass.OUTLET): TYPE_OUTLET,
(binary_sensor.DOMAIN, binary_sensor.BinarySensorDeviceClass.DOOR): TYPE_DOOR,

View File

@ -1021,10 +1021,14 @@ async def test_device_class_binary_sensor(hass, device_class, google_type):
("non_existing_class", "action.devices.types.BLINDS"),
("door", "action.devices.types.DOOR"),
("garage", "action.devices.types.GARAGE"),
("gate", "action.devices.types.GARAGE"),
("awning", "action.devices.types.AWNING"),
("shutter", "action.devices.types.SHUTTER"),
("curtain", "action.devices.types.CURTAIN"),
],
)
async def test_device_class_cover(hass, device_class, google_type):
"""Test that a binary entity syncs to the correct device type."""
"""Test that a cover entity syncs to the correct device type."""
sensor = DemoCover(None, hass, "Demo Sensor", device_class=device_class)
sensor.hass = hass
sensor.entity_id = "cover.demo_sensor"