Automation in Home assistant

1. Core concepts in HA

Home assistant1 有三个核心概念: Automation, Scene, Script.

  • Automation: All automations are made up of a trigger and an action
  • Scene: A scene entity is an entity that can restore the state of a group of entities
  • Script: The script integration allows users to specify a sequence of actions to be executed by Home Assistant

由官方的文档可知, Automation 核心是 触发机制 ,包含触发源和动作间的对应关系; Scene 核心是 实体集合 ,包含集合内各实体的状态; Script 核心是 动作集合

2. Trigger and entity

对于概念 trigger 和 entity ,entity 是任意接入到 home assistant 的实体,其属性 state(s) 随时间和空间的变化可以产生出 trigger(s) 概念,所以一种容易理解方式是将 trigger(s) 理解为 delta-state(s) 。我们可以客制 triggers 以进一步影响其他 entities/states ,这一过程也正是在使用 home assistant 的自动化机制: states 到 states 的反馈调节。