From a17161d86110c9ba0f0810be1286d27d5433c57e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malte=20M=C3=BCnch?= Date: Fri, 31 Jan 2020 17:03:36 +0100 Subject: [PATCH] reduced v13 struct to doorstatus only --- httppoll.go | 3 ++- types.go | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/httppoll.go b/httppoll.go index 52f219a..dc121ca 100644 --- a/httppoll.go +++ b/httppoll.go @@ -12,6 +12,7 @@ func Poll(url string, led int) { for true { resp, err := http.Get(url) if err != nil { + err.Error() ErrorPoll(url, err, led) } else { data, err := ioutil.ReadAll(resp.Body) @@ -21,7 +22,7 @@ func Poll(url string, led int) { } else { _ = resp.Body.Close() - var parsed V13 + var parsed dooronly err = json.Unmarshal(data, &parsed) if err != nil { ErrorPoll(url, err, led) diff --git a/types.go b/types.go index 9d01e67..807807b 100644 --- a/types.go +++ b/types.go @@ -237,3 +237,9 @@ type V13 struct { } `json:"stream"` URL string `json:"url"` } + +type dooronly struct { + State struct { + Open interface{} `json:"open"` + } `json:"state"` +}