Skip to content

Commit

Permalink
Added /resource/smart_scene API
Browse files Browse the repository at this point in the history
  • Loading branch information
a-stangl committed Aug 6, 2024
1 parent f7909b1 commit 0ec3d87
Show file tree
Hide file tree
Showing 11 changed files with 410 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ tags:
description: API to manage bridge homes. Homes group rooms as well as devices not assigned to a room.
- name: Scene
description: API to manage scenes. Scenes are used to store and recall settings for a group of lights.
- name: Smart Scene
description: API to manage smart scenes
- name: Room
description: API to manage rooms. Rooms group devices and each device can only be part of one room.
- name: Zone
Expand Down Expand Up @@ -100,6 +102,11 @@ paths:
$ref: './scene/scene.yaml'
/clip/v2/resource/scene/{sceneId}:
$ref: './scene/scene_{sceneId}.yaml'
# Smart Scene
/clip/v2/resource/smart_scene:
$ref: './smart_scene/smart_scene.yaml'
/clip/v2/resource/smart_scene/{sceneId}:
$ref: './smart_scene/smart_scene_{sceneId}.yaml'
# Room
/clip/v2/resource/room:
$ref: './room/room.yaml'
Expand Down
10 changes: 10 additions & 0 deletions src/smart_scene/schemas/DayTimeslotsGet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type: object
properties:
timeslots:
type: array
items:
$ref: './SmartSceneTimeslotGet.yaml'
recurrence:
type: array
items:
$ref: './Weekday.yaml'
44 changes: 44 additions & 0 deletions src/smart_scene/schemas/SmartSceneGet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
type: object
allOf:
- $ref: '../../common/Resource.yaml'
- type: object
properties:
type:
type: string
enum:
- smart_scene
metadata:
$ref: './SmartSceneMetadata.yaml'
group:
$ref: '../../common/ResourceIdentifier.yaml'
week_timeslots:
description: information on what is the light state for every timeslot of the day
type: array
items:
$ref: './DayTimeslotsGet.yaml'
transition_duration:
description: duration of the transition from on one timeslot's scene to the other (defaults to 60000ms)
type: integer
active_timeslot:
description: the active time slot in execution
type: object
properties:
timeslot_id:
type: integer
weekday:
$ref: './Weekday.yaml'
required:
- timeslot_id
- weekday
state:
description: the current state of the smart scene. The default state is inactive if no recall is provided
type: string
enum:
- active
- inactive
required:
- type
- metadata
- week_timeslots
- transition_duration
- state
14 changes: 14 additions & 0 deletions src/smart_scene/schemas/SmartSceneMetadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
type: object
properties:
name:
type: string
minLength: 1
maxLength: 32
description: Human readable name of a resource
image:
$ref: '../../common/ResourceIdentifier.yaml'
appdata:
type: string
minLength: 1
maxLength: 16
description: Application specific data. Free format string.
24 changes: 24 additions & 0 deletions src/smart_scene/schemas/SmartScenePost.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
type: object
properties:
type:
type: string
enum:
- smart_scene
metadata:
$ref: './SmartSceneMetadata.yaml'
group:
$ref: '../../common/ResourceIdentifier.yaml'
week_timeslots:
description: information on what is the light state for every timeslot of the day
type: array
items:
$ref: './DayTimeslotsGet.yaml'
transition_duration:
description: duration of the transition from on one timeslot's scene to the other (defaults to 60000ms)
type: integer
recall:
$ref: './SmartSceneRecall.yaml'
required:
- metadata
- group
- week_timeslots
20 changes: 20 additions & 0 deletions src/smart_scene/schemas/SmartScenePut.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
type: object
properties:
type:
type: string
enum:
- smart_scene
metadata:
$ref: './SmartSceneMetadata.yaml'
group:
$ref: '../../common/ResourceIdentifier.yaml'
week_timeslots:
description: information on what is the light state for every timeslot of the day
type: array
items:
$ref: './DayTimeslotsGet.yaml'
transition_duration:
description: duration of the transition from on one timeslot's scene to the other (defaults to 60000ms)
type: integer
recall:
$ref: './SmartSceneRecall.yaml'
8 changes: 8 additions & 0 deletions src/smart_scene/schemas/SmartSceneRecall.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
type: object
properties:
action:
type: string
description: Activate will start the smart (24h) scene; deactivate will stop it
enum:
- activate
- deactivate
33 changes: 33 additions & 0 deletions src/smart_scene/schemas/SmartSceneTimeslotGet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
type: object
properties:
start_time:
type: object
properties:
kind:
type: string
enum:
- time
- sunset
time:
type: object
description: this property is only used when property “kind” is “time”
properties:
hour:
type: integer
minimum: 0
maximum: 23
minute:
type: integer
minimum: 0
maximum: 59
second:
type: integer
minimum: 0
maximum: 59
required:
- kind
target:
$ref: '../../common/ResourceIdentifier.yaml'
required:
- start_time
- target
9 changes: 9 additions & 0 deletions src/smart_scene/schemas/Weekday.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
type: string
enum:
- monday
- tuesday
- wednesday
- thursday
- friday
- saturday
- sunday
89 changes: 89 additions & 0 deletions src/smart_scene/smart_scene.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
get:
operationId: getSmartScenes
summary: List smart scenes
description: List all available smart scenes
tags:
- Smart Scene
security:
- HueApplicationKey: [ ]
responses:
'200':
description: Smart Scene Success Response
content:
application/json:
schema:
allOf:
- $ref: '../common/ApiResponse.yaml'
- type: object
properties:
data:
type: array
items:
$ref: './schemas/SmartSceneGet.yaml'
401:
$ref: '../common/error.yaml#/components/responses/Unauthorized'
403:
$ref: '../common/error.yaml#/components/responses/Forbidden'
404:
$ref: '../common/error.yaml#/components/responses/NotFound'
405:
$ref: '../common/error.yaml#/components/responses/MethodNotAllowed'
406:
$ref: '../common/error.yaml#/components/responses/NotAcceptable'
409:
$ref: '../common/error.yaml#/components/responses/Conflict'
429:
$ref: '../common/error.yaml#/components/responses/TooManyRequests'
500:
$ref: '../common/error.yaml#/components/responses/InternalServerError'
503:
$ref: '../common/error.yaml#/components/responses/ServiceUnavailable'
507:
$ref: '../common/error.yaml#/components/responses/InsufficientStorage'
post:
operationId: createSmartScene
summary: Create a new smart scene
description: Creates a new smart scene
tags:
- Smart Scene
security:
- HueApplicationKey: [ ]
requestBody:
content:
application/json:
schema:
$ref: './schemas/SmartScenePost.yaml'
responses:
'200':
description: Success
content:
application/json:
schema:
allOf:
- $ref: '../common/ApiResponse.yaml'
- type: object
properties:
data:
type: array
items:
$ref: '../common/ResourceIdentifier.yaml'
401:
$ref: '../common/error.yaml#/components/responses/Unauthorized'
403:
$ref: '../common/error.yaml#/components/responses/Forbidden'
404:
$ref: '../common/error.yaml#/components/responses/NotFound'
405:
$ref: '../common/error.yaml#/components/responses/MethodNotAllowed'
406:
$ref: '../common/error.yaml#/components/responses/NotAcceptable'
409:
$ref: '../common/error.yaml#/components/responses/Conflict'
429:
$ref: '../common/error.yaml#/components/responses/TooManyRequests'
500:
$ref: '../common/error.yaml#/components/responses/InternalServerError'
503:
$ref: '../common/error.yaml#/components/responses/ServiceUnavailable'
507:
$ref: '../common/error.yaml#/components/responses/InsufficientStorage'
Loading

0 comments on commit 0ec3d87

Please sign in to comment.