简体   繁体   English

你如何编写一个发布到本地网络 API 的 Google Action

[英]How do you write a Google Action that posts to an API on the local network

I'm just starting out writing Google Actions for some home automation projects.我刚刚开始为一些家庭自动化项目编写 Google Actions。 I can't seem to find information on how to write an action that will POST to an API on the local network.我似乎无法找到有关如何编写将 POST 到本地网络上的 API 的操作的信息。 I don't want to go outside the firewall to automate devices and services located on the local LAN.我不想走出防火墙来自动化位于本地 LAN 上的设备和服务。 I have provided an image of what I'm looking to do.我已经提供了我想要做的事情的图像。 图一

You can't do this.你不能这样做。 The Google Home device doesn't (generally) have access to the local network and aside from basic voice processing, your Actions run in the cloud rather than the local device itself. Google Home 设备(通常)无法访问本地网络,除了基本的语音处理之外,您的操作在云中运行,而不是本地设备本身。

Most devices that appear to act locally all contact a cloud-based service to do what they want.大多数似乎在本地运行的设备都联系基于云的服务来做他们想做的事。 This allows your Assistant to act on them, even when the Assistant device (such as your phone) isn't on the LAN.这允许您的 Google 助理对它们采取行动,即使 Google 助理设备(例如您的手机)不在 LAN 上也是如此。

Your options are pretty narrow:您的选择非常狭窄:

  • See if IFTTT supports what you're trying to do and either use an API with IFTTT or use IFTTT directly from the Home.查看 IFTTT 是否支持您尝试执行的操作,并使用带有 IFTTT 的 API 或直接从主页使用 IFTTT。
  • Setup a tunnel between an endpoint on the public Internet and your LAN.在公共 Internet 上的端点和您的 LAN 之间设置隧道。
  • Setup a cloud-based service your local device checks for state changes (there are a variety of approaches you can take here).设置基于云的服务,您的本地设备会检查状态更改(您可以在此处采用多种方法)。
  • A variant on that last one (inspired by @Nick's comment) is to have a single local hub that listens for changes in some cloud service and dispatches those changes locally.最后一个的变体(受到@Nick 评论的启发)是拥有一个本地集线器,用于侦听某些云服务中的更改并在本地分派这些更改。 (Again, a variety of approaches.) (再次,各种方法。)

If you use Google Smart Home actions you can use:Local Execution如果您使用 Google 智能家居操作,您可以使用:本地执行

I do not know if they plan to extend this to Dialog Flow type actions.我不知道他们是否打算将其扩展到 Dialog Flow 类型的操作。

暂无
暂无

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

相关问题 我需要为出租车预订应用程序 google action 实现 google Transaction API 吗? 因为谷歌行动中没有支付流程 - do I need to implement google Transaction API for taxi booking app google action? because no payment flow in google action 如何使用 Transactions API 在 Google Action 中管理付款 - How manage payment in Google Action using Transactions API 如何在对话期间强制谷歌动作切换语言? - How do I force google action to switch the language during conversation? 您如何将自定义 npm 包包含到 Google Dialogflow 中? - How do you include a custom npm package to Google Dialogflow? 如何使用 Dialogflow API 在 C# 中创建意图? - How do you create an intent in C# using Dialogflow API? 如何保护用作 Diaglogflow / Google Action 主机的 Google 云 function - How do I secure a Google cloud function being used as the host for a Diaglogflow / Google Action 如何使用 Oauth 游乐场获取的刷新和访问令牌在我的 Google Action 中调用 People API? - How to use refresh and access token obtianed using Oauth playground to call People API in my Google Action? Google Action / Dialogflow:如何询问地理位置 - Google Action / Dialogflow : how to ask for geolocation 如何在 dialogflow-fulfillment 的 API V2 中读取/查询响应正文? - How do you read/query the response body in API V2 of dialogflow-fulfillment? 如何将 DialogFlow 代理添加为 Google 操作? - How to add a DialogFlow Agent as a Google Action?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM