diff --git a/server/eebus/service.go b/server/eebus/service.go new file mode 100644 index 000000000..9e7592ca1 --- /dev/null +++ b/server/eebus/service.go @@ -0,0 +1,25 @@ +package eebus + +import ( + "encoding/json" + "net/http" + + "github.com/evcc-io/evcc/server/service" +) + +func init() { + mux := http.NewServeMux() + mux.HandleFunc("GET /services", getServices) + + service.Register("eebus", mux) +} + +func getServices(w http.ResponseWriter, req *http.Request) { + var res []string + if Instance != nil { + for _, s := range Instance.RemoteServices() { + res = append(res, s.Ski) + } + } + json.NewEncoder(w).Encode(res) +} diff --git a/util/templates/defaults.yaml b/util/templates/defaults.yaml index 0be379198..e5354eaef 100644 --- a/util/templates/defaults.yaml +++ b/util/templates/defaults.yaml @@ -269,6 +269,7 @@ params: help: en: Usually found on the web interface of the wallbox de: Üblicherweise im Web Interface der Wallbox zu finden + service: eebus/services - name: uri private: true description: