github.com/amimof/huego@v1.2.1/config.go (about)

     1  package huego
     2  
     3  // Config holds the bridge hardware configuration
     4  type Config struct {
     5  	Name             string               `json:"name,omitempty"`
     6  	SwUpdate         SwUpdate             `json:"swupdate"`
     7  	SwUpdate2        SwUpdate2            `json:"swupdate2"`
     8  	WhitelistMap     map[string]Whitelist `json:"whitelist"`
     9  	Whitelist        []Whitelist          `json:"-"`
    10  	PortalState      PortalState          `json:"portalstate"`
    11  	APIVersion       string               `json:"apiversion,omitempty"`
    12  	SwVersion        string               `json:"swversion,omitempty"`
    13  	ProxyAddress     string               `json:"proxyaddress,omitempty"`
    14  	ProxyPort        uint16               `json:"proxyport,omitempty"`
    15  	LinkButton       bool                 `json:"linkbutton,omitempty"`
    16  	IPAddress        string               `json:"ipaddress,omitempty"`
    17  	Mac              string               `json:"mac,omitempty"`
    18  	NetMask          string               `json:"netmask,omitempty"`
    19  	Gateway          string               `json:"gateway,omitempty"`
    20  	Dhcp             bool                 `json:"dhcp,omitempty"`
    21  	PortalServices   bool                 `json:"portalservices,omitempty"`
    22  	UTC              string               `json:"UTC,omitempty"`
    23  	LocalTime        string               `json:"localtime,omitempty"`
    24  	TimeZone         string               `json:"timezone,omitempty"`
    25  	ZigbeeChannel    uint8                `json:"zigbeechannel,omitempty"`
    26  	ModelID          string               `json:"modelid,omitempty"`
    27  	BridgeID         string               `json:"bridgeid,omitempty"`
    28  	FactoryNew       bool                 `json:"factorynew,omitempty"`
    29  	ReplacesBridgeID string               `json:"replacesbridgeid,omitempty"`
    30  	DatastoreVersion string               `json:"datastoreversion,omitempty"`
    31  	StarterKitID     string               `json:"starterkitid,omitempty"`
    32  	InternetService  InternetService      `json:"internetservices,omitempty"`
    33  }
    34  
    35  // SwUpdate contains information related to software updates. Deprecated in 1.20
    36  type SwUpdate struct {
    37  	CheckForUpdate bool        `json:"checkforupdate,omitempty"`
    38  	DeviceTypes    DeviceTypes `json:"devicetypes"`
    39  	UpdateState    uint8       `json:"updatestate,omitempty"`
    40  	Notify         bool        `json:"notify,omitempty"`
    41  	URL            string      `json:"url,omitempty"`
    42  	Text           string      `json:"text,omitempty"`
    43  }
    44  
    45  // SwUpdate2 contains information related to software updates
    46  type SwUpdate2 struct {
    47  	Bridge         BridgeConfig `json:"bridge"`
    48  	CheckForUpdate bool         `json:"checkforupdate,omitempty"`
    49  	State          string       `json:"state,omitempty"`
    50  	Install        bool         `json:"install,omitempty"`
    51  	AutoInstall    AutoInstall  `json:"autoinstall"`
    52  	LastChange     string       `json:"lastchange,omitempty"`
    53  	LastInstall    string       `json:"lastinstall,omitempty"`
    54  }
    55  
    56  // DeviceTypes details the type of updates available
    57  type DeviceTypes struct {
    58  	Bridge  bool     `json:"bridge,omitempty"`
    59  	Lights  []string `json:"lights,omitempty"`
    60  	Sensors []string `json:"sensors,omitempty"`
    61  }
    62  
    63  // BridgeConfig holds information about software updates
    64  type BridgeConfig struct {
    65  	State       string `json:"state,omitempty"`
    66  	LastInstall string `json:"lastinstall,omitempty"`
    67  }
    68  
    69  // AutoInstall holds automatic update configuration
    70  type AutoInstall struct {
    71  	On         bool   `json:"on,omitempty"`
    72  	UpdateTime string `json:"updatetime,omitempty"`
    73  }
    74  
    75  // InternetService stores information about the internet connectivity to the bridge
    76  type InternetService struct {
    77  	Internet     string `json:"internet,omitempty"`
    78  	RemoteAccess string `json:"remoteaccess,omitempty"`
    79  	Time         string `json:"time,omitempty"`
    80  	SwUpdate     string `json:"swupdate,omitempty"`
    81  }
    82  
    83  // Backup holds configuration backup status information
    84  type Backup struct {
    85  	Status    string `json:"backup,omitempty"`
    86  	ErrorCode int    `json:"errorcode,omitempty"`
    87  }
    88  
    89  // Whitelist represents a whitelist user ID in the bridge
    90  type Whitelist struct {
    91  	Name        string `json:"name"`
    92  	Username    string
    93  	CreateDate  string `json:"create date"`
    94  	LastUseDate string `json:"last use date"`
    95  	ClientKey   string
    96  }
    97  
    98  // PortalState is a struct representing the portal state
    99  type PortalState struct {
   100  	SignedOn      bool   `json:"signedon,omitempty"`
   101  	Incoming      bool   `json:"incoming,omitempty"`
   102  	Outgoing      bool   `json:"outgoing,omitempty"`
   103  	Communication string `json:"communication,omitempty"`
   104  }