简体   繁体   中英

Make GET/POST calls with google assistant due to own app parameters

I am trying to control home appliances through my app. And I have a web server to take requests and make mqtt publishes with this parameter. And I want to make this requests with google assistant. But some parameters should come from my app and some of them come according to user says. For example: "Turn on kitchen Light"

What google assistant should do:

http:/myserverIp/incoming/param=kitchenLight&param=On&param=userId

What my server should do:

mqtt publish: topic:home/userId/kitchenLight payload=1

I've read google assitant sdk, I watched google io-18/17 assistant talks but I couldn't find right answer. According to picture below I should use "Url template model" but I couldn't find out even where I should locate actions.xml in my android project!

动作模型

Is it possible to pass data to google assistant from my app and making GET/POST request which is user based?

According to picture below I should use "Url template model" but I couldn't find out even where I should locate actions.xml in my android project!

I think this is the source of your confusion. If you are building a Smart Home Action for the Google Assistant - you're not building an Android project at all. You are building a cloud- or server-based webhook that will take JSON from the Assistant and handle it in some way that makes sense for your devices.

In your case, it sounds like one approach would be to have this webhook act as a sort of proxy to your existing service. So it would take the JSON from the Assistant and turn it into the URL query you are currently expecting.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM