Google Home Script Editor

我是家中唯一一個用android 手機的。其他人都是用iphone
所以google home 只會管理我睡房嘅smart devices

最近想到怎樣可以使到冷氣機開咗後自己會係XX小時後自動關閉
我部3/4匹是插在一個smart power switch 到的

我打開google home app, 發現自動化部份, action 只有 on, off 或toggle on/off
沒有辨認當某device  on咗後,到若干時候自動關機

跟住係網上找有咩嘢方法
原來最近google home 有個叫script editor (public preview)的東西
可以用 .yaml 格式就可以做到

例如下面部冷氣機開咗後3小時自己關機
  1. metadata:
  2.   name: Auto Off Air Conditioner After 30 Mins
  3.   description: Turns off the switch 30 minutes after it is turned on

  4. automations:
  5.   - starters:
  6.       - type: device.state.OnOff
  7.         device: Air Conditioner - Bedroom
  8.         state: on
  9.         is: true

  10.     actions:
  11.       - type: time.delay
  12.         for: 180min
  13.       - type: device.command.OnOff
  14.         devices:
  15.           - Air Conditioner - Bedroom
  16.         on: false
複製代碼