iot

package
v0.0.0-...-ffc6c44 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const SmartHomeIdFormat = "%013d"

Variables

View Source
var (
	DoorByteString = []byte("door_state") // heap optimization
	DoorTagKey     = []byte("door_id")
)
View Source
var (
	RadiatorValveRoomByteString = []byte("radiator_valve_room") // heap optimization
	RadiatorTagKey              = []byte("radiator")
)
View Source
var (
	// The duration of a log epoch.
	EpochDuration = 60 * time.Second

	// Tag fields common to all inside sensors:
	RoomTagKey = []byte("room_id")

	// Tag fields common to all inside sensors:
	SensorHomeTagKeys = [][]byte{
		[]byte("sensor_id"),
		[]byte("home_id"),
	}
)
View Source
var (
	WindowByteString = []byte("window_state_room") // heap optimization
	WindowTagKey     = []byte("window_id")
)
View Source
var (
	AirConditionOutdoorByteString = []byte("air_condition_outdoor") // heap optimization
)
View Source
var (
	// Field keys for 'air condition indoor' points.
	AirConditionOutdoorFieldKeys = [][]byte{
		[]byte("temperature"),
		[]byte("humidity"),
		[]byte("battery_voltage"),
	}
)
View Source
var (
	AirConditionRoomByteString = []byte("air_condition_room") // heap optimization
)
View Source
var (
	// Field keys for 'air condition indoor' points.
	AirConditionRoomFieldKeys = [][]byte{
		[]byte("temperature"),
		[]byte("humidity"),
		[]byte("battery_voltage"),
	}
)
View Source
var (
	AirQualityRoomByteString = []byte("air_quality_room") // heap optimization
)
View Source
var (
	// Field keys for 'air quality indoor' points.
	AirQualityRoomFieldKeys = [][]byte{
		[]byte("co2_level"),
		[]byte("co_level"),
		[]byte("battery_voltage"),
	}
)
View Source
var Animals = [][]byte{
	[]byte("cat"),
	[]byte("dog"),
	[]byte("bird"),
	[]byte("unknown"),
}
View Source
var (
	CameraDetectionByteString = []byte("camera_detection") // heap optimization
)
View Source
var (
	// Field keys for 'air condition indoor' points.
	CameraDetectionFieldKeys = [][]byte{
		[]byte("object_type"),
		[]byte("object_kind"),
		[]byte("battery_voltage"),
	}
)
View Source
var DetectionObjects = [][]byte{
	[]byte("animal"),
	[]byte("human"),
	[]byte("vehicle"),
	[]byte("unknown"),
}
View Source
var (
	// Field keys for 'air condition indoor' points.
	DoorFieldKeys = [][]byte{
		[]byte("state"),
		[]byte("battery_voltage"),
	}
)
View Source
var (
	HomeConfigByteString = []byte("home_config") // heap optimization
)
View Source
var (
	// Field keys for 'air condition indoor' points.
	HomeConfigFieldKeys = [][]byte{
		[]byte("config_string"),
	}
)
View Source
var (
	HomeStateByteString = []byte("home_state") // heap optimization
)
View Source
var (
	// Field keys for 'air condition indoor' points.
	HomeStateFieldKeys = [][]byte{
		[]byte("state"),
		[]byte("state_string"),
	}
)
View Source
var HomeStates = [][]byte{
	[]byte("Empty"),
	[]byte("Half"),
	[]byte("Full"),
}
View Source
var Humans = [][]byte{
	[]byte("man"),
	[]byte("woman"),
	[]byte("child"),
	[]byte("unknown"),
}
View Source
var LastSensorId = 0
View Source
var (
	LightLevelRoomByteString = []byte("light_level_room") // heap optimization
)
View Source
var (
	// Field keys for 'air quality indoor' points.
	LightLevelRoomFieldKeys = [][]byte{
		[]byte("level"),
		[]byte("battery_voltage"),
	}
)
View Source
var (
	// Field keys for 'air quality indoor' points.
	RadiatorValveRoomFieldKeys = [][]byte{
		[]byte("opening_level"),
		[]byte("battery_voltage"),
	}
)
View Source
var Vehicles = [][]byte{
	[]byte("car"),
	[]byte("lorry"),
	[]byte("truck"),
	[]byte("motorcycle"),
	[]byte("bicycle"),
	[]byte("unknown"),
}
View Source
var (
	WaterLeakageRoomByteString = []byte("water_leakage_room") // heap optimization
)
View Source
var (
	// Field keys for 'air condition indoor' points.
	WaterLeakageRoomFieldKeys = [][]byte{
		[]byte("leakage"),
		[]byte("battery_voltage"),
	}
)
View Source
var (
	WaterLevelByteString = []byte("water_level") // heap optimization
)
View Source
var (
	// Field keys for 'air quality indoor' points.
	WaterLevelFieldKeys = [][]byte{
		[]byte("level"),
		[]byte("battery_voltage"),
	}
)
View Source
var (
	WeatherOutdoorByteString = []byte("weather_outdoor") // heap optimization
)
View Source
var (
	// Field keys for 'air condition indoor' points.
	WeatherOutdoorFieldKeys = [][]byte{
		[]byte("pressure"),
		[]byte("wind_speed"),
		[]byte("wind_direction"),
		[]byte("precipitation"),
		[]byte("battery_voltage"),
	}
)
View Source
var (
	// Field keys for 'air condition indoor' points.
	WindowFieldKeys = [][]byte{
		[]byte("state"),
		[]byte("battery_voltage"),
	}
)

Functions

func NewSensorId

func NewSensorId() []byte

Types

type AirConditionOutdoorMeasurement

type AirConditionOutdoorMeasurement struct {
	// contains filtered or unexported fields
}

func NewAirConditionOutdoorMeasurement

func NewAirConditionOutdoorMeasurement(start time.Time, id []byte) *AirConditionOutdoorMeasurement

func (*AirConditionOutdoorMeasurement) Tick

func (*AirConditionOutdoorMeasurement) ToPoint

func (m *AirConditionOutdoorMeasurement) ToPoint(p *Point) bool

type AirConditionRoomMeasurement

type AirConditionRoomMeasurement struct {
	// contains filtered or unexported fields
}

func NewAirConditionRoomMeasurement

func NewAirConditionRoomMeasurement(start time.Time, id []byte) *AirConditionRoomMeasurement

func (*AirConditionRoomMeasurement) Tick

func (*AirConditionRoomMeasurement) ToPoint

func (m *AirConditionRoomMeasurement) ToPoint(p *Point) bool

type AirQualityRoomMeasurement

type AirQualityRoomMeasurement struct {
	// contains filtered or unexported fields
}

func NewAirQualityRoomMeasurement

func NewAirQualityRoomMeasurement(start time.Time, id []byte) *AirQualityRoomMeasurement

func (*AirQualityRoomMeasurement) Tick

func (*AirQualityRoomMeasurement) ToPoint

func (m *AirQualityRoomMeasurement) ToPoint(p *Point) bool

type CameraDetectionMeasurement

type CameraDetectionMeasurement struct {
	// contains filtered or unexported fields
}

func NewCameraDetectionMeasurement

func NewCameraDetectionMeasurement(start time.Time, id []byte) *CameraDetectionMeasurement

func (*CameraDetectionMeasurement) Tick

func (*CameraDetectionMeasurement) ToPoint

func (m *CameraDetectionMeasurement) ToPoint(p *Point) bool

type DoorMeasurement

type DoorMeasurement struct {
	// contains filtered or unexported fields
}

func NewDoorMeasurement

func NewDoorMeasurement(start time.Time, doorId []byte, sendorId []byte) *DoorMeasurement

func (*DoorMeasurement) Tick

func (m *DoorMeasurement) Tick(d time.Duration)

func (*DoorMeasurement) ToPoint

func (m *DoorMeasurement) ToPoint(p *Point) bool

type HomeConfigMeasurement

type HomeConfigMeasurement struct {
	// contains filtered or unexported fields
}

func NewHomeConfigMeasurement

func NewHomeConfigMeasurement(start time.Time, id []byte) *HomeConfigMeasurement

func (*HomeConfigMeasurement) Tick

func (m *HomeConfigMeasurement) Tick(d time.Duration)

func (*HomeConfigMeasurement) ToPoint

func (m *HomeConfigMeasurement) ToPoint(p *Point) bool

type HomeStateMeasurement

type HomeStateMeasurement struct {
	// contains filtered or unexported fields
}

func NewHomeStateMeasurement

func NewHomeStateMeasurement(start time.Time, id []byte) *HomeStateMeasurement

func (*HomeStateMeasurement) Tick

func (m *HomeStateMeasurement) Tick(d time.Duration)

func (*HomeStateMeasurement) ToPoint

func (m *HomeStateMeasurement) ToPoint(p *Point) bool

type IotSimulator

type IotSimulator struct {
	// contains filtered or unexported fields
}

A IotSimulator generates data similar to telemetry from Telegraf. It fulfills the Simulator interface.

func (*IotSimulator) Finished

func (g *IotSimulator) Finished() bool

func (*IotSimulator) Next

func (g *IotSimulator) Next(p *Point)

Next advances a Point to the next state in the generator.

func (*IotSimulator) SeenPoints

func (g *IotSimulator) SeenPoints() int64

func (*IotSimulator) SeenValues

func (g *IotSimulator) SeenValues() int64

func (*IotSimulator) Total

func (g *IotSimulator) Total() int64

type IotSimulatorConfig

type IotSimulatorConfig struct {
	Start time.Time
	End   time.Time

	SmartHomeCount  int64
	SmartHomeOffset int64
}

Type IotSimulatorConfig is used to create a IotSimulator.

func (*IotSimulatorConfig) ToSimulator

func (d *IotSimulatorConfig) ToSimulator() *IotSimulator

type LightLevelRoomMeasurement

type LightLevelRoomMeasurement struct {
	// contains filtered or unexported fields
}

func NewLightLevelRoomMeasurement

func NewLightLevelRoomMeasurement(start time.Time, id []byte) *LightLevelRoomMeasurement

func (*LightLevelRoomMeasurement) Tick

func (*LightLevelRoomMeasurement) ToPoint

func (m *LightLevelRoomMeasurement) ToPoint(p *Point) bool

type RadiatorValveRoomMeasurement

type RadiatorValveRoomMeasurement struct {
	// contains filtered or unexported fields
}

func NewRadiatorValveRoomMeasurement

func NewRadiatorValveRoomMeasurement(start time.Time, randiatorId []byte, sensorId []byte) *RadiatorValveRoomMeasurement

func (*RadiatorValveRoomMeasurement) Tick

func (*RadiatorValveRoomMeasurement) ToPoint

func (m *RadiatorValveRoomMeasurement) ToPoint(p *Point) bool

type SmartHome

type SmartHome struct {
	// These are all assigned once, at Host creation:
	SimulatedMeasurements []SimulatedMeasurement
	Rooms                 []*room
	HomeId                []byte
	// contains filtered or unexported fields
}

Type Host models a machine being monitored by Telegraf.

func NewSmartHome

func NewSmartHome(id int, offset int, start time.Time) *SmartHome

func (*SmartHome) HasMoreMeasurements

func (h *SmartHome) HasMoreMeasurements() bool

func (*SmartHome) NewRoom

func (h *SmartHome) NewRoom(id int, start time.Time) *room

func (*SmartHome) NewSmartHomeMeasurements

func (h *SmartHome) NewSmartHomeMeasurements(start time.Time)

func (*SmartHome) NextMeasurement

func (h *SmartHome) NextMeasurement(p *Point) SimulatedMeasurement

func (*SmartHome) NumMeasurements

func (h *SmartHome) NumMeasurements() int

func (*SmartHome) ResetMeasurementCounter

func (h *SmartHome) ResetMeasurementCounter()

func (*SmartHome) TickAll

func (h *SmartHome) TickAll(d time.Duration)

TickAll advances all Distributions of a Host.

type WaterLeakageRoomMeasurement

type WaterLeakageRoomMeasurement struct {
	// contains filtered or unexported fields
}

func NewWaterLeakageRoomMeasurement

func NewWaterLeakageRoomMeasurement(start time.Time, roomId []byte, sensorId []byte) *WaterLeakageRoomMeasurement

func (*WaterLeakageRoomMeasurement) Tick

func (*WaterLeakageRoomMeasurement) ToPoint

func (m *WaterLeakageRoomMeasurement) ToPoint(p *Point) bool

type WaterLevelMeasurement

type WaterLevelMeasurement struct {
	// contains filtered or unexported fields
}

func NewWaterLevelMeasurement

func NewWaterLevelMeasurement(start time.Time, id []byte) *WaterLevelMeasurement

func (*WaterLevelMeasurement) Tick

func (m *WaterLevelMeasurement) Tick(d time.Duration)

func (*WaterLevelMeasurement) ToPoint

func (m *WaterLevelMeasurement) ToPoint(p *Point) bool

type WeatherOutdoorMeasurement

type WeatherOutdoorMeasurement struct {
	// contains filtered or unexported fields
}

func NewWeatherOutdoorMeasurement

func NewWeatherOutdoorMeasurement(start time.Time, id []byte) *WeatherOutdoorMeasurement

func (*WeatherOutdoorMeasurement) Tick

func (*WeatherOutdoorMeasurement) ToPoint

func (m *WeatherOutdoorMeasurement) ToPoint(p *Point) bool

type WindowMeasurement

type WindowMeasurement struct {
	// contains filtered or unexported fields
}

func NewWindowMeasurement

func NewWindowMeasurement(start time.Time, windowId []byte, sensorId []byte) *WindowMeasurement

func (*WindowMeasurement) Tick

func (m *WindowMeasurement) Tick(d time.Duration)

func (*WindowMeasurement) ToPoint

func (m *WindowMeasurement) ToPoint(p *Point) bool

Jump to

Keyboard shortcuts

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