Google has deprecated a comma separated list for modes changed it to array (#48029)

This commit is contained in:
Tobias Haber 2021-03-18 04:59:06 +01:00 committed by GitHub
parent f625e324dd
commit f785cc7d9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 7 deletions

View File

@ -763,7 +763,7 @@ class TemperatureSettingTrait(_Trait):
mode in modes for mode in ("heatcool", "heat", "cool") mode in modes for mode in ("heatcool", "heat", "cool")
): ):
modes.append("on") modes.append("on")
response["availableThermostatModes"] = ",".join(modes) response["availableThermostatModes"] = modes
return response return response

View File

@ -276,7 +276,15 @@ DEMO_DEVICES = [
"type": "action.devices.types.THERMOSTAT", "type": "action.devices.types.THERMOSTAT",
"willReportState": False, "willReportState": False,
"attributes": { "attributes": {
"availableThermostatModes": "off,heat,cool,heatcool,auto,dry,fan-only", "availableThermostatModes": [
"off",
"heat",
"cool",
"heatcool",
"auto",
"dry",
"fan-only",
],
"thermostatTemperatureUnit": "C", "thermostatTemperatureUnit": "C",
}, },
}, },

View File

@ -713,7 +713,7 @@ async def test_temperature_setting_climate_onoff(hass):
BASIC_CONFIG, BASIC_CONFIG,
) )
assert trt.sync_attributes() == { assert trt.sync_attributes() == {
"availableThermostatModes": "off,cool,heat,heatcool,on", "availableThermostatModes": ["off", "cool", "heat", "heatcool", "on"],
"thermostatTemperatureUnit": "F", "thermostatTemperatureUnit": "F",
} }
assert trt.can_execute(trait.COMMAND_THERMOSTAT_SET_MODE, {}) assert trt.can_execute(trait.COMMAND_THERMOSTAT_SET_MODE, {})
@ -752,7 +752,7 @@ async def test_temperature_setting_climate_no_modes(hass):
BASIC_CONFIG, BASIC_CONFIG,
) )
assert trt.sync_attributes() == { assert trt.sync_attributes() == {
"availableThermostatModes": "heat", "availableThermostatModes": ["heat"],
"thermostatTemperatureUnit": "C", "thermostatTemperatureUnit": "C",
} }
@ -788,7 +788,7 @@ async def test_temperature_setting_climate_range(hass):
BASIC_CONFIG, BASIC_CONFIG,
) )
assert trt.sync_attributes() == { assert trt.sync_attributes() == {
"availableThermostatModes": "off,cool,heat,auto,on", "availableThermostatModes": ["off", "cool", "heat", "auto", "on"],
"thermostatTemperatureUnit": "F", "thermostatTemperatureUnit": "F",
} }
assert trt.query_attributes() == { assert trt.query_attributes() == {
@ -862,7 +862,7 @@ async def test_temperature_setting_climate_setpoint(hass):
BASIC_CONFIG, BASIC_CONFIG,
) )
assert trt.sync_attributes() == { assert trt.sync_attributes() == {
"availableThermostatModes": "off,cool,on", "availableThermostatModes": ["off", "cool", "on"],
"thermostatTemperatureUnit": "C", "thermostatTemperatureUnit": "C",
} }
assert trt.query_attributes() == { assert trt.query_attributes() == {
@ -920,7 +920,7 @@ async def test_temperature_setting_climate_setpoint_auto(hass):
BASIC_CONFIG, BASIC_CONFIG,
) )
assert trt.sync_attributes() == { assert trt.sync_attributes() == {
"availableThermostatModes": "off,heatcool,on", "availableThermostatModes": ["off", "heatcool", "on"],
"thermostatTemperatureUnit": "C", "thermostatTemperatureUnit": "C",
} }
assert trt.query_attributes() == { assert trt.query_attributes() == {