From aecc47c3f558dc3f0548d4c8e69f20ed893f5196 Mon Sep 17 00:00:00 2001 From: xengineering Date: Thu, 26 Mar 2026 17:25:27 +0100 Subject: Add TP-Link config parsing This is required to assign IDs and IP addresses. --- config.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'config.go') diff --git a/config.go b/config.go index a294b6c..93f4459 100644 --- a/config.go +++ b/config.go @@ -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 } -- cgit v1.3