models

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: GPL-3.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// MessageStatusNew ...
	MessageStatusNew = MessageStatus("new")
	// MessageStatusInProgress ...
	MessageStatusInProgress = MessageStatus("in_progress")
	// MessageStatusSucceed ...
	MessageStatusSucceed = MessageStatus("succeed")
	// MessageStatusError ...
	MessageStatusError = MessageStatus("error")
)
View Source
const (
	// TemplateStatusActive ...
	TemplateStatusActive = TemplateStatus("active")
	// TemplateStatusUnactive ...
	TemplateStatusUnactive = TemplateStatus("inactive")
	// TemplateTypeItem ...
	TemplateTypeItem = TemplateType("item")
	// TemplateTypeTemplate ...
	TemplateTypeTemplate = TemplateType("template")
)
View Source
const HistoryMax = 8

HistoryMax ...

Variables

This section is empty.

Functions

func NewAttributes

func NewAttributes() map[string]*Attribute

func PreviewTemplate

func PreviewTemplate(items []*Template, template *TemplateContent) (data string, err error)

PreviewTemplate ...

func TemplateGetParents

func TemplateGetParents(items Templates, result *Templates, s string)

TemplateGetParents ...

Types

type Action

type Action struct {
	Id               int64            `json:"id"`
	Name             string           `json:"name" validate:"required,lte=255"`
	Script           *Script          `json:"script"`
	ScriptId         *int64           `json:"script_id"`
	Entity           *Entity          `json:"entity"`
	EntityId         *common.EntityId `json:"entity_id"`
	EntityActionName *string          `json:"entity_action_name"`
	AreaId           *int64           `json:"area_id"`
	Area             *Area            `json:"area"`
	Description      string           `json:"description"`
	CreatedAt        time.Time        `json:"created_at"`
	UpdatedAt        time.Time        `json:"updated_at"`
}

Action ...

type AlexaIntent

type AlexaIntent struct {
	Name         string    `json:"name"`
	AlexaSkillId int64     `json:"alexa_skill_id" validate:"required"`
	Script       *Script   `json:"script"`
	ScriptId     int64     `json:"script_id" validate:"required"`
	Description  string    `json:"description"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

AlexaIntent ...

type AlexaSkill

type AlexaSkill struct {
	Id          int64             `json:"id"`
	SkillId     string            `json:"skill_id" validate:"required"`
	Description string            `json:"description"`
	Status      common.StatusType `json:"status" validate:"required"`
	Intents     []*AlexaIntent    `json:"intents"`
	Script      *Script           `json:"script"`
	ScriptId    *int64            `json:"script_id"`
	CreatedAt   time.Time         `json:"created_at"`
	UpdatedAt   time.Time         `json:"updated_at"`
}

AlexaSkill ...

type AppConfig

type AppConfig struct {
	PgUser                         string         `json:"pg_user" env:"PG_USER"`
	PgPass                         string         `json:"pg_pass" env:"PG_PASS"`
	PgHost                         string         `json:"pg_host" env:"PG_HOST"`
	PgName                         string         `json:"pg_name" env:"PG_NAME"`
	PgPort                         string         `json:"pg_port" env:"PG_PORT"`
	SnapshotDir                    string         `json:"snapshot_dir" env:"SNAPSHOT_DIR"`
	Mode                           common.RunMode `json:"mode" env:"MODE"`
	AlexaHost                      string         `json:"alexa_host" env:"ALEXA_HOST"`
	Lang                           string         `json:"lang" env:"LANG"`
	Domain                         string         `json:"domain" env:"DOMAIN"`
	PgMaxIdleConns                 int            `json:"pg_max_idle_conns" env:"PG_MAX_IDLE_CONNS"`
	PgMaxOpenConns                 int            `json:"pg_max_open_conns" env:"PG_MAX_OPEN_CONNS"`
	PgConnMaxLifeTime              int            `json:"pg_conn_max_life_time" env:"PG_CONN_MAX_LIFE_TIME"`
	MqttPort                       int            `json:"mqtt_port" env:"MQTT_PORT"`
	MqttRetryInterval              time.Duration  `json:"mqtt_retry_interval" env:"MQTT_RETRY_INTERVAL"`
	MqttRetryCheckInterval         time.Duration  `json:"mqtt_retry_check_interval" env:"MQTT_RETRY_CHECK_INTERVAL"`
	MqttSessionExpiryInterval      time.Duration  `json:"mqtt_session_expiry_interval" env:"MQTT_SESSION_EXPIRY_INTERVAL"`
	MqttSessionExpireCheckInterval time.Duration  `json:"mqtt_session_expire_check_interval" env:"MQTT_SESSION_EXPIRE_CHECK_INTERVAL"`
	MqttMaxInflight                int            `json:"mqtt_max_inflight" env:"MQTT_MAX_INFLIGHT"`
	MqttMaxAwaitRel                int            `json:"mqtt_max_await_rel" env:"MQTT_MAX_AWAIT_REL"`
	MqttMaxMsgQueue                int            `json:"mqtt_max_msg_queue" env:"MQTT_MAX_MSG_QUEUE"`
	MqttDeliverMode                int            `json:"mqtt_deliver_mode" env:"MQTT_DELIVER_MODE"`
	AlexaPort                      int            `json:"alexa_port" env:"ALEXA_PORT"`
	ApiHttpPort                    int            `json:"api_http_port" env:"API_HTTP_PORT"`
	ApiHttpsPort                   int            `json:"api_https_port" env:"API_HTTPS_PORT"`
	PgDebug                        bool           `json:"pg_debug" env:"PG_DEBUG"`
	AutoMigrate                    bool           `json:"auto_migrate" env:"AUTO_MIGRATE"`
	MqttQueueQos0Messages          bool           `json:"mqtt_queue_qos_0_messages" env:"MQTT_QUEUE_QOS_0_MESSAGES"`
	Logging                        bool           `json:"logging" env:"LOGGING"`
	ColoredLogging                 bool           `json:"colored_logging" env:"COLORED_LOGGING"`
	ApiSwagger                     bool           `json:"api_swagger" env:"API_SWAGGER"`
	ApiDebug                       bool           `json:"api_debug" env:"API_DEBUG"`
	ApiGzip                        bool           `json:"api_gzip" env:"API_GZIP"`
	RootMode                       bool           `json:"root_mode" env:"ROOT_MODE"`
	RootSecret                     string         `json:"root_secret" env:"ROOT_SECRET"`
	Pprof                          bool           `json:"pprof" env:"PPROF"`
	GateClientId                   string         `json:"gate_client_id" env:"GATE_CLIENT_ID"`
	GateClientSecretKey            string         `json:"gate_client_secret_key" env:"GATE_CLIENT_SECRET_KEY"`
	GateClientServerHost           string         `json:"gate_client_server_host" env:"GATE_CLIENT_SERVER_HOST"`
	GateClientServerPort           int            `json:"gate_client_server_port" env:"GATE_CLIENT_SERVER_PORT"`
	GateClientPoolIdleSize         int            `json:"gate_client_pool_idle_size" env:"GATE_CLIENT_POOL_IDLE_SIZE"`
	GateClientPoolMaxSize          int            `json:"gate_client_pool_max_size" env:"GATE_CLIENT_POOL_MAX_SIZE"`
}

AppConfig ...

type Area

type Area struct {
	Polygon     []Point   `json:"polygon"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
	Name        string    `json:"name" validate:"required"`
	Description string    `json:"description"`
	Center      Point     `json:"center"`
	Id          int64     `json:"id"`
	Zoom        float32   `json:"zoom"`
	Resolution  float32   `json:"resolution"`
}

Area ...

type AreaPayload

type AreaPayload struct {
	Center     Point   `json:"center"`
	Zoom       float32 `json:"zoom"`
	Resolution float32 `json:"resolution"`
}

type Attribute

type Attribute struct {
	Name  string               `json:"name"`
	Type  common.AttributeType `json:"type"`
	Value interface{}          `json:"value,omitempty"`
}

Attribute ...

func (Attribute) ArrayString

func (a Attribute) ArrayString() (result []string)

ArrayString ...

func (*Attribute) Bool

func (a *Attribute) Bool() bool

Bool ...

func (Attribute) Compare

func (a Attribute) Compare(b *Attribute) (ident bool)

Compare ...

func (Attribute) Decrypt

func (a Attribute) Decrypt() string

Decrypt ...

func (*Attribute) Float64

func (a *Attribute) Float64() float64

Float64 ...

func (Attribute) Int64

func (a Attribute) Int64() int64

Int64 ...

func (Attribute) Map

func (a Attribute) Map() Attributes

Map ...

func (Attribute) Point

func (a Attribute) Point() (point Point)

Point ...

func (Attribute) String

func (a Attribute) String() string

String ...

func (*Attribute) Time

func (a *Attribute) Time() time.Time

Time ...

type AttributeValue

type AttributeValue map[string]interface{}

AttributeValue ...

type Attributes

type Attributes map[string]*Attribute

Attributes ...

func (Attributes) Copy

func (a Attributes) Copy() (copy Attributes)

Copy ...

func (Attributes) Deserialize

func (a Attributes) Deserialize(data AttributeValue) (changed bool, err error)

Deserialize ...

func (Attributes) Serialize

func (a Attributes) Serialize() (to AttributeValue)

Serialize ...

func (Attributes) Signature

func (a Attributes) Signature() (signature Attributes)

Signature ...

type AutomationStatistic

type AutomationStatistic struct {
	TasksTotal      int32
	TasksEnabled    int32
	TriggersTotal   int32
	TriggersEnabled int32
	ConditionsTotal int32
	ActionsTotal    int32
}

type Backup

type Backup struct {
	ModTime  time.Time
	Name     string
	MimeType string
	Size     int64
	FileMode fs.FileMode
}

type Backups

type Backups []*Backup

func (Backups) Len

func (l Backups) Len() int

func (Backups) Less

func (l Backups) Less(i, j int) bool

func (Backups) Swap

func (l Backups) Swap(i, j int)

type Condition

type Condition struct {
	Id          int64     `json:"id"`
	Name        string    `json:"name" validate:"required,lte=255"`
	Script      *Script   `json:"script"`
	ScriptId    *int64    `json:"script_id" validate:"required"`
	AreaId      *int64    `json:"area_id"`
	Area        *Area     `json:"area"`
	Description string    `json:"description"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

Condition ...

type Dashboard

type Dashboard struct {
	Tabs        []*DashboardTab             `json:"tabs"`
	CreatedAt   time.Time                   `json:"created_at"`
	UpdatedAt   time.Time                   `json:"updated_at"`
	Name        string                      `json:"name" validate:"required"`
	Description string                      `json:"description"`
	Id          int64                       `json:"id"`
	AreaId      *int64                      `json:"area_id"`
	Area        *Area                       `json:"area"`
	Entities    map[common.EntityId]*Entity `json:"entities"`
	Enabled     bool                        `json:"enabled"`
}

Dashboard ...

type DashboardCard

type DashboardCard struct {
	Payload        json.RawMessage             `json:"payload"`
	Items          []*DashboardCardItem        `json:"items"`
	CreatedAt      time.Time                   `json:"created_at"`
	UpdatedAt      time.Time                   `json:"updated_at"`
	Title          string                      `json:"title" validate:"required"`
	Id             int64                       `json:"id"`
	Height         int                         `json:"height" validate:"required"`
	Width          int                         `json:"width" validate:"required"`
	Background     *string                     `json:"background"`
	Weight         int                         `json:"weight"`
	DashboardTabId int64                       `json:"dashboard_tab_id" validate:"required"`
	DashboardTab   *DashboardTab               `json:"dashboard_tab"`
	Entities       map[common.EntityId]*Entity `json:"entities"`
	EntityId       *common.EntityId            `json:"entity_id"`
	Entity         *Entity                     `json:"entity"`
	Enabled        bool                        `json:"enabled"`
	Hidden         bool                        `json:"hidden"`
}

DashboardCard ...

type DashboardCardItem

type DashboardCardItem struct {
	Payload         json.RawMessage  `json:"payload"`
	CreatedAt       time.Time        `json:"created_at"`
	UpdatedAt       time.Time        `json:"updated_at"`
	Title           string           `json:"title" validate:"required"`
	Type            string           `json:"type" validate:"required"`
	Id              int64            `json:"id"`
	Weight          int              `json:"weight"`
	DashboardCardId int64            `json:"dashboard_card_id" validate:"required"`
	DashboardCard   *DashboardCard   `json:"dashboard_card"`
	EntityId        *common.EntityId `json:"entity_id"`
	Entity          *Entity          `json:"entity"`
	Enabled         bool             `json:"enabled"`
	Hidden          bool             `json:"hidden"`
	Frozen          bool             `json:"frozen"`
}

DashboardCardItem ...

type DashboardTab

type DashboardTab struct {
	Payload     json.RawMessage             `json:"payload"`
	Cards       []*DashboardCard            `json:"cards"`
	CreatedAt   time.Time                   `json:"created_at"`
	UpdatedAt   time.Time                   `json:"updated_at"`
	Name        string                      `json:"name" validate:"required"`
	Icon        string                      `json:"icon"`
	Id          int64                       `json:"id"`
	ColumnWidth int                         `json:"column_width"`
	Background  *string                     `json:"background"`
	Weight      int                         `json:"weight"`
	DashboardId int64                       `json:"dashboard_id" validate:"required"`
	Dashboard   *Dashboard                  `json:"dashboard"`
	Entities    map[common.EntityId]*Entity `json:"entities"`
	Gap         bool                        `json:"gap"`
	Enabled     bool                        `json:"enabled"`
}

DashboardTab ...

type EntitiesStatistic

type EntitiesStatistic struct {
	Total  int32
	Used   int32
	Unused int32
}

type Entity

type Entity struct {
	Actions      []*EntityAction  `json:"actions"`
	States       []*EntityState   `json:"states"`
	Metrics      []*Metric        `json:"metrics"`
	Scripts      []*Script        `json:"scripts"`
	CreatedAt    time.Time        `json:"created_at"`
	UpdatedAt    time.Time        `json:"updated_at"`
	Id           common.EntityId  `json:"id"`
	Description  string           `json:"description"`
	PluginName   string           `json:"plugin_name" validate:"required"`
	Icon         *string          `json:"icon"`
	Image        *Image           `json:"image"`
	ImageId      *int64           `json:"image_id"`
	Area         *Area            `json:"area"`
	AreaId       *int64           `json:"area_id"`
	Attributes   Attributes       `json:"attributes"`
	Settings     Attributes       `json:"settings"`
	ParentId     *common.EntityId `json:"parent_id"`
	Storage      []*EntityStorage `json:"storage"`
	Hidden       bool             `json:"hidden"`
	AutoLoad     bool             `json:"auto_load"`
	IsLoaded     bool             `json:"is_loaded"`
	RestoreState bool             `json:"restore_state"`
	Tags         []*Tag           `json:"tags"`
}

Entity ...

type EntityAction

type EntityAction struct {
	Id          int64           `json:"id"`
	Name        string          `json:"name"`
	Description string          `json:"description"`
	Icon        *string         `json:"icon"`
	EntityId    common.EntityId `json:"entity_id" validate:"required"`
	Image       *Image          `json:"image"`
	ImageId     *int64          `json:"image_id" validate:"required"`
	Script      *Script         `json:"script"`
	ScriptId    *int64          `json:"script_id" validate:"required"`
	Type        string          `json:"type"`
	CreatedAt   time.Time       `json:"created_at"`
	UpdatedAt   time.Time       `json:"updated_at"`
}

EntityAction ...

func (*EntityAction) Short

func (a *EntityAction) Short() (short EntityActionShort)

Short ...

type EntityActionShort

type EntityActionShort struct {
	Name        string  `json:"name"`
	Description string  `json:"description"`
	ImageUrl    *string `json:"image_url"`
	Icon        *string `json:"icon"`
}

EntityActionShort ...

type EntityPayload

type EntityPayload struct {
	AttributeSignature Attributes `json:"attribute_signature"`
}

EntityPayload ...

type EntitySettings

type EntitySettings struct {
	Settings Attributes `json:"settings"`
}

EntitySettings ...

type EntityShort

type EntityShort struct {
	Id          common.EntityId     `json:"id"`
	Type        string              `json:"type"`
	Name        string              `json:"name"`
	Description string              `json:"description"`
	Icon        *string             `json:"icon"`
	ImageUrl    *string             `json:"image_url"`
	Actions     []EntityActionShort `json:"actions"`
	States      []EntityStateShort  `json:"states"`
	State       *EntityStateShort   `json:"state"`
	Attributes  Attributes          `json:"attributes"`
	Settings    Attributes          `json:"settings"`
	Area        *Area               `json:"area"`
	Metrics     []*Metric           `json:"metrics"`
	Hidden      bool                `json:"hidden"`
}

todo: check EntityShort ...

type EntityState

type EntityState struct {
	Id          int64           `json:"id"`
	Name        string          `json:"name" validate:"max=254;required"`
	Description string          `json:"description"`
	Icon        *string         `json:"icon"`
	EntityId    common.EntityId `json:"entity_id" validate:"required"`
	Image       *Image          `json:"image"`
	ImageId     *int64          `json:"image_id" validate:"required"`
	Style       string          `json:"style"`
	CreatedAt   time.Time       `json:"created_at"`
	UpdatedAt   time.Time       `json:"updated_at"`
}

EntityState ...

func (*EntityState) Short

func (m *EntityState) Short() (short EntityStateShort)

Short ...

type EntityStateShort

type EntityStateShort struct {
	Name        string  `json:"name"`
	Description string  `json:"description"`
	ImageUrl    *string `json:"image_url"`
	Icon        *string `json:"icon"`
}

EntityStateShort ...

type EntityStorage

type EntityStorage struct {
	Id                int64
	State             string
	StateDescription  string
	EntityId          common.EntityId
	EntityDescription string
	Attributes        AttributeValue
	CreatedAt         time.Time
}

EntityStorage ...

type EntityStorageList

type EntityStorageList struct {
	Items      []*EntityStorage
	Attributes map[common.EntityId]Attributes
}

type GateConfig

type GateConfig struct {
	ApiHttpPort      int    `json:"api_http_port" env:"API_HTTP_PORT"`
	ApiHttpsPort     int    `json:"api_https_port" env:"API_HTTPS_PORT"`
	ApiDebug         bool   `json:"api_debug" env:"API_DEBUG"`
	ApiGzip          bool   `json:"api_gzip" env:"API_GZIP"`
	Domain           string `json:"domain" env:"DOMAIN"`
	Pprof            bool   `json:"pprof" env:"PPROF"`
	Https            bool   `json:"https" env:"HTTPS"`
	ProxyTimeout     int    `json:"proxy_timeout" env:"PROXY_TIMEOUT"`
	ProxyIdleTimeout int    `json:"proxy_idle_timeout" env:"PROXY_IDLE_TIMEOUT"`
	ProxySecretKey   string `json:"proxy_secret_key" env:"PROXY_SECRET_KEY"`
}

GateConfig ...

func (*GateConfig) ApiFullAddress

func (c *GateConfig) ApiFullAddress() (scheme string)

func (*GateConfig) ApiScheme

func (c *GateConfig) ApiScheme() (scheme string)

type GeoLocation

type GeoLocation struct {
	Status      string  `json:"status"`
	Country     string  `json:"country"`
	CountryCode string  `json:"countryCode"`
	Region      string  `json:"region"`
	RegionName  string  `json:"regionName"`
	City        string  `json:"city"`
	Zip         string  `json:"zip"`
	Lat         float64 `json:"lat"`
	Lon         float64 `json:"lon"`
	Timezone    string  `json:"timezone"`
	Isp         string  `json:"isp"`
	Org         string  `json:"org"`
	As          string  `json:"as"`
	Query       string  `json:"query"`
}

"status": "success", "country": "Russia", "countryCode": "RU", "region": "NVS", "regionName": "Novosibirsk Oblast", "city": "Novosibirsk", "zip": "630008", "lat": 54.9022, "lon": 83.0335, "timezone": "Asia/Novosibirsk", "isp": "Novotelecom Ltd.", "org": "Novotelecom ltd.", "as": "AS31200 Novotelecom Ltd", "query": "xxx.xxx.xxx.xxx"

type Image

type Image struct {
	Id        int64     `json:"id"`
	Thumb     string    `json:"thumb"`
	Url       string    `json:"url"`
	Image     string    `json:"image"`
	MimeType  string    `json:"mime_type"`
	Title     string    `json:"title"`
	Size      int64     `json:"size"`
	Name      string    `json:"name"`
	CreatedAt time.Time `json:"created_at"`
}

Image ...

type ImageFilterList

type ImageFilterList struct {
	Date  string `json:"date"`
	Count int    `json:"count"`
}

ImageFilterList ...

type Keys

type Keys struct {
	Auth   string `json:"auth"`
	P256dh string `json:"p256dh"`
}

Keys are the base64 encoded values from PushSubscription.getKey()

type Log

type Log struct {
	Id        int64           `json:"id"`
	Body      string          `json:"body" validate:"required"`
	Level     common.LogLevel `json:"level" validate:"required"`
	Owner     string          `json:"owner"`
	CreatedAt time.Time       `json:"created_at"`
}

Log ...

type LogQuery

type LogQuery struct {
	StartDate *time.Time `json:"start_date"`
	EndDate   *time.Time `json:"end_date"`
	Levels    []string   `json:"levels"`
}

LogQuery ...

type Message

type Message struct {
	Id         int64          `json:"id"`
	Type       string         `json:"type"`
	Attributes AttributeValue `json:"attributes"`
	CreatedAt  time.Time      `json:"created_at"`
	UpdatedAt  time.Time      `json:"updated_at"`
}

Message ...

type MessageDelivery

type MessageDelivery struct {
	Id                 int64            `json:"id"`
	Message            *Message         `json:"message"`
	MessageId          int64            `json:"message_id"`
	Address            string           `json:"address"`
	EntityId           *common.EntityId `json:"entity_id"`
	Status             MessageStatus    `json:"status"`
	ErrorMessageStatus *string          `json:"error_message_status"`
	ErrorMessageBody   *string          `json:"error_message_body"`
	CreatedAt          time.Time        `json:"created_at"`
	UpdatedAt          time.Time        `json:"updated_at"`
}

MessageDelivery ...

type MessageDeliveryQuery

type MessageDeliveryQuery struct {
	StartDate *time.Time `json:"start_date"`
	EndDate   *time.Time `json:"end_date"`
	Types     []string   `json:"triggers"`
}

MessageDeliveryQuery ...

type MessagePayload

type MessagePayload struct {
	AttributeSignature Attributes `json:"attribute_signature"`
}

MessagePayload ...

type MessageStatus

type MessageStatus string

MessageStatus ...

type MessageType

type MessageType string

MessageType ...

type Metric

type Metric struct {
	Id          int64             `json:"id"`
	Name        string            `json:"name" validate:"max=254;required"`
	Description string            `json:"description" validate:"max=254"`
	Options     MetricOptions     `json:"options"`
	Data        []*MetricDataItem `json:"data"`
	Type        common.MetricType `json:"type" validate:"required"`
	Ranges      []string          `json:"ranges"`
	UpdatedAt   time.Time         `json:"updated_at"`
	CreatedAt   time.Time         `json:"created_at"`
}

Metric ...

func (*Metric) RangesByType

func (d *Metric) RangesByType() []string

RangesByType ...

type MetricDataItem

type MetricDataItem struct {
	Value    map[string]interface{} `json:"value"`
	Metric   *Metric                `json:"metric"`
	MetricId int64                  `json:"metric_id"`
	Time     time.Time              `json:"time"`
}

MetricDataItem ...

type MetricOptions

type MetricOptions struct {
	Items []MetricOptionsItem `json:"items"`
}

MetricOptions ...

type MetricOptionsItem

type MetricOptionsItem struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Color       string `json:"color"`
	Translate   string `json:"translate"`
	Label       string `json:"label"`
}

MetricOptionsItem ...

type NewNotifrMessage

type NewNotifrMessage struct {
	Type         string                 `json:"type"`
	BodyType     string                 `json:"body_type"`
	EmailFrom    *string                `json:"email_from"`
	EmailSubject *string                `json:"email_subject"`
	EmailBody    *string                `json:"email_body"`
	Template     *string                `json:"template"`
	SmsText      *string                `json:"sms_text"`
	SlackText    *string                `json:"slack_text"`
	TelegramText *string                `json:"telegram_text"`
	Webpush      *string                `json:"webpush"`
	Params       map[string]interface{} `json:"params"`
	Address      string                 `json:"address"`
	ChatID       int64                  `json:"chat_id"`
}

NewNotifrMessage ...

type NewTask

type NewTask struct {
	TriggerIds   []int64              `json:"triggers" validate:"dive"`
	ConditionIds []int64              `json:"conditions" validate:"dive"`
	ActionIds    []int64              `json:"actions" validate:"dive"`
	Name         string               `json:"name" validate:"required,lte=255"`
	Description  string               `json:"description" validate:"lte=255"`
	Condition    common.ConditionType `json:"condition" validate:"required,oneof=or and"`
	Area         *Area                `json:"area"`
	AreaId       *int64               `json:"area_id"`
	Enabled      bool                 `json:"enabled"`
	IsLoaded     bool                 `json:"is_loaded"`
}

NewTask ...

type NewTrigger

type NewTrigger struct {
	Name        string     `json:"name" validate:"required,lte=255"`
	PluginName  string     `json:"plugin_name" validate:"required,lte=255"`
	Description string     `json:"description"`
	EntityIds   []string   `json:"entity_ids"`
	ScriptId    *int64     `json:"script_id"`
	Payload     Attributes `json:"payload"`
	AreaId      *int64     `json:"area_id"`
	Enabled     bool       `json:"enabled"`
	IsLoaded    bool       `json:"is_loaded"`
}

NewTrigger ...

type Permission

type Permission struct {
	Id          int64  `json:"id"`
	RoleName    string `json:"role_name"`
	PackageName string `json:"package_name"`
	LevelName   string `json:"level_name"`
}

Permission ...

type Plugin

type Plugin struct {
	Name     string         `json:"name"`
	Version  string         `json:"version"`
	Settings AttributeValue `json:"settings"`
	Enabled  bool           `json:"enabled"`
	System   bool           `json:"system"`
	Actor    bool           `json:"actor"`
	IsLoaded bool           `json:"is_loaded"`
	Triggers bool           `json:"triggers"`
	External bool           `json:"external"`
}

Plugin ...

type PluginOptions

type PluginOptions struct {
	Javascript         PluginOptionsJs              `json:"javascript"`
	ActorAttrs         Attributes                   `json:"actor_attrs"`
	ActorActions       map[string]EntityActionShort `json:"actor_actions"`
	ActorStates        map[string]EntityStateShort  `json:"actor_states"`
	ActorSetts         Attributes                   `json:"actor_setts"`
	Setts              Attributes                   `json:"setts"`
	Triggers           bool                         `json:"triggers"`
	TriggerParams      TriggerParams                `json:"trigger_params"`
	Actors             bool                         `json:"actors"`
	ActorCustomAttrs   bool                         `json:"actor_custom_attrs"`
	ActorCustomActions bool                         `json:"actor_custom_actions"`
	ActorCustomStates  bool                         `json:"actor_custom_states"`
	ActorCustomSetts   bool                         `json:"actor_custom_setts"`
}

PluginOptions ...

type PluginOptionsJs

type PluginOptionsJs struct {
	Methods   map[string]string `json:"methods"`
	Objects   map[string]string `json:"objects"`
	Variables map[string]string `json:"variables"`
}

type PluginSettings

type PluginSettings struct {
	Settings Attributes `json:"settings"`
}

PluginSettings ...

type Plugins

type Plugins []*Plugin

Plugins ...

func (Plugins) Len

func (i Plugins) Len() int

Len ...

func (Plugins) Less

func (i Plugins) Less(a, b int) bool

Less ...

func (Plugins) Swap

func (i Plugins) Swap(a, b int)

Swap ...

type Point

type Point struct {
	Lon float64 `json:"lon"`
	Lat float64 `json:"lat"`
}

type RegionInfo

type RegionInfo struct {
	Ip                 string  `json:"ip"`
	Version            string  `json:"version"`
	City               string  `json:"city"`
	Region             string  `json:"region"`
	RegionCode         string  `json:"region_code"`
	Country            string  `json:"country"`
	CountryName        string  `json:"country_name"`
	CountryCode        string  `json:"country_code"`
	CountryCodeIso3    string  `json:"country_code_iso3"`
	CountryCapital     string  `json:"country_capital"`
	CountryTld         string  `json:"country_tld"`
	ContinentCode      string  `json:"continent_code"`
	Postal             string  `json:"postal"`
	Timezone           string  `json:"timezone"`
	UtcOffset          string  `json:"utc_offset"`
	CountryCallingCode string  `json:"country_calling_code"`
	Currency           string  `json:"currency"`
	CurrencyName       string  `json:"currency_name"`
	Languages          string  `json:"languages"`
	Asn                string  `json:"asn"`
	Org                string  `json:"org"`
	Latitude           float64 `json:"latitude"`
	Longitude          float64 `json:"longitude"`
	CountryArea        float64 `json:"country_area"`
	CountryPopulation  float64 `json:"country_population"`
	InEu               bool    `json:"in_eu"`
}

"ip": "xxx.xxx.xxx.xxx", "version": "IPv4", "city": "Novosibirsk", "region": "Novosibirsk Oblast", "region_code": "NVS", "country": "RU", "country_name": "Russia", "country_code": "RU", "country_code_iso3": "RUS", "country_capital": "Moscow", "country_tld": ".ru", "continent_code": "EU", "in_eu": false, "postal": "630009", "latitude": 54.9022, "longitude": 83.0335, "timezone": "Asia/Novosibirsk", "utc_offset": "+0700", "country_calling_code": "+7", "currency": "RUB", "currency_name": "Ruble", "languages": "ru,tt,xal,cau,ady,kv,ce,tyv,cv,udm,tut,mns,bua,myv,mdf,chm,ba,inh,tut,kbd,krc,av,sah,nog", "country_area": 17100000.0, "country_population": 144478050.0, "asn": "AS31200", "org": "Novotelecom Ltd"

type Role

type Role struct {
	Name        string              `json:"name" validate:"max=254,required"`
	Description string              `json:"description"`
	Parent      *Role               `json:"parent"`
	Children    []*Role             `json:"children"`
	AccessList  map[string][]string `json:"access_list"`
	CreatedAt   time.Time           `json:"created_at"`
	UpdatedAt   time.Time           `json:"updated_at"`
}

Role ...

type RunHistory

type RunHistory []RunStory

RunHistory ...

type RunStory

type RunStory struct {
	Id    int64      `json:"id"`
	Start time.Time  `json:"start"`
	End   *time.Time `json:"end"`
}

RunStory ...

type Script

type Script struct {
	Id          int64          `json:"id"`
	Lang        ScriptLang     `json:"lang" validate:"required"`
	Name        string         `json:"name" validate:"max=254,required"`
	Source      string         `json:"source"`
	Description string         `json:"description"`
	Compiled    string         `json:"-"`
	Versions    ScriptVersions `json:"versions"`
	CreatedAt   time.Time      `json:"created_at"`
	UpdatedAt   time.Time      `json:"updated_at"`
	Info        *ScriptInfo    `json:"info"`
}

Script ...

type ScriptInfo

type ScriptInfo struct {
	AlexaIntents         int `json:"alexa_intents"`
	EntityActions        int `json:"entity_actions"`
	EntityScripts        int `json:"entity_scripts"`
	AutomationTriggers   int `json:"automation_triggers"`
	AutomationConditions int `json:"automation_conditions"`
	AutomationActions    int `json:"automation_actions"`
}

type ScriptVersion

type ScriptVersion struct {
	Id        int64      `json:"id"`
	Lang      ScriptLang `json:"lang" validate:"required"`
	Source    string     `json:"source"`
	CreatedAt time.Time  `json:"created_at"`
}

type ScriptVersions

type ScriptVersions []*ScriptVersion

func (ScriptVersions) Len

func (l ScriptVersions) Len() int

func (ScriptVersions) Less

func (l ScriptVersions) Less(i, j int) bool

func (ScriptVersions) Swap

func (l ScriptVersions) Swap(i, j int)

type ScriptsStatistic

type ScriptsStatistic struct {
	Total        int32
	Used         int32
	Unused       int32
	CoffeeScript int32
	TypeScript   int32
	JavaScript   int32
}

type Statistic

type Statistic struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Value       int32  `json:"value"`
	Diff        int32  `json:"diff"`
}

type Subscription

type Subscription struct {
	Endpoint string `json:"endpoint"`
	Keys     Keys   `json:"keys"`
}

Subscription represents a PushSubscription object from the Push API

type Tag

type Tag struct {
	Id   int64  `json:"id"`
	Name string `json:"name" validate:"required"`
}

type Task

type Task struct {
	Triggers    []*Trigger           `json:"triggers" validate:"dive"`
	Conditions  []*Condition         `json:"conditions" validate:"dive"`
	Actions     []*Action            `json:"actions" validate:"dive"`
	Telemetry   telemetry.Telemetry  `json:"telemetry"`
	CreatedAt   time.Time            `json:"created_at"`
	UpdatedAt   time.Time            `json:"updated_at"`
	Name        string               `json:"name" validate:"required,lte=255"`
	Description string               `json:"description" validate:"lte=255"`
	Condition   common.ConditionType `json:"condition" validate:"required,oneof=or and"`
	Id          int64                `json:"id"`
	Area        *Area                `json:"area"`
	AreaId      *int64               `json:"area_id"`
	Enabled     bool                 `json:"enabled"`
	IsLoaded    bool                 `json:"is_loaded"`
}

Task ...

func (*Task) AddAction

func (t *Task) AddAction(a *Action)

AddAction ...

func (*Task) AddCondition

func (t *Task) AddCondition(c *Condition)

AddCondition ...

func (*Task) AddTrigger

func (t *Task) AddTrigger(tr *Trigger)

AddTrigger ...

type TelegramChat

type TelegramChat struct {
	EntityId  common.EntityId
	ChatId    int64
	Username  string
	CreatedAt time.Time
}

TelegramChat ...

type Template

type Template struct {
	Validity
	Name         string         `json:"name" validate:"required,max=64" `
	Description  string         `json:"description"`
	Content      string         `json:"content"`
	Status       TemplateStatus `json:"status" validate:"required,max=64"`
	Type         TemplateType   `json:"type" validate:"required,max=64"`
	ParentsCount int            `json:"parents_count"`
	ParentName   *string        `json:"parent"`
	Markers      []string       `json:"markers"`
	CreatedAt    time.Time      `json:"created_at"`
	UpdatedAt    time.Time      `json:"updated_at"`
}

Template ...

func (*Template) GetMarkers

func (i *Template) GetMarkers(items []*Template, template *TemplateContent) (markers []string, err error)

GetMarkers ...

func (*Template) GetTemplate

func (i *Template) GetTemplate() (tpl *TemplateContent, err error)

GetTemplate ...

type TemplateContent

type TemplateContent struct {
	Items  []string         `json:"items"`
	Title  string           `json:"title"`
	Fields []*TemplateField `json:"fields"`
}

TemplateContent ...

type TemplateField

type TemplateField struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

TemplateField ...

type TemplateRender

type TemplateRender struct {
	Subject string `json:"subject"`
	Body    string `json:"body"`
}

TemplateRender ...

func RenderTemplate

func RenderTemplate(items []*Template, template *TemplateContent, params map[string]interface{}) (render *TemplateRender, err error)

RenderTemplate ...

type TemplateStatus

type TemplateStatus string

TemplateStatus ...

func (TemplateStatus) String

func (s TemplateStatus) String() string

String ...

type TemplateTree

type TemplateTree struct {
	Name        string          `json:"name"`
	Description string          `json:"description"`
	Status      string          `json:"status"`
	Nodes       []*TemplateTree `json:"nodes"`
}

TemplateTree ...

type TemplateType

type TemplateType string

TemplateType ...

func (TemplateType) String

func (t TemplateType) String() string

String ...

type Templates

type Templates []*Template

Templates ...

func (Templates) Len

func (i Templates) Len() int

Len ...

func (Templates) Less

func (i Templates) Less(a, b int) bool

Less ...

func (Templates) Swap

func (i Templates) Swap(a, b int)

Swap ...

type Trigger

type Trigger struct {
	CreatedAt   time.Time  `json:"created_at"`
	UpdatedAt   time.Time  `json:"updated_at"`
	Name        string     `json:"name" validate:"required,lte=255"`
	PluginName  string     `json:"plugin_name" validate:"required,lte=255"`
	Description string     `json:"description"`
	Id          int64      `json:"id"`
	Entities    []*Entity  `json:"entities" validate:"dive"`
	Script      *Script    `json:"script"`
	ScriptId    *int64     `json:"script_id"`
	Payload     Attributes `json:"payload"`
	AreaId      *int64     `json:"area_id"`
	Area        *Area      `json:"area"`
	Enabled     bool       `json:"enabled"`
	IsLoaded    bool       `json:"is_loaded"`
}

Trigger ...

type TriggerParams

type TriggerParams struct {
	Entities   bool       `json:"entities"`
	Script     bool       `json:"script"`
	Attributes Attributes `json:"attributes"`
	Required   []string   `json:"required"`
}

type TriggerPayload

type TriggerPayload struct {
	Obj Attributes `json:"obj"`
}

TriggerPayload ...

type UpdateTask

type UpdateTask struct {
	TriggerIds   []int64 `json:"triggers" validate:"dive"`
	ConditionIds []int64 `json:"conditions" validate:"dive"`
	ActionIds    []int64 `json:"actions" validate:"dive"`
	CreatedAt    time.Time
	UpdatedAt    time.Time
	Name         string               `json:"name" validate:"required,lte=255"`
	Description  string               `json:"description" validate:"lte=255"`
	Condition    common.ConditionType `json:"condition" validate:"required,oneof=or and"`
	Id           int64                `json:"id"`
	Area         *Area                `json:"area"`
	AreaId       *int64               `json:"area_id"`
	Enabled      bool                 `json:"enabled"`
	IsLoaded     bool                 `json:"is_loaded"`
}

UpdateTask ...

type UpdateTrigger

type UpdateTrigger struct {
	Name        string     `json:"name" validate:"required,lte=255"`
	PluginName  string     `json:"plugin_name" validate:"required,lte=255"`
	Description string     `json:"description"`
	Id          int64      `json:"id"`
	EntityIds   []string   `json:"entity_ids" validate:"dive"`
	ScriptId    *int64     `json:"script_id"`
	Payload     Attributes `json:"payload"`
	AreaId      *int64     `json:"area_id"`
	Enabled     bool       `json:"enabled"`
	IsLoaded    bool       `json:"is_loaded"`
}

UpdateTrigger ...

type User

type User struct {
	Id                  int64          `json:"id"`
	Nickname            string         `json:"nickname" validate:"required,min=3,max=255"`
	FirstName           string         `json:"first_name" validate:"max=255"`
	LastName            string         `json:"last_name" validate:"max=255"`
	EncryptedPassword   string         `json:"encrypted_password,omitempty"`
	Email               string         `json:"email" validate:"required,email"`
	Status              string         `json:"status" validate:"max=255"`
	ResetPasswordToken  string         `json:"-,omitempty"`
	AuthenticationToken *string        `json:"authentication_token,omitempty"`
	Image               *Image         `json:"image,omitempty"`
	ImageId             sql.NullInt64  `json:"image_id"`
	SignInCount         int64          `json:"sign_in_count,omitempty"`
	CurrentSignInIp     string         `json:"current_sign_in_ip,omitempty"`
	LastSignInIp        string         `json:"last_sign_in_ip,omitempty"`
	Lang                string         `json:"lang"`
	User                *User          `json:"user,omitempty"`
	UserId              sql.NullInt64  `json:"user_id"`
	Role                *Role          `json:"role"`
	RoleName            string         `json:"role_name,omitempty"`
	Meta                []*UserMeta    `json:"meta,omitempty"`
	ResetPasswordSentAt *time.Time     `json:"reset_password_sent_at,omitempty"`
	CurrentSignInAt     *time.Time     `json:"current_sign_in_at,omitempty"`
	LastSignInAt        *time.Time     `json:"last_sign_in_at,omitempty"`
	CreatedAt           time.Time      `json:"created_at,omitempty"`
	UpdatedAt           time.Time      `json:"updated_at,omitempty"`
	DeletedAt           *time.Time     `json:"deleted_at"`
	History             []*UserHistory `json:"history,omitempty"`
	Devices             []*UserDevice  `json:"devices"`
}

User ...

func (User) CheckPass

func (u User) CheckPass(password string) (ok bool)

CheckPass ...

func (*User) SetPass

func (u *User) SetPass(password string) (err error)

SetPass ...

func (*User) UpdateHistory

func (u *User) UpdateHistory(t time.Time, ipv4 string)

UpdateHistory ...

type UserDevice

type UserDevice struct {
	Id           int64
	UserId       int64
	Subscription *Subscription
	CreatedAt    time.Time
}

UserDevice ...

type UserHistory

type UserHistory struct {
	Ip   string    `json:"ip"`
	Time time.Time `json:"time"`
}

UserHistory ...

type UserMeta

type UserMeta struct {
	Id     int64  `json:"id"`
	User   *User  `json:"user"`
	UserId int64  `json:"user_id"`
	Key    string `json:"key"`
	Value  string `json:"value"`
}

UserMeta ...

type Validity

type Validity struct {
}

Validity ...

type Variable

type Variable struct {
	CreatedAt time.Time        `json:"created_at"`
	UpdatedAt time.Time        `json:"updated_at"`
	Name      string           `json:"name" validate:"required"`
	Value     string           `json:"value"`
	EntityId  *common.EntityId `json:"entity_id"`
	System    bool             `json:"system"`
	Tags      []*Tag           `json:"tags"`
	Changed   bool
}

Variable ...

func NewVariable

func NewVariable(name string) Variable

NewVariable ...

func (*Variable) GetBool

func (v *Variable) GetBool() bool

GetBool ...

func (*Variable) GetInt

func (v *Variable) GetInt() int

GetInt ...

func (*Variable) GetObj

func (v *Variable) GetObj(obj interface{}) (err error)

GetObj ...

func (*Variable) SetObj

func (v *Variable) SetObj(obj interface{}) (err error)

SetObj ...

type Version

type Version struct {
	Version     string `json:"version"`
	Revision    string `json:"revision"`
	RevisionURL string `json:"revision_url"`
	Generated   string `json:"generated"`
	Developers  string `json:"developers"`
	BuildNum    string `json:"build_num"`
	DockerImage string `json:"docker_image"`
}

Version ...

type Zigbee2mqtt

type Zigbee2mqtt struct {
	Devices           []*Zigbee2mqttDevice `json:"devices"`
	CreatedAt         time.Time            `json:"created_at"`
	UpdatedAt         time.Time            `json:"updated_at"`
	Name              string               `json:"name" validate:"required,max=254"`
	Login             string               `json:"login"`
	EncryptedPassword string               `json:"encrypted_password"`
	BaseTopic         string               `json:"base_topic"`
	Id                int64                `json:"id"`
	Password          *string              `json:"password"`
	Info              *Zigbee2mqttInfo     `json:"info"`
	PermitJoin        bool                 `json:"permit_join"`
}

Zigbee2mqtt ...

type Zigbee2mqttDevice

type Zigbee2mqttDevice struct {
	Id            string    `json:"id"`
	Zigbee2mqttId int64     `json:"zigbee2mqtt_id" validate:"required"`
	Name          string    `json:"name" validate:"required,max=254"`
	Type          string    `json:"type"`
	Model         string    `json:"model"`
	Description   string    `json:"description"`
	Manufacturer  string    `json:"manufacturer"`
	Functions     []string  `json:"functions"`
	ImageUrl      string    `json:"image_url"`
	Status        string    `json:"status"`
	Payload       []byte    `json:"payload"`
	CreatedAt     time.Time `json:"created_at"`
	UpdatedAt     time.Time `json:"updated_at"`
}

Zigbee2mqttDevice ...

func (*Zigbee2mqttDevice) GetImageUrl

func (d *Zigbee2mqttDevice) GetImageUrl()

GetImageUrl ...

type Zigbee2mqttInfo

type Zigbee2mqttInfo struct {
	Networkmap    string     `json:"networkmap"`
	Status        string     `json:"status"`
	LastScan      *time.Time `json:"last_scan"`
	ScanInProcess bool       `json:"scan_in_process"`
}

Jump to

Keyboard shortcuts

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