update more stuff

This commit is contained in:
Mats Tornberg
2025-11-22 16:22:42 +00:00
parent 790b174a9e
commit 0596fe60fa
10 changed files with 1230 additions and 717 deletions

53
datastore/types.go Normal file
View File

@@ -0,0 +1,53 @@
package datastore
import "time"
// Device represents a Telldus device
type Device struct {
ID int `json:"id"`
Name string `json:"name"`
UniqueID string `json:"unique_id"`
}
// Sensor represents a Telldus sensor
type Sensor struct {
SensorID int `json:"sensor_id"`
Protocol string `json:"protocol"`
Model string `json:"model"`
ID int `json:"id"`
Name string `json:"name"`
TemperatureUniqueID string `json:"temperature_unique_id"`
HumidityUniqueID string `json:"humidity_unique_id"`
LastTemperature string `json:"last_temperature,omitempty"`
LastHumidity string `json:"last_humidity,omitempty"`
LastTimestamp int64 `json:"last_timestamp,omitempty"`
Hidden bool `json:"hidden"`
}
// PotentialDevice represents a detected but not yet configured device
type PotentialDevice struct {
ID int `json:"id"`
Class string `json:"class"`
Protocol string `json:"protocol"`
Model string `json:"model"`
DeviceID string `json:"device_id"`
LastData string `json:"last_data"`
LastSeen int64 `json:"last_seen"`
}
// RawEvent represents a raw device event
type RawEvent struct {
Timestamp time.Time `json:"timestamp"`
ControllerID int `json:"controller_id"`
Data string `json:"data"`
}
// SensorEvent represents a sensor data event
type SensorEvent struct {
Timestamp time.Time `json:"timestamp"`
Protocol string `json:"protocol"`
Model string `json:"model"`
ID int `json:"id"`
DataType int `json:"data_type"`
Value string `json:"value"`
}