简体   繁体   English

使用Google中的“操作”通过自定义命令控制设备

[英]Control your device with custom commands using Actions in Google

just getting started with Assistant features in RPi and I am able to successfully implement upto this point and wondering few thing. 刚开始使用RPi中的助手功能,我就可以成功地实现这一点,并且对此感到好奇。

Scenario: 场景:

  • user: hey google "please turn on my living room Lights" 用户:嘿Google“请打开我的客厅灯”
  • List item my code in horword.py : has a function to perform same action based on ON_RECOGNIZING_SPEACH_FINISHED 在horword.py中列出我的代码:具有基于ON_RECOGNIZING_SPEACH_FINISHED执行相同操作的功能
  • RPi/google home: I am not sure how respond to that RPi / google主页:我不确定如何回应

I was able to capture the request query asked by user using ON_RECOGNIZING_SPEACH_FINISHED = Args.text(str) and use it in my logic to perform the task. 我能够使用ON_RECOGNIZING_SPEACH_FINISHED = Args.text(str)捕获用户提出的请求查询,并在我的逻辑中使用它来执行任务。 However, at the same time, "ok google" is responding with this answer. 但是,与此同时,“ ok google”正在回答此问题。

to mitigate this problem, I created an google-actions, now it understands my query and respond with intention from api.ai. 为了缓解这个问题,我创建了一个google-actions,现在它可以理解我的查询并有意从api.ai进行响应。 However, didn't acts on turn lights ON. 但是,没有在打开照明灯时起作用。 So, wondering how can I read response from google home/api.ai in text and change code to act on it locally. 因此,想知道如何才能以文本形式读取Google home / api.ai的响应并更改代码以对其进行本地处理。

appreciate it. 欣赏它。

You will not get response as text. 您将不会收到文本回复。 For getting response to client app use webhook in API.AI and send message using fcm to client app. 为了获得对客户端应用程序的响应,请使用API​​.AI中的webhook并使用fcm将消息发送到客户端应用程序。 Read the fcm message in client app and do the corresponding actions. 阅读客户端应用程序中的fcm消息并执行相应的操作。

finally was able to figure out multiple ways. 终于能够找出多种方式。 answered this in other stack question. 在其他堆栈问题中回答了这个问题。 find more details in this post. 在这篇文章中找到更多详细信息。 Multiple ways to handle this since google doesn't gives voices transcript and we let google say our transcript which is kind off solution for now. 有多种处理方法,因为Google不会提供语音记录,我们让Google说出我们的记录,这是目前的一种解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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