Categorygithub.com/tommzn/hdb-api
modulepackage
1.1.26
Repository: https://github.com/tommzn/hdb-api.git
Documentation: pkg.go.dev

# README

GitHub go.mod Go version Actions Status

HomeDashboard API

External services can use this API to publish HomeDashboard data.

Supported Datasources

  • IndoorClimate

API Description

openapi: 3.0.0
info:
  version: 1.0.0
  title: HomeDashboard API
  description: Provides endpoints for external services to publish events with HomeDashboard data.
  license:
    name: MIT

paths:
  //api/v1/indoorclimate:
    post: 
      summary: Publish new indoor climate data.
      requestBody:
        required: true
        content:
          application/json:
            schema: 
              $ref: '#/components/schemas/IndoorClimateData'
      responses:
        '204':
          description: An event has been published.
        '400':
          description: Invalid indoor climate data passed.
        '500':
          description: Unable to publish event.
    
  /health:
    get: 
      summary: Health status check endpoint.
      responses:
        '204':
          description: Server is still healty.

components:
  schemas:
    IndoorClimateData:
      type: object
      required:
        - deviceid
        - measurementtype
        - value
      properties:
        timestamp:
          description: Timestamp for indoor climate measurement. RFC3339
          type: string
        deviceid:
          description: ID of a device.
          type: string
        measurementtype:
          description: Type of an indoor climate measurement.
          type: string
          enum:
            - temperature
            - humidity
            - battery
        value:
          description: Measurement value.
          type: string

Links

# Constants

UNIT_CELSIUS, temperature in Celsius.
UNIT_FAHRENHEIT, temperature in Fahrenheit.
UNIT_PERCENT, measurement in percent, e.g.

# Structs

ClimateData contains temperate, humidity and battery level measured by a device.
HealthRequestHandler to handle health requests.
InddorClimateData contains a single indoor climate measurement.
IndoorClimateRequestHandler to handle all indoor climate requests.
Measurement, a single value with a unit.

# Interfaces

DataSource is used to obtain events from different sources.
RequestHandler is a generic interface for each kind of requests.

# Type aliases

MeasurementUnit e.g.