mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Fix invalid alexa climate or water_heater state report with double listed targetSetpoint (#107673)
This commit is contained in:
parent
5bdcbc4e8b
commit
de9bb20135
@ -1112,13 +1112,17 @@ class AlexaThermostatController(AlexaCapability):
|
|||||||
"""Return what properties this entity supports."""
|
"""Return what properties this entity supports."""
|
||||||
properties = [{"name": "thermostatMode"}]
|
properties = [{"name": "thermostatMode"}]
|
||||||
supported = self.entity.attributes.get(ATTR_SUPPORTED_FEATURES, 0)
|
supported = self.entity.attributes.get(ATTR_SUPPORTED_FEATURES, 0)
|
||||||
if supported & climate.ClimateEntityFeature.TARGET_TEMPERATURE:
|
if self.entity.domain == climate.DOMAIN:
|
||||||
properties.append({"name": "targetSetpoint"})
|
|
||||||
if supported & water_heater.WaterHeaterEntityFeature.TARGET_TEMPERATURE:
|
|
||||||
properties.append({"name": "targetSetpoint"})
|
|
||||||
if supported & climate.ClimateEntityFeature.TARGET_TEMPERATURE_RANGE:
|
if supported & climate.ClimateEntityFeature.TARGET_TEMPERATURE_RANGE:
|
||||||
properties.append({"name": "lowerSetpoint"})
|
properties.append({"name": "lowerSetpoint"})
|
||||||
properties.append({"name": "upperSetpoint"})
|
properties.append({"name": "upperSetpoint"})
|
||||||
|
if supported & climate.ClimateEntityFeature.TARGET_TEMPERATURE:
|
||||||
|
properties.append({"name": "targetSetpoint"})
|
||||||
|
elif (
|
||||||
|
self.entity.domain == water_heater.DOMAIN
|
||||||
|
and supported & water_heater.WaterHeaterEntityFeature.TARGET_TEMPERATURE
|
||||||
|
):
|
||||||
|
properties.append({"name": "targetSetpoint"})
|
||||||
return properties
|
return properties
|
||||||
|
|
||||||
def properties_proactively_reported(self) -> bool:
|
def properties_proactively_reported(self) -> bool:
|
||||||
|
@ -224,9 +224,20 @@ class ReportedProperties:
|
|||||||
|
|
||||||
def assert_equal(self, namespace, name, value):
|
def assert_equal(self, namespace, name, value):
|
||||||
"""Assert a property is equal to a given value."""
|
"""Assert a property is equal to a given value."""
|
||||||
|
prop_set = None
|
||||||
|
prop_count = 0
|
||||||
for prop in self.properties:
|
for prop in self.properties:
|
||||||
if prop["namespace"] == namespace and prop["name"] == name:
|
if prop["namespace"] == namespace and prop["name"] == name:
|
||||||
assert prop["value"] == value
|
assert prop["value"] == value
|
||||||
return prop
|
prop_set = prop
|
||||||
|
prop_count += 1
|
||||||
|
|
||||||
|
if prop_count > 1:
|
||||||
|
pytest.fail(
|
||||||
|
f"property {namespace}:{name} more than once in {self.properties!r}"
|
||||||
|
)
|
||||||
|
|
||||||
|
if prop_set:
|
||||||
|
return prop_set
|
||||||
|
|
||||||
pytest.fail(f"property {namespace}:{name} not in {self.properties!r}")
|
pytest.fail(f"property {namespace}:{name} not in {self.properties!r}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user