{ "anyOf": [{ "$ref": "#/definitions/Script" }, { "type": "array", "items": { "$ref": "#/definitions/Script" } }], "definitions": { "Script": { "type": "object", "additionalProperties": { "anyOf": [{ "$ref": "#/definitions/SequencedAction" }, { "$ref": "#/definitions/ServiceAction" }, { "$ref": "#/definitions/DelayAction" }, { "$ref": "#/definitions/WaitAction" }, { "$ref": "#/definitions/EventAction" }] } }, "SequencedAction": { "type": "object", "properties": { "alias": { "type": "string" }, "sequence": { "anyOf": [{ "$ref": "#/definitions/ServiceAction" }, { "$ref": "#/definitions/DelayAction" }, { "$ref": "#/definitions/WaitAction" }, { "$ref": "#/definitions/EventAction" }, { "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" }, { "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" }] } }, { "$ref": "#/definitions/ServiceAction" }, { "$ref": "#/definitions/DelayAction" }, { "$ref": "#/definitions/WaitAction" }, { "$ref": "#/definitions/EventAction" }] } }] } }, "additionalProperties": false, "required": ["sequence"] }, "ServiceAction": { "type": "object", "properties": { "service": { "type": "string" }, "service_template": { "type": "string" }, "data": {}, "data_template": {}, "entity_id": { "type": "string" } }, "additionalProperties": false, "required": ["service"] }, "DelayAction": { "type": "object", "properties": { "delay": { "anyOf": [{ "$ref": "#/definitions/TimePeriod" }, { "type": ["string", "number"] }] } }, "additionalProperties": false, "required": ["delay"] }, "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 }, "WaitAction": { "type": "object", "properties": { "wait_template": { "type": "string" }, "timeout": { "type": "string" }, "continue_on_timeout": { "type": "boolean" } }, "additionalProperties": false, "required": ["wait_template"] }, "EventAction": { "type": "object", "properties": { "event": { "type": "string" }, "event_data": { "$ref": "#/definitions/EventActionData" }, "event_data_template": {} }, "additionalProperties": false, "required": ["event", "event_data", "event_data_template"] }, "EventActionData": { "additionalProperties": true, "type": "object", "properties": { "name": { "type": "string" }, "message": { "type": "string" }, "entity_id": { "type": "string" }, "domain": { "type": "string" } } }, "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"] } }, "$schema": "http://json-schema.org/draft-07/schema#" }
