device

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DDebug

func DDebug(device *Device) *zerolog.Event

func DError

func DError(device *Device) *zerolog.Event

func DInfo

func DInfo(device *Device) *zerolog.Event

Types

type Actor

type Actor string
const (
	AlarmActor             Actor = "alarm"
	StateActor             Actor = "state"
	NotificationShortActor Actor = "notification-short"
	NotificationLongActor  Actor = "notification-long"
)

type AlarmActorPayload

type AlarmActorPayload struct {
	Alarm alarm.Type
}

type ArmingSensorValue

type ArmingSensorValue struct {
	ArmMode arm.Mode
}

type BatteryLevelSensorValue

type BatteryLevelSensorValue struct {
	BatteryLevel float32
}

type BatteryWarningSensorValue

type BatteryWarningSensorValue struct {
	BatteryWarning bool
}

type ContactSensorValue

type ContactSensorValue struct {
	Contact bool
}

type Device

type Device struct {
	Id     Id             `json:"id"`
	Zone   zone.Id        `json:"zone"`
	Active bool           `json:"-"`
	Spec   Spec           `json:"-"`
	State  map[Sensor]any `json:"-"`
}

func DeviceFromConfig

func DeviceFromConfig(config config.DeviceConfig) Device

type DisarmingSensorValue

type DisarmingSensorValue struct {
	Pin string
}

type Id

type Id string

func NewId

func NewId(prefix string, entity string) Id

func (Id) Entity

func (d Id) Entity() string

func (Id) Prefix

func (d Id) Prefix() string

type LinkQualitySensorValue

type LinkQualitySensorValue struct {
	LinkQuality float32
}

type MotionSensorValue

type MotionSensorValue struct {
	Motion bool
}

type PanicSensorValue

type PanicSensorValue struct {
	Panic bool
}

type Sensor

type Sensor string
const (
	MotionSensor         Sensor = "motion"
	ContactSensor        Sensor = "contact"
	SmokeSensor          Sensor = "smoke"
	PanicSensor          Sensor = "panic"
	BatteryWarningSensor Sensor = "battery-warning"
	TamperSensor         Sensor = "tamper"
	BatteryLevelSensor   Sensor = "battery-level"
	LinkQualitySensor    Sensor = "link-quality"
	ArmingSensor         Sensor = "arming"
	DisarmingSensor      Sensor = "disarming"
)

type SmokeSensorValue

type SmokeSensorValue struct {
	Smoke bool
}

type Spec

type Spec struct {
	Id          Id
	DisplayName string
	Vendor      string
	Model       string
	Description string
	Sensors     []Sensor
	Actors      []Actor
}

func (Spec) HumanReadableName

func (s Spec) HumanReadableName() string

func (Spec) IsRelevant

func (s Spec) IsRelevant() bool

type StateActorPayload

type StateActorPayload struct {
	ArmMode arm.Mode
	Alarm   alarm.Type
}

type TamperSensorValues

type TamperSensorValues struct {
	Tamper bool
}

Jump to

Keyboard shortcuts

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