{ "anyOf": [{ "$ref": "#/definitions/Automation" }, { "type": "array", "items": { "$ref": "#/definitions/Automation" } }], "definitions": { "Automation": { "type": "object", "properties": { "id": { "type": "string" }, "alias": { "type": "string" }, "initial_state": { "type": ["string", "boolean"] }, "hide_entity": { "type": "boolean" }, "trigger": { "anyOf": [{ "$ref": "#/definitions/HaTrigger" }, { "$ref": "#/definitions/SunTrigger" }, { "$ref": "#/definitions/TimeTrigger" }, { "$ref": "#/definitions/TemplateTrigger" }, { "$ref": "#/definitions/WebhookTrigger" }, { "$ref": "#/definitions/EventTrigger" }, { "$ref": "#/definitions/TimePatternTrigger" }, { "$ref": "#/definitions/MqttTrigger" }, { "$ref": "#/definitions/GeoLocationTrigger" }, { "$ref": "#/definitions/StateTrigger" }, { "$ref": "#/definitions/ZoneTrigger" }, { "$ref": "#/definitions/NumericStateTrigger" }, { "type": "array", "items": { "anyOf": [{ "$ref": "#/definitions/HaTrigger" }, { "$ref": "#/definitions/SunTrigger" }, { "$ref": "#/definitions/TimeTrigger" }, { "$ref": "#/definitions/TemplateTrigger" }, { "$ref": "#/definitions/WebhookTrigger" }, { "$ref": "#/definitions/EventTrigger" }, { "$ref": "#/definitions/TimePatternTrigger" }, { "$ref": "#/definitions/MqttTrigger" }, { "$ref": "#/definitions/GeoLocationTrigger" }, { "$ref": "#/definitions/StateTrigger" }, { "$ref": "#/definitions/ZoneTrigger" }, { "$ref": "#/definitions/NumericStateTrigger" }] } }] }, "condition": { "anyOf": [{ "$ref": "#/definitions/NumericStateConditionSchema" }, { "$ref": "#/definitions/StateConditionSchema" }, { "$ref": "#/definitions/SunConditionSchema" }, { "$ref": "#/definitions/TemplateConditionSchema" }, { "$ref": "#/definitions/TimeConditionSchema" }, { "$ref": "#/definitions/ZoneConditionSchema" }, { "$ref": "#/definitions/AndConditionSchema" }, { "$ref": "#/definitions/OrConditionSchema" }, { "type": "array", "items": { "anyOf": [{ "$ref": "#/definitions/NumericStateConditionSchema" }, { "$ref": "#/definitions/StateConditionSchema" }, { "$ref": "#/definitions/SunConditionSchema" }, { "$ref": "#/definitions/TemplateConditionSchema" }, { "$ref": "#/definitions/TimeConditionSchema" }, { "$ref": "#/definitions/ZoneConditionSchema" }, { "$ref": "#/definitions/AndConditionSchema" }, { "$ref": "#/definitions/OrConditionSchema" }] } }] }, "action": { "anyOf": [{ "$ref": "#/definitions/EventActionSchema" }, { "$ref": "#/definitions/ServiceActionSchema" }, { "$ref": "#/definitions/DelayActionSchema" }, { "$ref": "#/definitions/ServiceActionTemplateSchema" }, { "type": "array", "items": { "anyOf": [{ "$ref": "#/definitions/EventActionSchema" }, { "$ref": "#/definitions/ServiceActionSchema" }, { "$ref": "#/definitions/DelayActionSchema" }, { "$ref": "#/definitions/ServiceActionTemplateSchema" }, { "$ref": "#/definitions/NumericStateConditionSchema" }, { "$ref": "#/definitions/StateConditionSchema" }, { "$ref": "#/definitions/SunConditionSchema" }, { "$ref": "#/definitions/TemplateConditionSchema" }, { "$ref": "#/definitions/TimeConditionSchema" }, { "$ref": "#/definitions/ZoneConditionSchema" }, { "$ref": "#/definitions/AndConditionSchema" }, { "$ref": "#/definitions/OrConditionSchema" }, { "type": "array", "items": { "anyOf": [{ "$ref": "#/definitions/NumericStateConditionSchema" }, { "$ref": "#/definitions/StateConditionSchema" }, { "$ref": "#/definitions/SunConditionSchema" }, { "$ref": "#/definitions/TemplateConditionSchema" }, { "$ref": "#/definitions/TimeConditionSchema" }, { "$ref": "#/definitions/ZoneConditionSchema" }, { "$ref": "#/definitions/AndConditionSchema" }, { "$ref": "#/definitions/OrConditionSchema" }] } }] } }] } }, "additionalProperties": false, "required": ["action", "trigger"] }, "HaTrigger": { "type": "object", "properties": { "platform": { "type": "string", "enum": ["homeassistant"] }, "event": { "enum": ["shutdown", "start"], "type": "string" } }, "additionalProperties": false, "required": ["event", "platform"] }, "SunTrigger": { "type": "object", "properties": { "platform": { "type": "string", "enum": ["sun"] }, "event": { "enum": ["sunrise", "sunset"], "type": "string" }, "offset": { "type": "string" } }, "additionalProperties": false, "required": ["event", "platform"] }, "TimeTrigger": { "type": "object", "properties": { "platform": { "type": "string", "enum": ["time"] }, "at": { "type": "string" } }, "additionalProperties": false, "required": ["at", "platform"] }, "TemplateTrigger": { "type": "object", "properties": { "platform": { "type": "string", "enum": ["template"] }, "value_template": { "type": "string" } }, "additionalProperties": false, "required": ["platform", "value_template"] }, "WebhookTrigger": { "type": "object", "properties": { "platform": { "type": "string", "enum": ["webhook"] }, "webhook_id": { "type": "string" } }, "additionalProperties": false, "required": ["platform", "webhook_id"] }, "EventTrigger": { "type": "object", "properties": { "platform": { "type": "string", "enum": ["event"] }, "event_type": { "type": "string" }, "event_data": {} }, "additionalProperties": false, "required": ["event_type", "platform"] }, "TimePatternTrigger": { "type": "object", "properties": { "platform": { "type": "string", "enum": ["time_pattern"] }, "hours": { "type": "string" }, "minutes": { "type": ["string", "number"] }, "seconds": { "type": ["string", "number"] } }, "additionalProperties": false, "required": ["platform"] }, "MqttTrigger": { "type": "object", "properties": { "platform": { "type": "string", "enum": ["mqtt"] }, "topic": { "type": "string" }, "payload": { "type": "string" }, "encoding": { "type": "string" } }, "additionalProperties": false, "required": ["platform", "topic"] }, "GeoLocationTrigger": { "type": "object", "properties": { "platform": { "type": "string", "enum": ["geo_location"] }, "source": { "type": "string" }, "zone": { "type": "string" }, "event": { "enum": ["enter", "leave"], "type": "string" } }, "additionalProperties": false, "required": ["event", "platform", "source", "zone"] }, "StateTrigger": { "type": "object", "properties": { "platform": { "type": "string", "enum": ["state"] }, "entity_id": { "anyOf": [{ "type": "array", "items": { "type": "string" } }, { "type": "string" }] }, "from": { "type": ["string", "boolean"] }, "to": { "type": ["string", "boolean"] }, "for": { "anyOf": [{ "$ref": "#/definitions/TimePeriod" }, { "type": "string" }] } }, "additionalProperties": false, "required": ["entity_id", "platform"] }, "TimePeriod": { "type": "object", "properties": { "days": { "type": ["string", "number"] }, "hours": { "type": ["string", "number"] }, "minutes": { "type": ["string", "number"] }, "seconds": { "type": ["string", "number"] }, "milliseconds": { "type": ["string", "number"] } }, "additionalProperties": false }, "ZoneTrigger": { "type": "object", "properties": { "platform": { "type": "string", "enum": ["zone"] }, "entity_id": { "anyOf": [{ "type": "array", "items": { "type": "string" } }, { "type": "string" }] }, "zone": { "type": "string" }, "event": { "enum": ["enter", "leave"], "type": "string" } }, "additionalProperties": false, "required": ["entity_id", "event", "platform", "zone"] }, "NumericStateTrigger": { "type": "object", "properties": { "platform": { "type": "string", "enum": ["numeric_state"] }, "entity_id": { "anyOf": [{ "type": "array", "items": { "type": "string" } }, { "type": "string" }] }, "below": { "type": ["string", "number"] }, "above": { "type": ["string", "number"] }, "value_template": { "type": "string" }, "for": { "anyOf": [{ "$ref": "#/definitions/TimePeriod" }, { "type": "string" }] } }, "additionalProperties": false, "required": ["entity_id", "platform"] }, "NumericStateConditionSchema": { "type": "object", "properties": { "condition": { "type": "string", "enum": ["numeric_state"] }, "entity_id": { "anyOf": [{ "type": "array", "items": { "type": "string" } }, { "type": "string" }] }, "below": { "type": ["string", "number"] }, "above": { "type": ["string", "number"] }, "value_template": { "type": "string" } }, "additionalProperties": false, "required": ["condition", "entity_id"] }, "StateConditionSchema": { "type": "object", "properties": { "condition": { "type": "string", "enum": ["state"] }, "entity_id": { "anyOf": [{ "type": "array", "items": { "type": "string" } }, { "type": "string" }] }, "state": { "type": ["string", "boolean"] }, "for": { "anyOf": [{ "$ref": "#/definitions/TimePeriod" }, { "type": "string" }] }, "from": { "type": "string" } }, "additionalProperties": false, "required": ["condition", "entity_id", "state"] }, "SunConditionSchema": { "type": "object", "properties": { "condition": { "type": "string", "enum": ["sun"] }, "before": { "type": "string" }, "before_offset": { "type": "string" }, "after": { "type": "string" }, "after_offset": { "type": "string" } }, "additionalProperties": false, "required": ["condition"] }, "TemplateConditionSchema": { "type": "object", "properties": { "condition": { "type": "string", "enum": ["template"] }, "value_template": { "type": "string" } }, "additionalProperties": false, "required": ["condition"] }, "TimeConditionSchema": { "type": "object", "properties": { "condition": { "type": "string", "enum": ["time"] }, "before": { "type": "string" }, "after": { "type": "string" }, "weekday": { "anyOf": [{ "type": "array", "items": { "enum": ["fri", "mon", "sat", "sun", "thu", "tue", "wed"], "type": "string" } }, { "enum": ["fri", "mon", "sat", "sun", "thu", "tue", "wed"], "type": "string" }] } }, "additionalProperties": false, "required": ["condition"] }, "ZoneConditionSchema": { "type": "object", "properties": { "condition": { "type": "string", "enum": ["zone"] }, "entity_id": { "anyOf": [{ "type": "array", "items": { "type": "string" } }, { "type": "string" }] }, "zone": { "type": "string" } }, "additionalProperties": false, "required": ["condition", "entity_id"] }, "AndConditionSchema": { "type": "object", "properties": { "condition": { "type": "string", "enum": ["and"] }, "conditions": { "anyOf": [{ "$ref": "#/definitions/NumericStateConditionSchema" }, { "$ref": "#/definitions/StateConditionSchema" }, { "$ref": "#/definitions/SunConditionSchema" }, { "$ref": "#/definitions/TemplateConditionSchema" }, { "$ref": "#/definitions/TimeConditionSchema" }, { "$ref": "#/definitions/ZoneConditionSchema" }, { "$ref": "#/definitions/AndConditionSchema" }, { "$ref": "#/definitions/OrConditionSchema" }, { "type": "array", "items": { "anyOf": [{ "$ref": "#/definitions/NumericStateConditionSchema" }, { "$ref": "#/definitions/StateConditionSchema" }, { "$ref": "#/definitions/SunConditionSchema" }, { "$ref": "#/definitions/TemplateConditionSchema" }, { "$ref": "#/definitions/TimeConditionSchema" }, { "$ref": "#/definitions/ZoneConditionSchema" }, { "$ref": "#/definitions/AndConditionSchema" }, { "$ref": "#/definitions/OrConditionSchema" }] } }] } }, "additionalProperties": false, "required": ["condition", "conditions"] }, "OrConditionSchema": { "type": "object", "properties": { "condition": { "type": "string", "enum": ["or"] }, "conditions": { "anyOf": [{ "$ref": "#/definitions/NumericStateConditionSchema" }, { "$ref": "#/definitions/StateConditionSchema" }, { "$ref": "#/definitions/SunConditionSchema" }, { "$ref": "#/definitions/TemplateConditionSchema" }, { "$ref": "#/definitions/TimeConditionSchema" }, { "$ref": "#/definitions/ZoneConditionSchema" }, { "$ref": "#/definitions/AndConditionSchema" }, { "$ref": "#/definitions/OrConditionSchema" }, { "type": "array", "items": { "anyOf": [{ "$ref": "#/definitions/NumericStateConditionSchema" }, { "$ref": "#/definitions/StateConditionSchema" }, { "$ref": "#/definitions/SunConditionSchema" }, { "$ref": "#/definitions/TemplateConditionSchema" }, { "$ref": "#/definitions/TimeConditionSchema" }, { "$ref": "#/definitions/ZoneConditionSchema" }, { "$ref": "#/definitions/AndConditionSchema" }, { "$ref": "#/definitions/OrConditionSchema" }] } }] } }, "additionalProperties": false, "required": ["condition", "conditions"] }, "EventActionSchema": { "type": "object", "properties": { "alias": { "type": "string" }, "event": { "type": "string" }, "event_data": {}, "event_data_template": {} }, "additionalProperties": false, "required": ["event"] }, "ServiceActionSchema": { "type": "object", "properties": { "service": { "type": "string" }, "service_template": { "type": "string" }, "entity_id": { "anyOf": [{ "type": "array", "items": { "type": "string" } }, { "type": "string" }] }, "data": {}, "data_template": {} }, "additionalProperties": false, "required": ["service"] }, "DelayActionSchema": { "type": "object", "properties": { "delay": { "anyOf": [{ "$ref": "#/definitions/TimePeriod" }, { "type": ["string", "number"] }] } }, "additionalProperties": false, "required": ["delay"] }, "ServiceActionTemplateSchema": { "type": "object", "properties": { "service_template": { "type": "string" }, "entity_id": { "anyOf": [{ "type": "array", "items": { "type": "string" } }, { "type": "string" }] }, "data": {}, "data_template": {} }, "additionalProperties": false, "required": ["service_template"] } }, "$schema": "http://json-schema.org/draft-07/schema#" }
