sectoralarm

package module
v0.0.0-...-3c100d5 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: GPL-3.0 Imports: 8 Imported by: 0

README

    Package sectoralarm

Package sectoralarm implements access to the Sector Alarm API.

  USAGE

  - main.go:
    package main
    
    import (
	    "fmt"
    
	    "github.com/mattias-ohlsson/go-sectoralarm"
    )
    
    func main() {
	    client, _ := sectoralarm.NewClient("user@example.org", "password")
	    client.Login()
    
	    panels, _ := client.GetPanelList()
    
	    for _, panel := range panels {
    
		    temperatures, _ := client.GetTemperatures(panel.PanelID)
    
		    for _, temperature := range temperatures {
			    fmt.Println(temperature.Label, temperature.Temperature)
		    }
	    }
    }

Documentation

Index

Constants

View Source
const (
	BaseURL = "https://mypagesapi.sectoralarm.net"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL *url.URL

	HTTPClient *http.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(userID, password string) (*Client, error)

func (*Client) GetOverview

func (c *Client) GetOverview(panelID string) (overview *Overview, err error)

func (*Client) GetPanelList

func (c *Client) GetPanelList() (panels []Panel, err error)

func (*Client) GetTemperatures

func (c *Client) GetTemperatures(panelID string) (temperatures []Temperature, err error)

func (*Client) Login

func (c *Client) Login() error

type Overview

type Overview struct {
	Panel        Panel         `json:"Panel"`
	Locks        []interface{} `json:"Locks"`
	Smartplugs   []Smartplug   `json:"Smartplugs"`
	Temperatures []Temperature `json:"Temperatures"`
	Cameras      []interface{} `json:"Cameras"`
	Photos       []interface{} `json:"Photos"`
	Access       []string      `json:"Access"`
}

type Panel

type Panel struct {
	PartialAvalible             bool `json:"PartialAvalible"`
	PanelQuickArm               bool `json:"PanelQuickArm"`
	PanelCodeLength             int  `json:"PanelCodeLength"`
	LockLanguage                int  `json:"LockLanguage"`
	SupportsApp                 bool `json:"SupportsApp"`
	SupportsInterviewServices   bool `json:"SupportsInterviewServices"`
	SupportsPanelUsers          bool `json:"SupportsPanelUsers"`
	SupportsTemporaryPanelUsers bool `json:"SupportsTemporaryPanelUsers"`
	SupportsRegisterDevices     bool `json:"SupportsRegisterDevices"`
	CanAddDoorLock              bool `json:"CanAddDoorLock"`
	CanAddSmartPlug             bool `json:"CanAddSmartPlug"`
	HasVideo                    bool `json:"HasVideo"`
	Wifi                        struct {
		WifiExist bool   `json:"WifiExist"`
		Serial    string `json:"Serial"`
	} `json:"Wifi"`
	PanelID             string      `json:"PanelId"`
	ArmedStatus         string      `json:"ArmedStatus"`
	PanelDisplayName    string      `json:"PanelDisplayName"`
	StatusAnnex         string      `json:"StatusAnnex"`
	PanelTime           string      `json:"PanelTime"`
	AnnexAvalible       bool        `json:"AnnexAvalible"`
	IVDisplayStatus     bool        `json:"IVDisplayStatus"`
	DisplayWizard       bool        `json:"DisplayWizard"`
	BookedStartDate     string      `json:"BookedStartDate"`
	BookedEndDate       string      `json:"BookedEndDate"`
	InstallationStatus  int         `json:"InstallationStatus"`
	InstallationAddress interface{} `json:"InstallationAddress"`
	WizardStep          int         `json:"WizardStep"`
	AccessGroup         int         `json:"AccessGroup"`
	SessionExpires      string      `json:"SessionExpires"`
	IsOnline            bool        `json:"IsOnline"`
}

type Smartplug

type Smartplug struct {
	Consumption         interface{} `json:"Consumption"`
	DisplayScenarios    bool        `json:"DisplayScenarios"`
	ID                  string      `json:"Id"`
	Label               string      `json:"Label"`
	PanelID             interface{} `json:"PanelId"`
	SerialNo            string      `json:"SerialNo"`
	Scenarios           interface{} `json:"Scenarios"`
	Status              string      `json:"Status"`
	TimerActive         bool        `json:"TimerActive"`
	TimerEvents         interface{} `json:"TimerEvents"`
	TimerEventsSchedule interface{} `json:"TimerEventsSchedule"`
}

type Temperature

type Temperature struct {
	ID          interface{} `json:"Id"`
	Label       string      `json:"Label"`
	SerialNo    string      `json:"SerialNo"`
	Temperature string      `json:"Temprature"`
	DeviceID    interface{} `json:"DeviceId"`
}

Jump to

Keyboard shortcuts

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