Fix Hass integration
This commit is contained in:
+9
-8
@@ -24,6 +24,15 @@ func Init() {
|
|||||||
|
|
||||||
app.LoadConfig(&conf)
|
app.LoadConfig(&conf)
|
||||||
|
|
||||||
|
log = app.GetLogger("api")
|
||||||
|
|
||||||
|
// support https://www.home-assistant.io/integrations/rtsp_to_webrtc/
|
||||||
|
api.HandleFunc("/static", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.WriteHeader(http.StatusOK)
|
||||||
|
})
|
||||||
|
api.HandleFunc("/stream", handler)
|
||||||
|
|
||||||
|
// support load cameras from Hass config file
|
||||||
filename := path.Join(conf.Mod.Config, ".storage/core.config_entries")
|
filename := path.Join(conf.Mod.Config, ".storage/core.config_entries")
|
||||||
data, err := os.ReadFile(filename)
|
data, err := os.ReadFile(filename)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -52,14 +61,6 @@ func Init() {
|
|||||||
}
|
}
|
||||||
return nil, fmt.Errorf("can't get url: %s", url)
|
return nil, fmt.Errorf("can't get url: %s", url)
|
||||||
})
|
})
|
||||||
|
|
||||||
// support https://www.home-assistant.io/integrations/rtsp_to_webrtc/
|
|
||||||
api.HandleFunc("/static", func(w http.ResponseWriter, r *http.Request) {
|
|
||||||
w.WriteHeader(http.StatusOK)
|
|
||||||
})
|
|
||||||
api.HandleFunc("/stream", handler)
|
|
||||||
|
|
||||||
log = app.GetLogger("api")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var log zerolog.Logger
|
var log zerolog.Logger
|
||||||
|
|||||||
Reference in New Issue
Block a user