Documentation
¶
Overview ¶
Package xovis contains a driver for camera-based occupancy sensors produced by Xovis. This package is intended to work with sensors running firmware version 5.x.
Xovis exposes data organised under Logics. Zone-based (occupancy) logics are exposed by this driver using the OccupancySensor trait. Line-based (person count in/out) logics are exposed by this driver using the EnterLeaveSensor trait.
A Xovis sensor can operate in single-sensor or multi-sensor modes. The data and operation available are similar between these two modes, but in the API they are accessed using separate endpoints.
For one-shot data access, the driver uses the Live Data API endpoints to fetch the most up-to-date info on the appropriate logic. This involves us performing an HTTP(S) request to the sensor's built-in server. For streaming data (e.g. PullXxx Smart Core APIs) data flows in the other direction using a webhook - we add a route to the area controller's HTTP server for receiving the data. A Data Push agent must be manually configured on the sensor as follows:
Data Push Agent:
- Type: Logics push
- Scheduler Type: Immediate
- Resolution: As desired, 1 minute makes most sense
- Format: JSON
- Time Format: RFC 3339
Index ¶
- Constants
- Variables
- func ResetLiveLogic(conn *Client, multiSensor bool, id int) error
- type APIError
- type Client
- type Code
- type Count
- type DataPushConfig
- type DeviceConfig
- type DeviceInfo
- type Driver
- type DriverConfig
- type Geometry
- type LiveLogicData
- type LiveLogicResponse
- type LiveLogicsResponse
- type Logic
- type LogicConfig
- type LogicRecord
- type LogicsPushData
- type PackageInfo
- type PushData
- type SensorInfo
Constants ¶
const DriverName = "xovis"
Variables ¶
var Factory driver.Factory = factory{}
Functions ¶
Types ¶
type APIError ¶
type Client ¶
type Code ¶
type Code int
const ( CodeInvalidSettings Code = 10010 CodeInvalidContentType Code = 11000 CodeEmptyRequest Code = 11001 CodeContentLengthRequired Code = 11002 CodeInvalidJSON Code = 11100 CodeInvalidTimeFormat Code = 11200 CodeTimeInPast Code = 11201 CodeUpdateDowngrade Code = 21000 CodeUpdateUploading Code = 21001 CodeUpdateInstalling Code = 21002 CodeUpdateInvalid Code = 21003 CodeBackupIPSettingsChanged Code = 21100 CodeBackupNewerVersion Code = 21101 CodeDataPushIDModeError Code = 31000 CodeDataPushAgentTriggerBusy Code = 31001 )
type DataPushConfig ¶
type DeviceConfig ¶
type DeviceConfig struct {
Name string `json:"name"`
Occupancy *LogicConfig `json:"occupancy"` // an Occupancy logic
EnterLeave *LogicConfig `json:"enterLeave"` // an In/Out logic
Metadata *traits.Metadata `json:"metadata,omitempty"`
}
type DeviceInfo ¶
type DeviceInfo struct {
HWBomRev string `json:"hw_bom_rev"`
HWPcbRev string `json:"hw_pcb_rev"`
Serial string `json:"serial"`
FWVersion string `json:"fw_version"`
ProdCode string `json:"prod_code"`
Type string `json:"type"`
Variant string `json:"variant"`
HWProdRev string `json:"hw_prod_rev"`
HWID string `json:"hw_id"`
}
func GetDeviceInfo ¶
func GetDeviceInfo(conn *Client) (DeviceInfo, error)
type Driver ¶
type Driver struct {
*service.Service[DriverConfig]
driver.Services
// contains filtered or unexported fields
}
type DriverConfig ¶
type DriverConfig struct {
driver.BaseConfig
MultiSensor bool `json:"multiSensor"`
Host string `json:"host"`
Username string `json:"username"`
Password string `json:"password,omitempty"`
PasswordFile string `json:"passwordFile,omitempty"`
DataPush *DataPushConfig `json:"dataPush"`
Devices []DeviceConfig `json:"devices,omitempty"`
}
func DefaultConfig ¶
func DefaultConfig() DriverConfig
func ParseConfig ¶
func ParseConfig(raw []byte) (DriverConfig, error)
func (DriverConfig) LoadPassword ¶
func (c DriverConfig) LoadPassword() (string, error)
type LiveLogicData ¶
type LiveLogicResponse ¶
type LiveLogicResponse struct {
Time time.Time `json:"time"`
Logic LiveLogicData `json:"logic"`
}
func GetLiveLogic ¶
func GetLiveLogic(conn *Client, multiSensor bool, id int) (res LiveLogicResponse, err error)
type LiveLogicsResponse ¶
type LiveLogicsResponse struct {
Time time.Time `json:"time"`
Logics []LiveLogicData `json:"logics"`
}
func GetLiveLogics ¶
func GetLiveLogics(conn *Client, multiSensor bool) (res LiveLogicsResponse, err error)
type Logic ¶
type Logic struct {
ID int `json:"id"`
Name string `json:"name"`
Info string `json:"info"`
Geometries []Geometry `json:"geometries"`
Records []LogicRecord `json:"records"`
}
type LogicConfig ¶
type LogicConfig struct {
ID int `json:"id"`
}
type LogicRecord ¶
type LogicsPushData ¶
type LogicsPushData struct {
PackageInfo *PackageInfo `json:"package_info,omitempty"`
SensorInfo *SensorInfo `json:"sensor_info,omitempty"`
Logics []Logic `json:"logics"`
}
type PackageInfo ¶
type PushData ¶
type PushData struct {
LogicsData *LogicsPushData `json:"logics_data,omitempty"`
}
type SensorInfo ¶
type SensorInfo struct {
Type string `json:"type"`
SerialNumber string `json:"serial_number"`
Name string `json:"name"`
Group string `json:"group"`
DeviceType string `json:"device_type"`
HWVersion string `json:"hw_version"`
SWVersion string `json:"sw_version"`
Time time.Time `json:"time"`
Timezone string `json:"timezone"`
}