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