import { h, Component } from 'preact'; import Trigger from './trigger'; import Script from './script'; export default class Automation extends Component { constructor() { super(); this.onChange = this.onChange.bind(this); this.triggerChanged = this.triggerChanged.bind(this); this.actionChanged = this.actionChanged.bind(this); } onChange(ev) { this.props.onChange({ ...this.props.automation, [ev.target.name]: ev.target.value, }); } triggerChanged(trigger) { this.props.onChange({ ...this.props.automation, trigger, }); } actionChanged(action) { this.props.onChange({ ...this.props.automation, action, }); } render({ automation, isWide }) { const { alias, trigger, condition, action } = automation; return (
{alias} Use automations to bring your home alive.
Triggers Triggers are what starts the processing of an automation rule. It is possible to specify multiple triggers for the same rule. Once a trigger starts, Home Assistant will validate the conditions, if any, and call the action.

Learn more about triggers.

{ condition && Conditions Conditions are an optional part of an automation rule and can be used to prevent an action from happening when triggered. Conditions look very similar to triggers but are very different. A trigger will look at events happening in the system while a condition only looks at how the system looks right now. A trigger can observe that a switch is being turned on. A condition can only see if a switch is currently on or off.

Learn more about conditions.

Conditions are not supported yet.
{JSON.stringify(condition, null, 2)}
} Action The actions are what Home Assistant will do when the automation is triggered.

Learn more about actions.