Enable Google Assistant OnOffTrait for climate devices that support them (#18544)

* Enable Google Assistant OnOffTrait for climate devices that support them

This commit enables the OnOffTrait for climate devices that have the SUPPORT_ON_OFF feature. I have tested this locally with a Sensibo device which supports ON_OFF and a nest device that does not.

* Update trait.py

* Add tests for onoff_climate

* Add OnOff trait to climate.heatpump

* Add on status to heatpump in google_assistant tests
This commit is contained in:
Bryan York 2018-11-27 08:11:55 -08:00 committed by Paulus Schoutsen
parent 2f07e92cc2
commit 02309cc318
4 changed files with 49 additions and 1 deletions

View file

@ -197,6 +197,8 @@ class OnOffTrait(_Trait):
@staticmethod
def supported(domain, features):
"""Test if state is supported."""
if domain == climate.DOMAIN:
return features & climate.SUPPORT_ON_OFF != 0
return domain in (
group.DOMAIN,
input_boolean.DOMAIN,