diff --git a/src/main.yaml b/src/main.yaml index 95599f7..f71a7b1 100644 --- a/src/main.yaml +++ b/src/main.yaml @@ -30,6 +30,8 @@ tags: description: API to manage rooms. Rooms group devices and each device can only be part of one room. - name: Zone description: API to manage zones. Zones group services and each service can be part of multiple zones. + - name: Temperature + description: API to manage temperature services. These are offered by devices with temperature sensing capabilities. paths: # Authentication /api: @@ -77,6 +79,11 @@ paths: $ref: './zone/zone.yaml' /clip/v2/resource/zone/{zoneId}: $ref: './zone/zone_{zoneId}.yaml' +# Temperature + /clip/v2/resource/temperature: + $ref: './temperature/temperature.yaml' + /clip/v2/resource/temperature/{temperatureId}: + $ref: './temperature/temperature_{temperatureId}.yaml' components: securitySchemes: HueApplicationKey: diff --git a/src/temperature/schemas/TemperatureGet.yaml b/src/temperature/schemas/TemperatureGet.yaml new file mode 100644 index 0000000..c24a5a7 --- /dev/null +++ b/src/temperature/schemas/TemperatureGet.yaml @@ -0,0 +1,30 @@ +type: object +allOf: + - $ref: '../../common/ResourceOwned.yaml' + - type: object + properties: + enabled: + type: boolean + description: | + `true` when sensor is activated, `false` when deactivated + temperature: + type: object + properties: + temperature: + type: number + description: Deprecated. Moved to Temperature_report/temperature + example: 23 + temperature_valid: + type: boolean + description: Deprecated. Indication whether the value presented in temperature is valid + temperature_report: + type: object + properties: + changed: + type: string + format: date-time + description: last time the value of this property is changed. + temperature: + type: number + description: Temperature in 1.00 degrees Celsius + example: 23 diff --git a/src/temperature/schemas/TemperaturePut.yaml b/src/temperature/schemas/TemperaturePut.yaml new file mode 100644 index 0000000..38aa232 --- /dev/null +++ b/src/temperature/schemas/TemperaturePut.yaml @@ -0,0 +1,10 @@ +type: object +properties: + type: + type: string + description: Type of the supported resources (always `temperature` here) + enum: + - temperature + enabled: + type: boolean + description: true when sensor is activated, false when deactivated diff --git a/src/temperature/temperature.yaml b/src/temperature/temperature.yaml new file mode 100644 index 0000000..f31507a --- /dev/null +++ b/src/temperature/temperature.yaml @@ -0,0 +1,42 @@ +get: + operationId: getTemperatures + summary: List temperatures + description: List all temperatures + tags: + - Temperature + security: + - HueApplicationKey: [ ] + responses: + 200: + description: Temperature Success Response + content: + application/json: + schema: + allOf: + - $ref: '../common/ApiResponse.yaml' + - type: object + properties: + data: + type: array + items: + $ref: './schemas/TemperatureGet.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' diff --git a/src/temperature/temperature_{temperatureId}.yaml b/src/temperature/temperature_{temperatureId}.yaml new file mode 100644 index 0000000..c6a6e1d --- /dev/null +++ b/src/temperature/temperature_{temperatureId}.yaml @@ -0,0 +1,112 @@ +get: + operationId: getTemperature + summary: Get temperature sensor information + description: Get details of a single temperature sensor from its given `{temperatureId}`. + tags: + - Temperature + security: + - HueApplicationKey: [ ] + parameters: + - name: temperatureId + in: path + schema: + type: string + required: true + description: ID of the temperature sensor + responses: + 200: + description: Temperature Success Response + content: + application/json: + schema: + allOf: + - $ref: '../common/ApiResponse.yaml' + - type: object + properties: + data: + type: array + items: + $ref: './schemas/TemperatureGet.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' +put: + operationId: updateTemperature + summary: Update temperature sensor + description: Update a temperature sensor from its given `{temperatureId}`. + tags: + - Temperature + security: + - HueApplicationKey: [ ] + parameters: + - name: temperatureId + in: path + schema: + type: string + required: true + description: ID of the temperature sensor + requestBody: + content: + application/json: + examples: + Enable: + summary: Enable temperature sensor + value: + enabled: true + Disable: + summary: Disable temperature sensor + value: + enabled: false + schema: + $ref: './schemas/TemperaturePut.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'