greghesp/assistant-relay

HomeBridge

tutasca opened this issue · 5 comments

Trying to cast a door-bell.mp3 file to google assistant to cast the ding dong sound
Achieved to create a cURL to broadcast a “dinner” message using Homebridge Http Switch Unlimited https://www.npmjs.com/package/homebridge-http-switch-unlimited
with the following json

{
    "accessory": "HTTP-SWITCH-UNLIMITED",
    "name": "test3",
    "switchType": "stateless",
    "timeout": 1000,
    "onUrl": [
        {
            "url": "http://192.168.0.222:3000/assistant",
            "method": "POST",
            "body": {
                "user": "asisteme",
                "command": "dinner",
                "broadcast": true
            },
            "headers": {
                "Content-Type": "application/json"
            }
        }
    ]
}

However i am quite inexpert and don’t know the syntax to cast a local sound
Made different attempts all unsuccessfully like this one

{
    "accessory": "HTTP-SWITCH-UNLIMITED",
    "name": "doorbell",
    "switchType": "stateless",
    "timeout": 1000,
    "onUrl": [
        {
            "url": "http://192.168.0.222:3000/assistant",
            "method": "POST",
            "body": {
                "device": "Living Room speaker",
                "source": "/tmp/Ding.mp3",
                "type": "local",
                "converse": true
            },
            "headers": {
                "Content-Type": "application/json"
            }
        }
    ]
}

Would you be able to publish either the json syntax or the plugin for HomeBridge.

Thanks for your work and help

Jose.
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Converse should not be true. That Might be your first problem. The best way to test it would be from the dashboard. Got to 192.168.0.222:3000 and click on "Cast Sandbox" at the top of the page. That will help you build the HTTP request.

Thanks for your quick reply.
I Got it working on the sandbox but haven’t manage to make it work from Homebridge, i made many attempts but the most logical to me is to copy paste the JSON data into “body”
The final text looks like this
Any clue?
601EC137-4B9B-4F08-9515-DC53E011B70C

Are you running inside of docker? Is the file reference within the docker image's filesystem or in the host filesystem?

Sorry, no idea about the docker or host filesystem, pardon my ignorance.
the assistant relay gets installed in the rasbperry pi with the user pi.
it works ok from the web.
I have managed to include the auth token on the POST but when sending the request in the raspberry from homebridge it replies file not found, i have tried using website, local and custom files but always replies the chosen file does not exist
Is it looking for a file with the token?
has it got something to do with the user systems in raspberry?
IMG_8ACB69582C4F-1
i have tried the same, with the same result with this
"device": "Living Room speaker",
"source": "/home/homebridge/hola/Ding.mp3",
"type": "local"

any idea? any chance you could build a plugin for homebridge?

:)

Note, when i log into terminal with shelly the user is "pi" but when i use terminal from homebrige the user is "homebridge"
Screenshot 2021-04-04 at 11 00 57
IMG_81A6F33DD962-1
Thanks again for all the help.