server

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPServer

func NewHTTPServer(subset *Subset) *gin.Engine

NewHTTPServer - Start HTTP Server @title Dash-Home API @version 1.0 @name Dash-Home @license.name MIT License @license.url https://opensource.org/licenses/MIT

Types

type CreateRoomRequest

type CreateRoomRequest struct {
	Name string `json:"name" example:"john's room"`
}

CreateRoomRequest - Create Room Request

type GetRemotesResponse

type GetRemotesResponse struct {
	Aircon map[string][]string `json:"aircon"`
	Light  map[string][]string `json:"light"`
}

type PostSwitchBotRequest

type PostSwitchBotRequest struct {
	Command string `json:"command" validate:"required" example:"ON"`
}

PostSwitchBotRequest - post switchbot payload...

type RemoteController

type RemoteController struct {
	Vendor string `json:"vendor" validate:"required" example:"daikin"`
	Model  string `json:"model" validate:"required" example:"daikin01"`
}

RemoteController - as IR remote controller

type SetControllerRequest

type SetControllerRequest struct {
	// Name - ex. Bedroom Airconditioner
	Name string `json:"name" validate:"required" example:"Bedroom Airconditioner"`

	// AgentID - Agent ID (optional)
	AgentID string `json:"agent_id,omitempty" example:"<AGENT_ID>"`

	// Kind - AIRCON, LIGHT, SWITCHBOT...
	Kind string `json:"kind" validate:"required" example:"AIRCON"`

	// Type - type of controller (how to use?) / ex. REMOTE, SWITCHBOT...
	Type string `json:"type" validate:"required" example:"REMOTE"`

	// Remote - Remote Controller settings (required when type is REMOTE)
	Remote *RemoteController `json:"remote,omitempty"`

	// SwitchBot - SwitchBot settings (required when type is SWITCHBOT)
	SwitchBot *SwitchBotController `json:"switchbot,omitempty"`
}

SetControllerRequest - Create / Update controller request

type Subset

type Subset struct {
	Agent      *agent.AgentService
	Room       *room.RoomService
	Controller *controller.Controller
}

Subset - HTTP Subset

type SwitchBotController

type SwitchBotController struct {
	Mac  string `json:"mac" validate:"required" example:"FF:FF:FF:FF:FF:FF"`
	Type string `json:"type" validate:"required" example:"TOGGLE"`
}

SwitchBotController - as SwitchBot controller

type UpdateAgentRequest

type UpdateAgentRequest struct {
	// Address of Pigent
	Address string `json:"address" validate:"required" example:"localhost:8081"`

	// Default - Agent to use by mainly
	Default bool `json:"default,omitempty"`

	// Label - Agent label (optional)
	Label string `json:"label" example:"Bedroom"`
}

UpdateAgentRequest - Update Agent Request

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL