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

Sentence node not outputting an event #327

Closed
cryptk opened this issue Dec 4, 2024 · 4 comments · Fixed by #309
Closed

Sentence node not outputting an event #327

cryptk opened this issue Dec 4, 2024 · 4 comments · Fixed by #309
Labels
bug Something isn't working

Comments

@cryptk
Copy link

cryptk commented Dec 4, 2024

Describe the bug

I have created a sentence node and when saying the sentence that it is configured for, the default response is always returned but the node never outputs an event. This comes along with an error in the Home Assistant logs. I have replicated this with the "Basic Usage" example from https://zachowj.github.io/node-red-contrib-home-assistant-websocket/node/sentence.html#basic-usage as well. Here is the Home Assistant error when clicking the "hello world" inject node:

Logger: homeassistant.components.websocket_api.messages
Source: components/websocket_api/messages.py:246
integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 4:51:46 PM (1 occurrences)
Last logged: 4:51:46 PM

Unable to serialize to JSON. Bad data found at $.event.data.result=RecognizeResult(intent=Intent(name='0', data=[IntentData(sentence_texts=["[it's ]party time", 'happy (new year|birthday)', 'hello world'], slots={}, response=None, requires_context={}, excludes_context={}, expansion_rules={}, slot_lists={}, wildcard_list_names=set(), metadata=None, required_keywords=None, settings=IntentDataSettings(filter_with_regex=True))]), intent_data=IntentData(sentence_texts=["[it's ]party time", 'happy (new year|birthday)', 'hello world'], slots={}, response=None, requires_context={}, excludes_context={}, expansion_rules={}, slot_lists={}, wildcard_list_names=set(), metadata=None, required_keywords=None, settings=IntentDataSettings(filter_with_regex=True)), entities={}, entities_list=[], response='default', context={}, unmatched_entities={}, unmatched_entities_list=[], text_chunks_matched=10, intent_sentence=Sentence(items=[TextChunk(text='hello ', original_text='hello ', parent=Sequence(items=[...], type=<SequenceType.GROUP: 'group'>, is_optional=False)), TextChunk(text='world', original_text='world', parent=Sequence(items=[...], type=<SequenceType.GROUP: 'group'>, is_optional=False))], type=<SequenceType.GROUP: 'group'>, is_optional=False, text='hello world', pattern=re.compile('^hello[ ]*world$', re.IGNORECASE)), intent_metadata=None)(<class 'hassil.recognize.RecognizeResult'>

And here is the error log when triggering my custom sentence ("Let's go to sleep"):

Logger: homeassistant.components.websocket_api.messages
Source: components/websocket_api/messages.py:246
integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 4:52:57 PM (1 occurrences)
Last logged: 4:52:57 PM

Unable to serialize to JSON. Bad data found at $.event.data.result=RecognizeResult(intent=Intent(name='1', data=[IntentData(sentence_texts=["let's go to sleep"], slots={}, response=None, requires_context={}, excludes_context={}, expansion_rules={}, slot_lists={}, wildcard_list_names=set(), metadata=None, required_keywords=None, settings=IntentDataSettings(filter_with_regex=True))]), intent_data=IntentData(sentence_texts=["let's go to sleep"], slots={}, response=None, requires_context={}, excludes_context={}, expansion_rules={}, slot_lists={}, wildcard_list_names=set(), metadata=None, required_keywords=None, settings=IntentDataSettings(filter_with_regex=True)), entities={}, entities_list=[], response='default', context={}, unmatched_entities={}, unmatched_entities_list=[], text_chunks_matched=14, intent_sentence=Sentence(items=[TextChunk(text="let's ", original_text="let's ", parent=Sequence(items=[...], type=<SequenceType.GROUP: 'group'>, is_optional=False)), TextChunk(text='go ', original_text='go ', parent=Sequence(items=[...], type=<SequenceType.GROUP: 'group'>, is_optional=False)), TextChunk(text='to ', original_text='to ', parent=Sequence(items=[...], type=<SequenceType.GROUP: 'group'>, is_optional=False)), TextChunk(text='sleep', original_text='sleep', parent=Sequence(items=[...], type=<SequenceType.GROUP: 'group'>, is_optional=False))], type=<SequenceType.GROUP: 'group'>, is_optional=False, text="let's go to sleep", pattern=re.compile("^let's[ ]*go[ ]*to[ ]*sleep$", re.IGNORECASE)), intent_metadata=None)(<class 'hassil.recognize.RecognizeResult'>

To Reproduce

  1. Import the Basic Usage example from https://zachowj.github.io/node-red-contrib-home-assistant-websocket/node/sentence.html#basic-usage
  2. Deploy the flow
  3. Click one of the inject nodes

Expected behavior

The sentence node should successfully output an event for other nodes to receive when the sentence is stated

Screenshots

No response

Example Flow

[{"id":"2f10cb78ab2f486f","type":"debug","z":"01b6599a0739a237","name":"debug","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"msg","x":418,"y":1136,"wires":[]},{"id":"5c563c29d19f4aab","type":"ha-sentence","z":"01b6599a0739a237","name":"","server":"5d205f70b1e41e9f","version":2,"inputs":0,"outputs":1,"exposeAsEntityConfig":"","mode":"trigger","sentences":["[it's ]party time","happy (new year|birthday)","hello world"],"response":"","responseType":"fixed","responseTimeout":1000,"outputProperties":[{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"},{"property":"payload","propertyType":"msg","value":"","valueType":"triggerId"},{"property":"sentences","propertyType":"msg","value":"sentences","valueType":"config"}],"x":212,"y":1136,"wires":[["2f10cb78ab2f486f"]]},{"id":"4868b36e0e57db4f","type":"api-call-service","z":"01b6599a0739a237","name":"process sentence","server":"","version":7,"debugenabled":false,"action":"conversation.process","floorId":[],"areaId":[],"deviceId":[],"entityId":[],"labelId":[],"data":"   {\"text\": payload}\t","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","blockInputOverrides":false,"domain":"conversation","service":"process","x":458,"y":1088,"wires":[[]]},{"id":"0bd711e6ab321cf9","type":"inject","z":"01b6599a0739a237","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"happy new year","payloadType":"str","x":236,"y":1088,"wires":[["4868b36e0e57db4f"]]},{"id":"7b19f1bcd79bf7ea","type":"inject","z":"01b6599a0739a237","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"happy birthday","payloadType":"str","x":240,"y":1040,"wires":[["4868b36e0e57db4f"]]},{"id":"fdec3314ea56130d","type":"inject","z":"01b6599a0739a237","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"party time","payloadType":"str","x":220,"y":992,"wires":[["4868b36e0e57db4f"]]},{"id":"92aa9c7e046ebba3","type":"inject","z":"01b6599a0739a237","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"it's party time","payloadType":"str","x":234,"y":944,"wires":[["4868b36e0e57db4f"]]},{"id":"4c1ecc1396d9eddf","type":"inject","z":"01b6599a0739a237","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"hello world","payloadType":"str","x":224,"y":896,"wires":[["4868b36e0e57db4f"]]}]

Environment Information

Version: 0.74.2

Home Assistant version: 2024.12.0
Companion version: 4.1.1

Node-RED version: 4.0.3
Docker: yes
Add-on: 18.1.1

Node.js version: v18.20.4 x64 linux
OS: Linux 6.6.63-haos x64

Additional context

I also tried updating the pallet to the latest version (0.74.2 at the time of writing this issue) and was still able to replicate this issue

@hagak
Copy link

hagak commented Dec 8, 2024

I just started messing around with Sentence Nodes and getting the same behaviour as above

@zachowj
Copy link
Owner

zachowj commented Dec 8, 2024

Home Assistant 2024.12.0 introduced breaking changes with this pull request, which affects the custom component. The component needs to be updated to accommodate these changes.

Transferring this issue to the Node-RED companion repository, as it is the appropriate location for addressing it.

@zachowj zachowj transferred this issue from zachowj/node-red-contrib-home-assistant-websocket Dec 8, 2024
@zachowj zachowj added the bug Something isn't working label Dec 8, 2024
@alpaygani
Copy link

Is there any progress?

@Nab0y
Copy link

Nab0y commented Dec 12, 2024

Is there any progress?

I'm joining in on this question. Living has become less comfortable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants