HomeAssistant: add auto-discovery (#25141)

This commit is contained in:
andig 2025-11-23 10:49:39 +01:00 • committed by GitHub
parent c33a6c20e0
commit ef096a236f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 764 additions and 119 deletions

View file

@ -0,0 +1,33 @@
package network
import (
"sync"
"github.com/evcc-io/evcc/api/globalconfig"
)
var (
mu sync.Mutex
registry []func()
)
var config globalconfig.Network
func Config() globalconfig.Network {
return config
}
func Register(fun func()) {
mu.Lock()
defer mu.Unlock()
registry = append(registry, fun)
}
func Start(conf globalconfig.Network) {
config = conf
for _, fun := range registry {
go fun()
}
}