Intents - Home Assistant is inferring 'switch.name' when 'light.name' is more appropriate

I thought it was a Home Assistant issue, but looking at the Rhasspy logs, it might be buried somewhere here in Rhasspy.

I previously had TP-Link switches controlling lamps. I’ve since removed the switches and now am using Zigbee bulbs, seen as ‘light’ entities in Home Assistant.

Here is the Rhasspy sentence:

[ChangeLightState]
light_name = (brass | dog | rabbit | bedroom) {name}
light_state = (on | off) {state}

turn <light_state> [the] <light_name>
turn [the] <light_name> <light_state>
<light_name> <light_state>

and this is shown in the Rhasspy logs:

DEBUG:2021-10-26 14:38:19,674] rhasspyserver_hermes: <- NluIntent(input='switch.living_room_3 on', intent=Intent(intent_name='ChangeLightState', confidence_score=1.0), site_id='Listener1', id=None, slots=[Slot(entity='light', value={'kind': 'Unknown', 'value': 'switch.living_room_3'}, slot_name='light', raw_value='dog lamp', confidence=1.0, range=SlotRange(start=0, end=20, raw_start=0, raw_end=8)), Slot(entity='state_on_off', value={'kind': 'Unknown', 'value': 'on'}, slot_name='state', raw_value='on', confidence=1.0, range=SlotRange(start=21, end=23, raw_start=9, raw_end=11))], session_id='Listener1-porcupine_raspberry-pi-91e9865f-4593-4b98-80f8-8e3985349d72', custom_data='porcupine_raspberry-pi', asr_tokens=[[AsrToken(value='switch.living_room_3', confidence=1.0, range_start=0, range_end=20, time=None), AsrToken(value='on', confidence=1.0, range_start=21, range_end=23, time=None)]], asr_confidence=1.0, raw_input='dog lamp on', wakeword_id='porcupine_raspberry-pi', lang=None)
[DEBUG:2021-10-26 14:38:16,185] rhasspyserver_hermes: <- HotwordDetected(model_id='/usr/lib/rhasspy/.venv/lib/python3.7/site-packages/pvporcupine/resources/keyword_files/raspberry-pi/porcupine_raspberry-pi.ppn', model_version='', model_type='personal', current_sensitivity=0.318, site_id='Listener1', session_id=None, send_audio_captured=None, lang=None, custom_entities=None)

My question is, why does Rhasspy form the intent using a Home Assistant entity name? Should it not simply pass < light > and < state > values to Home Assistant in the intent?

DOH!! It’s a SLOT definition causing the issue, and it’s in Rhasspy, and it’s all MY FAULT. :frowning:

Great you found the issue :slight_smile:

Except now my sentences aren’t parsing correctly.
Rhasspy confirms receipt of the voice command, but never logs the intent. :face_with_raised_eyebrow:

Did you retrain Rhasspy? What do your slots look like now?

Yes, have retrained several times, even restarted several times.
It’s just slightly frustrating.
Eventually, something will click, and I’ll get it working right again.
Thank you for responding, it is very much appreciated! :slight_smile:

It may be time to re-write my sentences/slots for this particular automation.
I know @romkabouter has posted his example here previously.
Does anyone have a recent or most favored set of values for turning lights on/off ?

Howdy - I may have something that can help! I’ve been working on Home Intent, which integrates between Rhasspy and Home Assistant, automatically pulling in entities and setting up sentences. It has support for turning lights on/off, changing colors (including color temp), and setting brightness - and a bunch of other entity support.

You can see some of the example types of sentences it would support: Light examples in Home Intent

It might work for your use case if you are willing to give it a try. It can either fully manage Rhasspy or integrate with an existing instance. The docs are here: https://homeintent.io/