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