Scripts are a way to automate tasks in the house. They a written in the JavaScript language and can be used to automate anything from turning on the lights when you come home to sending a notification when the washing machine is done.
- Create a script
- Get a scripts
- Get a script
- Update a script
- Update code of a script
- Delete a script
- Run a script
POST /api/scripts
{
"name": "string",
"code": "string",
"targetEvent": "string",
"targetType": "string",
"targetId": "string" | null,
"description": "string" | null,
"allowAnonymous": true | false | null,
"enabled": true | false | null,
}| Name | Type | Description |
|---|---|---|
| name | string |
The name of the script |
| code | string |
The JavaScript code of the script |
| targetEvent | ScriptTargetEvent |
The event that triggers the script |
| targetType | ScriptTargetType |
The entity that runs the script |
| targetId | string or null |
The id of the target |
| description | string or null |
The description of the script |
| allowAnonymous | boolean or null |
Whether the script can be run by anonymous users |
| enabled | boolean or null |
Whether the script is enabled |
{
"id": "string",
}| Name | Type | Description |
|---|---|---|
| id | string |
The id of the script |
GET /api/scripts/
[
{
"id": "string",
},
...
]| Name | Type | Description |
|---|---|---|
| id | string |
The id of the script |
GET /api/scripts/:id
{
"id": "string",
"name": "string",
"code": "string",
"targetEvent": "string",
"targetType": "string",
"targetId": "string" | null,
"description": "string" | null,
"allowAnonymous": true | false,
}| Name | Type | Description |
|---|---|---|
| id | string |
The id of the script |
| name | string |
The name of the script |
| code | string |
The JavaScript code of the script |
| targetEvent | ScriptTargetEvent |
The event that triggers the script |
| targetType | ScriptTargetType |
The entity that runs the script |
| targetId | string or null |
The id of the target |
| description | string or null |
The description of the script |
| allowAnonymous | boolean |
Whether the script can be run by anonymous users |
PUT /api/scripts/:id
{
"name": "string" | null,
"code": "string" | null,
"targetEvent": "string" | null,
"description": "string" | null,
"allowAnonymous": true | false | null,
"enabled": true | false | null,
}| Name | Type | Description |
|---|---|---|
| name | string or null |
The name of the script |
| code | string or null |
The JavaScript code of the script |
| targetEvent | ScriptTargetEvent or null |
The event that triggers the script |
| description | string or null |
The description of the script |
| allowAnonymous | boolean or null |
Whether the script can be run by anonymous users |
| enabled | boolean |
Whether the script is enabled |
400 Bad Request
404 Not Found
200 OKPUT /api/scripts/:id/code
[code]| Name | Type | Description |
|---|---|---|
| [code] | string |
The JavaScript code of the script |
400 Bad Request
404 Not Found
200 OKDELETE /api/scripts/:id
404 Not Found
200 OKGET /api/scripts/:id/execute
404 Not Found
401 Unauthorized
400 Bad Request
200 OK