Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Cannot read property 'converse' of undefined #126

Closed
gvdhoven opened this issue Nov 11, 2019 · 24 comments
Closed

Cannot read property 'converse' of undefined #126

gvdhoven opened this issue Nov 11, 2019 · 24 comments
Labels
bug Something isn't working

Comments

@gvdhoven
Copy link

gvdhoven commented Nov 11, 2019

Tried it with and without converse param in POSTMAN, but i can't get it to work.

{ "converse": "true", "command": "test", "user": "frank", "broadcast": "true" }

The example in the readme doesn't give any hints about the requiredness of the converse parameter.

curl -d '{"command":"hello world", "user":"greg", "broadcast":"true"}' -H "Content-Type: application/json" -X POST http://<ip_address>:<port>/assistant

And executing it not in Postman but on my PI also gives:

pi:~$ curl -d '{"command":"hello world", "user":"greg", "broadcast":"true"}' -H "Content-Type: application/json" -X POST http://192.168.1.40:3000/assistant

Gives:

Cannot read property 'converse' of undefined

LOGS:

0|www  | TypeError: Cannot read property 'converse' of undefined
0|www  |     at new Conversation (/assistant_relay/node_modules/google-assistant/components/conversation.js:129:34)
0|www  |     at /assistant_relay/helpers/assistant.js:19:38
0|www  |     at processTicksAndRejections (internal/process/task_queues.js:93:5)
@gvdhoven
Copy link
Author

Update: after issuing a command from the sandbox, which worked, i copied the JSON and it started working:

{
    "name": "frank",
    "converse": "false",
    "broadcast": true,
    "command": "this is a test"
}

No clue why

@gvdhoven
Copy link
Author

Ah wait.. in the sample on the readme there is a mention of "USER" and here i see "NAME".

@gvdhoven gvdhoven reopened this Nov 11, 2019
@greghesp
Copy link
Owner

greghesp commented Nov 11, 2019

I think thats a bug in the sandbox code generation. It should be "user" and not "name".

You need to pass the broadcast and converse parameters as booleans. Can you try passing the converse param as a boolean, not a string?

{ "converse":"true, "command": "test", "user": "frank", "broadcast": true }

I've updated it to v.3.0.4 to fix the typos
https://github.com/greghesp/assistant-relay/releases/tag/v3.0.4

@greghesp greghesp added the bug Something isn't working label Nov 11, 2019
@ryancasler
Copy link
Contributor

ryancasler commented Nov 11, 2019

Something is wrong with the latest release. Custom commands are no longer working but instead are issuing broadcasts no matter what is done.

Previously I had used the example command "Tell me a joke." That is no longer working in 3.0.4.

Ah ha!! Figured it out....in sandbox, if you want the option to be false, you have to toggle it twice so that it sends the false flag to GAR.
Maybe next time we have the false built into the command by default so you don't have to toggle it twice.

@greghesp
Copy link
Owner

@ryancasler You sure there wasn't something else? I've had a look in the code and tested myself and cannot find why it'd be doing that

image

@greghesp
Copy link
Owner

Thats..... odd. It's null by default, so whatever it gets change to first should be that value.

Is that just a Sandbox submission
@webunity Can you go into your config.json file and go to the users object. You should see your user name, and inside the "tokens" object, you should see an expiry_date. What is that date?

@ryancasler
Copy link
Contributor

Okay, I don't know what is going on. When I go in and use this:

{
"user": "ryan",
"command": "What time is it.",
}

It broadcasts "What time is it" But then if I go in and try:
{
"user": "ryan",
"command": "What time is it.",
"converse": false,
"broadcast": false
}

It tells GAR what the time is and I can see that displayed and the sound file is there.

@ryancasler
Copy link
Contributor

I think it's using what ever was set last. Because now when I go in and try:
{
"user": "ryan",
"command": "What time is it.",
}

it does the same thing as
{
"user": "ryan",
"command": "What time is it.",
"converse": false,
"broadcast": false
}

because that was the last way the flags were set. So, basically, those flags always need to be set to make sure it uses the right ones.

@ryancasler
Copy link
Contributor

Also, what is the "converse" flag actually doing? it's just rebroadcasting the text response from Google Assistant, right? Because using this:

{
"user": "ryan",
"command": "Tell me a joke.",
"converse": true,
"broadcast": false
}

Got a broadcast of
What happens when a frog's car breaks?
It gets toad 🐸

But it actually said the words "Toad face" and it started with "Broadcast from Ryan". Maybe we need to eliminate emoji from the message.

@greghesp
Copy link
Owner

@ryancasler Can you open a new bug report for that and ill take a look

@ryancasler
Copy link
Contributor

Sure.

@gvdhoven
Copy link
Author

Is there some way to turn off the 'broadcast from' ? and just have it mention 'the dryer is ready?'

@gvdhoven
Copy link
Author

Thats..... odd. It's null by default, so whatever it gets change to first should be that value.

Is that just a Sandbox submission
@webunity Can you go into your config.json file and go to the users object. You should see your user name, and inside the "tokens" object, you should see an expiry_date. What is that date?

it was a fresh install + login and it works with name on my install (haven't updated yet)

@greghesp
Copy link
Owner

Hmm, I can't figure out whats causing this. Seems to randomly happen.

The correct parameter is "user". It's just ignoring the "name" param because it doesn't know what it is. Since you're the only user and you're not passing it as a param, it takes the first user you setup

@kylecauston
Copy link

Is there some way to turn off the 'broadcast from' ? and just have it mention 'the dryer is ready?'

This would be very nice. Makes it sound like GA is announcing something, rather than being announced through.

@gvdhoven
Copy link
Author

Does it happen on your end? If not, what is the countrycode of your linked google account?

@greghesp
Copy link
Owner

Does it happen on your end? If not, what is the countrycode of your linked google account?

It happens randomly, but I haven't figured out what's causing it or how to fix it yet.
I thought maybe it happens when the auth token expires but I don't think that's the case

@ryancasler
Copy link
Contributor

Is there some way to turn off the 'broadcast from' ? and just have it mention 'the dryer is ready?'

Unfortunately you can't because it's part of the function of Google Assistant. Broadcasting voice messages, like you would from your phone or another speaker, that are in your voice and do not contain that message at the beginning, are not supported by the Google Assistant SDK that this program is based on. This is a list of the supported feature of the SDK.

image

@gvdhoven
Copy link
Author

Unfortunately broadcasting voice messages is not supported, else you could pre-record a message and 'simulate' to Google you said it. I think this ticket can be closed.

@greghesp
Copy link
Owner

@webunity voice messages has nothing to do with this bug?

@gvdhoven
Copy link
Author

gvdhoven commented Nov 22, 2019

yes and no; a possible work around could be that you don't send text, but voice; you might be able to 'fool' google by sending/uploading a pre-recorded message like "announce ..." (in mp3) spoken by the GA voice or something; after which the GA would think it was spoken by a user. But, this is not supported right now so lets don't take that indeed into consideration here.

@greghesp
Copy link
Owner

Sorry, i'm confused as to what this as to do with the original bug reported though?

@ryancasler
Copy link
Contributor

It doesn't. This was in regards to:

Is there some way to turn off the 'broadcast from' ? and just have it mention 'the dryer is ready?'

@jaytaylor
Copy link

Auth error:TypeError: Cannot read property 'access_token' of undefined

Cannot read property 'converse' of undefined

Following a HomeAssistant / HASSIO Assistant-Relay setup tutorial, I encountered the above errors in the container logs when testing in the AR Sandbox. Resolved by removing and reinstalling the add-on in HASSIO and re-creating / re-authenticating my assistant-relay user.

To me this suggests the culprit is likely that the access_token initialization failed the first time around.

After that, all errors have cleared up and Assistant-Relay is working magnificently!

Related issues:

#150
#126
#242

Hope this can help anyone else who encounters this class of issue in the future.

<3

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

No branches or pull requests

5 participants