diff --git a/homeassistant/components/snips.py b/homeassistant/components/snips.py index aa42833daf3dc..de54c0239c731 100644 --- a/homeassistant/components/snips.py +++ b/homeassistant/components/snips.py @@ -32,12 +32,12 @@ }, extra=vol.ALLOW_EXTRA) INTENT_SCHEMA = vol.Schema({ - vol.Required('text'): str, + vol.Required('input'): str, vol.Required('intent'): { - vol.Required('intent_name'): str + vol.Required('intentName'): str }, vol.Optional('slots'): [{ - vol.Required('slot_name'): str, + vol.Required('slotName'): str, vol.Required('value'): { vol.Required('kind'): str, vol.Required('value'): cv.match_all @@ -95,7 +95,7 @@ def handle_intent(self, payload): LOGGER.error('Intent has invalid schema: %s. %s', err, response) return - intent = response['intent']['intent_name'].split('__')[-1] + intent = response['intent']['intentName'].split('__')[-1] config = self.intents.get(intent) if config is None: @@ -113,26 +113,9 @@ def parse_slots(self, response): parameters = {} for slot in response.get('slots', []): - key = slot['slot_name'] - value = self.get_value(slot['value']) + key = slot['slotName'] + value = slot['value']['value'] if value is not None: parameters[key] = value return parameters - - @staticmethod - def get_value(value): - """Return the value of a given slot.""" - kind = value['kind'] - - if kind == "Custom": - return value["value"] - elif kind == "Builtin": - try: - return value["value"]["value"] - except KeyError: - return None - else: - LOGGER.warning('Received unknown slot type: %s', kind) - - return None diff --git a/tests/components/test_snips.py b/tests/components/test_snips.py index 09a33dae2beba..5687723e17aee 100644 --- a/tests/components/test_snips.py +++ b/tests/components/test_snips.py @@ -6,14 +6,14 @@ EXAMPLE_MSG = """ { - "text": "turn the lights green", + "input": "turn the lights green", "intent": { - "intent_name": "Lights", + "intentName": "Lights", "probability": 1 }, "slots": [ { - "slot_name": "light_color", + "slotName": "light_color", "value": { "kind": "Custom", "value": "blue"