Assistant Relay

Tags: #<Tag:0x00007fc414fc97e0>

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