Fixed issue 15340. Alexa Smart Home now handles unsupported properties correctly #15352
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixed issue 15340. alexa/smart home now properly skips over properties that aren't supported in the current state, eg lowerSetpoint in Heat mode or targetSetpoint in Eco mode for Nest devices.
Description:
As described in issue 15340, the Alexa smart home skill cannot retrieve the properties of a climate device like the Nest (not sure about other devices). When Alexa asks for a state report, alexa/smart_home.py attempts to return all of the properties of the climate component, even if the properties are null. Properties can be null depending on the state of the device. For example, target_temp_low is null if the thermostat mode only has a single setpoint, and target_temperature is null when the mode has two setpoints (lower and upper). So, when Alexa asks for a state report, some property values are always null, causing ThermostatController.get_property() to always fail with the UnsupportedProperty exception.
The fix is to have the only caller, serialize_properties, handle a None return value from get_property, and have get_property return None if the associated value is actually null or None.
Related issue (if applicable): fixes #15340
Pull request in home-assistant.github.io with documentation (if applicable): N/A
Checklist:
tox
. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed - N/A
If the code communicates with devices, web services, or third-party tools: N/A
If the code does not interact with devices: N/A