mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 14:57:09 +00:00
Fix input_boolean Google Assistant serialize error (#13220)
This commit is contained in:
parent
30a1fedce8
commit
25fe6ec536
@ -17,7 +17,16 @@ from homeassistant.core import callback
|
|||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_NAME, STATE_UNAVAILABLE, ATTR_SUPPORTED_FEATURES)
|
CONF_NAME, STATE_UNAVAILABLE, ATTR_SUPPORTED_FEATURES)
|
||||||
from homeassistant.components import (
|
from homeassistant.components import (
|
||||||
switch, light, cover, media_player, group, fan, scene, script, climate,
|
climate,
|
||||||
|
cover,
|
||||||
|
fan,
|
||||||
|
group,
|
||||||
|
input_boolean,
|
||||||
|
light,
|
||||||
|
media_player,
|
||||||
|
scene,
|
||||||
|
script,
|
||||||
|
switch,
|
||||||
)
|
)
|
||||||
|
|
||||||
from . import trait
|
from . import trait
|
||||||
@ -33,15 +42,16 @@ HANDLERS = Registry()
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
DOMAIN_TO_GOOGLE_TYPES = {
|
DOMAIN_TO_GOOGLE_TYPES = {
|
||||||
|
climate.DOMAIN: TYPE_THERMOSTAT,
|
||||||
|
cover.DOMAIN: TYPE_SWITCH,
|
||||||
|
fan.DOMAIN: TYPE_SWITCH,
|
||||||
group.DOMAIN: TYPE_SWITCH,
|
group.DOMAIN: TYPE_SWITCH,
|
||||||
|
input_boolean.DOMAIN: TYPE_SWITCH,
|
||||||
|
light.DOMAIN: TYPE_LIGHT,
|
||||||
|
media_player.DOMAIN: TYPE_SWITCH,
|
||||||
scene.DOMAIN: TYPE_SCENE,
|
scene.DOMAIN: TYPE_SCENE,
|
||||||
script.DOMAIN: TYPE_SCENE,
|
script.DOMAIN: TYPE_SCENE,
|
||||||
switch.DOMAIN: TYPE_SWITCH,
|
switch.DOMAIN: TYPE_SWITCH,
|
||||||
fan.DOMAIN: TYPE_SWITCH,
|
|
||||||
light.DOMAIN: TYPE_LIGHT,
|
|
||||||
cover.DOMAIN: TYPE_SWITCH,
|
|
||||||
media_player.DOMAIN: TYPE_SWITCH,
|
|
||||||
climate.DOMAIN: TYPE_THERMOSTAT,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
"""Test Google Smart Home."""
|
"""Test Google Smart Home."""
|
||||||
|
from homeassistant.core import State
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_SUPPORTED_FEATURES, ATTR_UNIT_OF_MEASUREMENT, TEMP_CELSIUS)
|
ATTR_SUPPORTED_FEATURES, ATTR_UNIT_OF_MEASUREMENT, TEMP_CELSIUS)
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
@ -244,3 +245,17 @@ async def test_raising_error_trait(hass):
|
|||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def test_serialize_input_boolean():
|
||||||
|
"""Test serializing an input boolean entity."""
|
||||||
|
state = State('input_boolean.bla', 'on')
|
||||||
|
entity = sh._GoogleEntity(None, BASIC_CONFIG, state)
|
||||||
|
assert entity.sync_serialize() == {
|
||||||
|
'id': 'input_boolean.bla',
|
||||||
|
'attributes': {},
|
||||||
|
'name': {'name': 'bla'},
|
||||||
|
'traits': ['action.devices.traits.OnOff'],
|
||||||
|
'type': 'action.devices.types.SWITCH',
|
||||||
|
'willReportState': False,
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user