Skip to content

Commit

Permalink
Merge pull request #107 from BoschSmartHome/automationtrigger
Browse files Browse the repository at this point in the history
add automation trigger
  • Loading branch information
cap-rb authored Jul 31, 2024
2 parents c79e046 + ce969ed commit 2781102
Show file tree
Hide file tree
Showing 2 changed files with 255 additions and 15 deletions.
108 changes: 107 additions & 1 deletion openapi/MainResources-local-openapi-v3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ openapi: 3.0.0
info:
title: Bosch Smart Home Local API for Main Resources
description: |-
This description focuses on the JSON-based, REST-like API for the Main Resources (devices, rooms, scenarios, messages). To get a detailed description of the related services and states of a device, select one in the 'Select a definition' drop-down box (top right corner).
This description focuses on the JSON-based, REST-like API for the Main Resources (devices, rooms, scenarios, automations, messages). To get a detailed description of the related services and states of a device, select one in the 'Select a definition' drop-down box (top right corner).
By using this documentation, the developer accepts and agrees to be bound by our [Terms and Conditions](https://github.com/BoschSmartHome/bosch-shc-api-docs#terms-and-conditions).
Expand All @@ -21,6 +21,7 @@ tags:
- name: Devices
- name: Rooms
- name: Scenarios
- name: Automations
- name: Messages
- name: Doors/Windows
- name: UserDefinedStates
Expand Down Expand Up @@ -190,6 +191,75 @@ paths:
'405':
description: The method was not allowed.
###
### Automations
###
'/automation/rules':
get:
summary: List all available Automations.
description: Returns all Automations.
tags:
- Automations
parameters:
- $ref: '#/components/parameters/apiVersionHeaderParam'
responses:
'200':
description: Accepted request.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Automation'
'404':
description: The entity could not be found.
'/automation/rules/{automationId}':
get:
summary: Retrieve a specific Automation.
description: |-
Returns the Automation identified by the `automationId` path parameter. The
response includes details about the Automation.
tags:
- Automations
parameters:
- $ref: '#/components/parameters/apiVersionHeaderParam'
- $ref: '#/components/parameters/automationIdPathParam'
responses:
'200':
description: Accepted request.
content:
application/json:
schema:
$ref: '#/components/schemas/Automation'
'404':
description: |-
The entity could not be found. One of the defined path parameters was invalid.
content:
application/json:
schema:
$ref: '#/components/schemas/AdvancedError'

'/automation/rules/{automationId}/trigger':
put:
summary: Triggers the Automation.
description: |-
Triggers the Automation identified by the 'automationId' path parameter, ignoring any conditions being configured.
tags:
- Automations
parameters:
- $ref: '#/components/parameters/apiVersionHeaderParam'
- $ref: '#/components/parameters/automationIdPathParam'
responses:
'202':
description: Accepted request.
'404':
description: The entity could not be found.
content:
application/json:
schema:
$ref: '#/components/schemas/AdvancedError'
'405':
description: The method was not allowed.
###
### Messages
###
'/messages':
Expand Down Expand Up @@ -423,6 +493,42 @@ components:
description: An array of actions defined in this scenario.
items:
type: object
Automation:
type: object
properties:
'@type':
type: string
description: The type of the Object.
example: automation
id:
type: string
description: "A single fully qualified identifier of the Automation."
name:
type: string
description: The name of the Automation.
enabled:
type: boolean
description: Indicates if the Automation is enabled.
example: true
automationTriggers:
type: array
description: An array of triggers defined in this Automation.
items:
type: object
automationConditions:
type: array
description: An array of conditions defined in this Automation.
items:
type: object
automationActions:
type: array
description: An array of actions defined in this Automation.
items:
type: object
conditionLogicalOp:
type: string
description: The logical operator of the conditions.
enum: [AND,OR]
Message:
type: object
properties:
Expand Down
162 changes: 148 additions & 14 deletions postman/Bosch Smart Home Controller.postman_collection.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info": {
"_postman_id": "e9ef2cd5-d80f-45f5-a2bd-47cb327fff19",
"_postman_id": "f537c0b8-ad5d-463b-b399-37a5d1b1f4ee",
"name": "Bosch Smart Home Controller",
"description": "This API enables you to locally access the state of and control your Bosch Smart Home system. Configuring the system is not supported.",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
Expand Down Expand Up @@ -503,7 +503,7 @@
"response": []
},
{
"name": "Messages as array",
"name": "Automations as array",
"event": [
{
"listen": "test",
Expand All @@ -513,9 +513,39 @@
],
"type": "text/javascript"
}
},
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "api-version",
"value": "{{api_version}}",
"type": "text"
}
],
"url": {
"raw": "{{shc_api}}/automation/rules",
"host": [
"{{shc_api}}"
],
"path": [
"automation",
"rules"
]
}
},
"response": []
},
{
"name": "Automation by Id",
"event": [
{
"listen": "prerequest",
"listen": "test",
"script": {
"exec": [
""
Expand All @@ -538,19 +568,21 @@
}
],
"url": {
"raw": "{{shc_api}}/messages",
"raw": "{{shc_api}}/automation/rules/{{automation_id}}",
"host": [
"{{shc_api}}"
],
"path": [
"messages"
"automation",
"rules",
"{{automation_id}}"
]
}
},
"response": []
},
{
"name": "Open doors/windows",
"name": "Automation trigger",
"event": [
{
"listen": "test",
Expand All @@ -572,26 +604,33 @@
}
],
"request": {
"method": "GET",
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
"value": "application/json",
"type": "text"
},
{
"key": "api-version",
"type": "text",
"value": "{{api_version}}"
"value": "{{api_version}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "{{shc_api}}/doors-windows/openwindows",
"raw": "{{shc_api}}/automation/rules/{{automation_id}}/trigger",
"host": [
"{{shc_api}}"
],
"path": [
"doors-windows",
"openwindows"
"automation",
"rules",
"{{automation_id}}",
"trigger"
]
}
},
Expand Down Expand Up @@ -678,6 +717,101 @@
}
},
"response": []
},
{
"name": "Messages as array",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
},
{
"listen": "prerequest",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "api-version",
"value": "{{api_version}}",
"type": "text"
}
],
"url": {
"raw": "{{shc_api}}/messages",
"host": [
"{{shc_api}}"
],
"path": [
"messages"
]
}
},
"response": []
},
{
"name": "Open doors/windows",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
},
{
"listen": "prerequest",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "api-version",
"type": "text",
"value": "{{api_version}}"
}
],
"url": {
"raw": "{{shc_api}}/doors-windows/openwindows",
"host": [
"{{shc_api}}"
],
"path": [
"doors-windows",
"openwindows"
]
}
},
"response": []
}
]
},
Expand Down

0 comments on commit 2781102

Please sign in to comment.