Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intent JSON has additional key - 'Kind' Its affecting HA (Version 2.5-pre) #25

Closed
manju-rn opened this issue Apr 8, 2020 · 4 comments
Closed

Comments

@manju-rn
Copy link

manju-rn commented Apr 8, 2020

I created a fairly simple sentence. The intents are properly detected. However, the generated JSON now generates a dict for the slot instead of a direct value. meaning has an extra key/value pair Kind:Unknown. This key "Kind" is being sent out along with the proper slot values - state in this case. However, since HA is not expecting this "kind" value, the automation in HA fails. Is this something introduce in past couple of days? I remember this was not the case few days earlier.

This is currently deviated from the 2.4.19. If this is a the new standard, please let us know so that we could change at the HA side

[ControlFan]
turn the fan (on|off|swing) {state}

{
"entities": [
{
"end": 15,
"entity": "state",
"kind": "Unknown",
"raw_end": 15,
"raw_start": 13,
"raw_value": "on",
"source": "state",
"start": 13,
"unit": "",
"value": "on"
}
],
"intent": {
"confidence": 0.9,
"name": "ControlFan"
},
"raw_text": "fan on",
"raw_tokens": [
"fan",
"on"
],
"recognize_seconds": 0.048003378000203156,
"slots": {
"state": "on"
},
"speech_confidence": 1,
"text": "turn the fan on",
"tokens": [
"turn",
"the",
"fan",
"on"
],
"wakewordId": ""
}

@NathanC
Copy link

NathanC commented Apr 10, 2020

Yeah, this doesn't meet hermes spec. I think parsers of hermes should explicitly be tolerant of additional fields (or a standardized custom or something)-- the issue here isn't the kind field addition but the fact that slots used to contain a "values" json object that had "value" and "rawValue" iirc, though the reference is vague on the slots field structure.

I just updated my parser to deal with the change. I'm not married to a protocol from a service that decided to become more closed-- but if the spec is changed it should probably be another major version or forked/renamed. It would give rhasspy more creative freedom to control the spec's future, but not sure who all the consumers of the spec are or if anyone is currently considered an authority on it, and having a shared protocol is really important. If Snips was the only authority and now there's a vacuum, it could make sense to explicitly fork it as a community project and have a github repo for it. @synesthesiam wdyt?

Does anyone have a mirror of the protocol link from the old snips wiki? Found it as a dead link when researching this, but not sure if it had a more detailed spec and can't find it in the Wayback Machine.

@manju-rn
Copy link
Author

manju-rn commented Apr 11, 2020

I see some fix has been done. However, looks like the fix is partial. The JSON object retrieved from the UI looks okay (does not have 'kind': 'Unknown') but is quite different from the ones seen in the log. And it is this value seen in log that is sent to HA and is wrong. i.e, the value of value={'kind': 'Unknown', 'value': 'on'} is still sent, this should just be value=on Can we have the same fix done to the actual values being sent to HA?

Please see both the data

JSON from UI

    "entities": [
        {
            "end": 6,
            "entity": "state",
            "raw_end": 6,
            "raw_start": 4,
            "raw_value": "on",
            "start": 4,
            "value": "on"
        }
    ],
    "intent": {
        "confidence": 1,
        "name": "FanControl"
    },
    "raw_text": "fan on",
    "raw_tokens": [
        "fan",
        "on"
    ],
    "recognize_seconds": 0.1324244789993827,
    "slots": {
        "state": "on"
    },
    "speech_confidence": 1,
    "text": "fan on",
    "tokens": [
        "fan",
        "on"
    ],
    "wakeword_id": null
}

Values from the logs
[DEBUG:2020-04-11 15:41:48,430] rhasspyhomeassistant_hermes: <- NluIntent(input='fan on', intent=Intent(intent_name='FanControl', confidence_score=1.0), site_id='default', id='xxxxx', slots=[Slot(entity='state', value={'kind': 'Unknown', 'value': 'on'}, slot_name='state', raw_value='on', confidence=1.0, range=SlotRange(start=4, end=6, raw_start=4, raw_end=6))], session_id='xxxx', custom_data=None, asr_tokens=[[AsrToken(value='fan', confidence=1.0, range_start=0, range_end=3, time=None), AsrToken(value='on', confidence=1.0, range_start=4, range_end=6, time=None)]], asr_confidence=None, raw_input='fan on', wakeword_id=None)

@manju-rn manju-rn changed the title Intent JSON has additional key - 'Kind' Its affecting HA Intent JSON has additional key - 'Kind' Its affecting HA (Version 2.5-pre) Apr 11, 2020
@synesthesiam
Copy link
Contributor

I've moved the extra details of the value (kind, unit, etc.) into a "value_details" property.

@manju-rn
Copy link
Author

Confirm & tested it is working fine. The JSON sent to HA is correct now. However, the debugger logs still seem to show old values

value from logs

[DEBUG:2020-04-16 12:39:39,482] rhasspyserver_hermes: <- NluIntent(input='fan swing', intent=Intent(intent_name='FanControl', confidence_score=1.0), site_id='default', id=None, slots=[Slot(entity='state', value={'kind': 'Unknown', 'value': 'swing'}, slot_name='state', raw_value='swing', confidence=1.0, range=SlotRange(start=4, end=9, raw_start=4, raw_end=9))], session_id='default-xxx-xxx', custom_data=None, asr_tokens=[[AsrToken(value='fan', confidence=1.0, range_start=0, range_end=3, time=None), AsrToken(value='swing', confidence=1.0, range_start=4, range_end=9, time=None)]], asr_confidence=None, raw_input='fan swing', wakeword_id='Jarvis')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants