Documentation ¶
Index ¶
- Constants
- func Contains(s []string, str string) bool
- func GetConcreteKey(dbKey []byte) string
- func InitConfig()
- func NewApiKeyConfig(database Operable) *apiKeyConfig
- func NewHttpClient() *httpClient
- func Parallelize(functions ...func())
- func RunNewPoller(timeInterval time.Duration, function func()) *poller
- func Serve(repo SensorRepository) error
- func Trace(resp *resty.Response, err error)
- type APIKey
- type Configuration
- type Gateway
- type InputSensor
- type InputSensors
- type Operable
- type OutputSensors
- type PhosconSensor
- type SensorEvent
- type SensorRepository
Constants ¶
View Source
const ( PhosconUrl = "https://phoscon.de/discover" DatabasePath = "./goconz-sensors" DelayInSecond = 30 TraceHttp = true HttpPort = ":9000" ConfigFileName = "./go-conz-config" PathToConfigFile = "." EnvPrefix = "GOCONZ" ReadOnly = false )
View Source
const ( SensorsUrl = "http://%s:%d/api/%s/sensors" ApiKeyUrl = "http://%s:%d/api" )
View Source
const ( DbApiKey = "apiKey" CountRetry = 10 )
View Source
const ( PressureType = "ZHAPressure" TemperatureType = "ZHATemperature" HumidityType = "ZHAHumidity" )
Variables ¶
This section is empty.
Functions ¶
func GetConcreteKey ¶
GetConcreteKey TODO voir si on peu virer ca pour rester encapsulé
func InitConfig ¶
func InitConfig()
func NewApiKeyConfig ¶
func NewApiKeyConfig(database Operable) *apiKeyConfig
func NewHttpClient ¶
func NewHttpClient() *httpClient
func RunNewPoller ¶
RunNewPoller Run a new Poller around a lambda function, that tick every time.Duration
func Serve ¶
func Serve(repo SensorRepository) error
Types ¶
type APIKey ¶
type APIKey struct { Success struct { Username string `json:"username"` } `json:"success"` }
type Configuration ¶
type Configuration struct { ApiKey string PhosconUrl string DatabasePath string DelayInSecond time.Duration TraceHttp bool HttpPort string ReadOnly bool }
var Config *Configuration
type InputSensor ¶
type InputSensors ¶
type InputSensors struct { Etag string Sensors []*InputSensor }
func GetInputSensors ¶
func GetInputSensors(parsedSensors map[string]interface{}) ([]*InputSensors, error)
GetInputSensors TODO peut être simplifié ?
type Operable ¶
type OutputSensors ¶
type OutputSensors struct { Uniqueid string `json:"uniqueId"` Name string `json:"name"` Type string `json:"type"` Events []*SensorEvent `json:"events"` }
func GetOutputSensors ¶
func GetOutputSensors(listSensorsList []*InputSensors) []*OutputSensors
GetOutputSensors TODO peut être simplifié ?
type PhosconSensor ¶
type PhosconSensor struct { Config struct { On bool Battery int Reachable bool } Ep int Etag string Lastseen string Manufacturername string Modelid string Name string State struct { Lastupdated string Temperature int Humidity int Pressure int } Swversion string Type string Uniqueid string }
func (*PhosconSensor) IsSensor ¶
func (sensor *PhosconSensor) IsSensor() bool
func (*PhosconSensor) ToInputSensor ¶
func (sensor *PhosconSensor) ToInputSensor() *InputSensor
type SensorEvent ¶
type SensorRepository ¶
type SensorRepository interface { GetAll() ([]*InputSensors, error) SaveAll([]*InputSensors) error Save(sensor *InputSensors) error }
func NewSensorRepository ¶
func NewSensorRepository(operation Operable) SensorRepository
Click to show internal directories.
Click to hide internal directories.