diff options
Diffstat (limited to 'config.go')
| -rw-r--r-- | config.go | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -52,10 +52,18 @@ type ShellyConfig struct { type ShellyConfigs []ShellyConfig +type TPLinkConfig struct { + ID string `json:"id"` + IP string `json:"ip"` +} + +type TPLinkConfigs []TPLinkConfig + type StartupConfig struct { MQTT MQTTConfig `json:"mqtt"` Homematic HomematicConfig `json:"homematic"` Shelly ShellyConfigs `json:"shelly"` + TPLink TPLinkConfigs `json:"tplink"` } func (sc StartupConfig) String() string { @@ -132,6 +140,13 @@ func (sc StartupConfig) Validate() error { } } + for _, tplink := range sc.TPLink { + ip := net.ParseIP(tplink.IP) + if ip == nil { + return fmt.Errorf("Failed to parse IP address '%s'.", tplink.IP) + } + } + return nil } |
