Assistant Relay

Please Help!

I have set up assistant relay to communicate with Google assistant. It works fine on the UI interface sandbox. However I cant do anything with the automation because when I call the service under Actions (RESTful_Command: assistant_relay), it doesn’t give the service data field for me to enter the command. I’ve only recently started using home assistant and have no idea why this is happening. Any help will be much appreciated.
Thanks!

Welcome to the community!

Here is an example for one of my automation actions done in yaml

          - service: rest_command.assistant_broadcast
            data:
              command: Daves phone is ringing

Thanks Dave! That doesn’t do the trick however. Do I need something else added in? Do you have a folder for assistant relay under ‘custom_components’? i don’t, not sure if that’s the problem. Anyway here is the error message that I get once I ‘check configuration’
" Configuration invalid CHECK CONFIGURATION

Component error: data - Integration ‘data’ not found. Component error: service - Integration ‘service’ not found. Component error: command - Integration ‘command’ not found."

Thanks for your help in advance.
Cheers,
Nick

Did you add the rest commands they list under examples to your configuration.yaml as per the add-on instructions? The add-on itself just has a rest interface, you have to add the rest commands to interact with it from HA yourself.

Thanks for your suggestion. This is what I have in the config.yaml file (I have masked the last octet of the IP with ‘X’ here). Is there anything else that I should be doing to call this service? Again, this works fine on the web UI (sandbox) and not in HA.

Example configuration.yaml

rest_command:
assistant_broadcast:
url: http://192.168.1.X:3000/assistant
method: POST
content_type: ‘application/json’
payload: ‘{“command”:"{{ command }}", “user”:“Nick”, “broadcast”:true}’

assistant_converse:
url: http://192.168.1.X:3000/assistant
method: POST
content_type: ‘application/json’
payload: ‘{“command”:"{{ command }}", “user”:“Nick”, “converse”:true}’

assistant_relay:
url: http://192.168.1.X/assistant
method: POST
content_type: ‘application/json’
payload: ‘{“command”:"{{ command }}", “user”:“Nick”}’

Just for reference: you don’t need to do that. Internal IP addresses are not sensitive information.

Can you please format your code correctly for us. We can’t confirm that it is correctly indented otherwise.

This is all I have in my config:

rest_command:
  assistant_broadcast:
    url: http://192.168.0.14:3000/assistant
    method: POST
    content_type: 'application/json'
    payload: '{"command":"{{ command }}", "user":"Home Assistant", "broadcast":true}'
    
  assistant_converse:
    url: http://192.168.0.14:3000/assistant
    method: POST
    content_type: 'application/json'
    payload: '{"command":"{{ command }}", "user":"Home Assistant", "converse":true}'
  
  assistant_relay:
    url: http://192.168.0.14:3000/assistant
    method: POST
    content_type: 'application/json'
    payload: '{"command":"{{ command }}", "user":"Home Assistant"}'

Hopefully you can see my config in the attached pic. It doesn’t generate any errors. I did restart HASS but still the same result. Please can you tell me what’s wrong here. This has been bugging me for many days now!!

Thanks!

Can you please post your automation showing the service call? When you paste the code into the forum, highlight all the code and then click the button above that looks like </> to ensure it shows the correct formatting in your post.

Appreciate your help to debug this error - thanks heaps Dave :+1:
I have taken screenshots of a simple automation routine in HASS config to turn off lights with a time trigger. Since ‘actions->call service’ doesn’t show the service data field, I also yaml code, and I get this error message " Message malformed: extra keys not allowed @ data[‘action’][0][‘message’] ".

Spacing is critically important in YAML. Based on where you have put spacing it decides whether something is an object or a scalar. For that reason this is incorrect:

service: rest_command.assistant_broadcast
        data:
          command: turn off living room

By indenting data you’ve turned the service field into an object. Hence you’re getting an error that the row must have at least one of service, service_template. It can’t find your service because its looking for a text field and you’ve made it into an object. This is correct:

service: rest_command.assistant_broadcast
data:
  command: turn off living room

Also for future reference please read over How to ask a good question. You’re posting a lot of screenshots of configuration and automation and it would’ve been a lot easier to help if you had posted the YAML. Also when you do post YAML please surround it in backticks as suggested in the guide as it preserves formatting which is key to solving some of these issues.

Thank you very much for putting that in words and example code. It really helped me understand how this works. I didn’t know the difference like you explained it to me. I finally got it working now :blush:!!

Thanks for your help Dave! It got it working now - my mind was going crazy thinking I don’t have the right files installed in the config directory as I was getting service integration errors. I still however don’t get the service field option in automation but I copy-paste the code in the yaml editor and then it comes up. Phew! I wish knew coding :blush:! Have a good day.

Cheers,
Nick

is it possible only to send to one speaker ?

Not just yet. The beta has this coming from what I understand… if it gets the additional dev time required

I also ran into this same issue as @Nick-homeassistant but was also fixed by @CentralCommand’s YAML.

Finding it really odd i don’t have a service data field either. Imagine it has something to do with the recent UI editor update for automations, scripts etc.

I’m having a weird issue and I would really appreciate any help with this. My installation is working fine. I can issue a command from the sandbox or from HomeAssistant automation and both works. The problem is this: when I type “shuffle jazz classics on kitchen tv” on google assistant, it understands and does it. However, when I type the same thing in the sandbox, Google says it does not understand. Can anyone guess why is this happening?

is this behavior reproducable? What happens when directed to another device?

it is possible now

How? It hasn’t been updated? I’d like to see how you have manged to do it because it’s something I’ve wanted to do for a long time.

Sorry for the late reply,

if u have porrtainer go to add container
add this next to image docker.io: kluuvto/assistant-relay
and also add network ports 3000 3000
and deploy

once its deployed, use the google account whats connected to your google home
create credentials, i did choose desktop
after you created go to the account setup on assistant-relay
enter a username and upload the json file from that created oauth2.
then it will open a random window, follow and do everything it ask. and then it will fail to load a page, but in the browser u see your outhcode, copy it and paste it in auth from Assistant-relay and if done correct, u will hear a broadcast voice saying everything is connected and set-up