In me looking into the code (for as far as I understand Python and the buildup of Home-Assistant),
I noticed the 'TemperatureSettingTrait' class in trait.py from the google_assistant component.
The class only translates 4 states
# We do not support "on" as we are unable to know how to restore
# the last mode.
hass_to_google = {
climate.STATE_HEAT: 'heat',
climate.STATE_COOL: 'cool',
climate.STATE_OFF: 'off',
climate.STATE_AUTO: 'heatcool',
}
I am not sure whether other states are returned to google (i guess It does, as multiple issues exists about climate components not being able to be used with Google Assistant), but it might be necessary to limit what can be returned to only the states google will understand.
Also the hass state STATE_AUTO should (in my opinion) be mapped to 'auto' and not to 'heatcool' as what is done currently.
Next to this, the eco and dry states should be added into the translation.
Could this be fixed and extended in the Google Assistant component?
_Originally posted by @reharmsen in https://github.com/home-assistant/home-assistant/issues/18515#issuecomment-441107126_
Also see the following issues:
Mode mapping should only be done for what is available in the base climate.__init__() file. Anything extra could cause issues with the integration.
Default modes:
STATE_HEAT = 'heat'
STATE_COOL = 'cool'
STATE_IDLE = 'idle'
STATE_AUTO = 'auto'
STATE_MANUAL = 'manual'
STATE_DRY = 'dry'
STATE_FAN_ONLY = 'fan_only'
STATE_ECO = 'eco'
Google's supported modes are here:
https://developers.google.com/actions/smarthome/traits/temperaturesetting
There are a few extra modes that aren't currently covered in climate.__init__() that could be mapped.
Updated mappings. Note heatcool changed to auto.
hass_to_google = {
climate.STATE_HEAT: 'heat',
climate.STATE_COOL: 'cool',
climate.STATE_OFF: 'off',
climate.STATE_AUTO: 'auto',
climate.STATE_FAN_ONLY: 'fan-only',
climate.STATE_DRY: 'dry',
climate.STATE_ECO: 'eco'
}
@marchingphoenix - what about https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/google_assistant/const.py#L23
auto mode should be found also in CLIMATE_SUPPORTED_MODES ?
good catch. I ran the tests locally and that didn't seem to get touched. I just ran a search and it doesn't look like that variable is used at all. I might just remove it.