Add support pet feeder to xiaomi source #2078
This commit is contained in:
@@ -262,7 +262,7 @@ func apiDeviceList(w http.ResponseWriter, r *http.Request) {
|
|||||||
var items []*api.Source
|
var items []*api.Source
|
||||||
|
|
||||||
for _, device := range v.List {
|
for _, device := range v.List {
|
||||||
if !strings.Contains(device.Model, ".camera.") && !strings.Contains(device.Model, ".cateye.") {
|
if !device.HasCamera() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
items = append(items, &api.Source{
|
items = append(items, &api.Source{
|
||||||
@@ -289,6 +289,12 @@ type Device struct {
|
|||||||
IP string `json:"localip"`
|
IP string `json:"localip"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *Device) HasCamera() bool {
|
||||||
|
return strings.Contains(d.Model, ".camera.") ||
|
||||||
|
strings.Contains(d.Model, ".cateye.") ||
|
||||||
|
strings.Contains(d.Model, ".feeder.")
|
||||||
|
}
|
||||||
|
|
||||||
var auth *xiaomi.Cloud
|
var auth *xiaomi.Cloud
|
||||||
|
|
||||||
func apiAuth(w http.ResponseWriter, r *http.Request) {
|
func apiAuth(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|||||||
Reference in New Issue
Block a user