WIP
This commit is contained in:
@ -5,12 +5,18 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
stypes "git.cryptic.systems/fh-trier/go-flucky-server/pkg/types"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
DeviceID string `json:"device_id"`
|
||||
Remotes []*Remote `json:"remotes"`
|
||||
TemperatureSensors []*WireSensor `json:"temperature_sensors"`
|
||||
DeviceID string `json:"device_id"`
|
||||
DeviceName string `json:"device_name"`
|
||||
DeviceLocation string `json:"device_location"`
|
||||
TemperatureLogfile string `json:"temperature_logfile"`
|
||||
HumidityLogfile string `json:"humiditiy_logfile"`
|
||||
Remotes []*Remote `json:"remotes"`
|
||||
Sensors []*Sensor `json:"sensors"`
|
||||
}
|
||||
|
||||
func (c *Config) ToJSON() (string, error) {
|
||||
@ -43,23 +49,15 @@ func (c *Config) JSONDecoder(r io.Reader) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Remote ...
|
||||
type Remote struct {
|
||||
Name string `json:"remote_name"`
|
||||
Address string `json:"remote_address"`
|
||||
Registered bool `json:"remote_registered"`
|
||||
Enabled bool `json:"remote_enabled"`
|
||||
}
|
||||
|
||||
type WireSensor struct {
|
||||
ID string `json:"sensor_id"`
|
||||
Name string `json:"sensor_name"`
|
||||
Typ SensorType `json:"sensor_typ"`
|
||||
GPIO int `json:"gpio_number"`
|
||||
WirePath string `json:"wire_path"`
|
||||
type Sensor struct {
|
||||
RemoteSensor *stypes.Sensor `json:"sensor"`
|
||||
Enabled bool `json:"sensor_enabled"`
|
||||
}
|
||||
|
||||
type SensorType string
|
||||
|
||||
const (
|
||||
SENSOR_DS18B20 SensorType = "DS18B20"
|
||||
SENSOR_DHT11 = "DHT11"
|
||||
)
|
||||
|
Reference in New Issue
Block a user