reduced v13 struct to doorstatus only

This commit is contained in:
Malte Münch 2020-01-31 17:03:36 +01:00
parent 9cefcf2ff0
commit a17161d861
2 changed files with 8 additions and 1 deletions

View File

@ -12,6 +12,7 @@ func Poll(url string, led int) {
for true { for true {
resp, err := http.Get(url) resp, err := http.Get(url)
if err != nil { if err != nil {
err.Error()
ErrorPoll(url, err, led) ErrorPoll(url, err, led)
} else { } else {
data, err := ioutil.ReadAll(resp.Body) data, err := ioutil.ReadAll(resp.Body)
@ -21,7 +22,7 @@ func Poll(url string, led int) {
} else { } else {
_ = resp.Body.Close() _ = resp.Body.Close()
var parsed V13 var parsed dooronly
err = json.Unmarshal(data, &parsed) err = json.Unmarshal(data, &parsed)
if err != nil { if err != nil {
ErrorPoll(url, err, led) ErrorPoll(url, err, led)

View File

@ -237,3 +237,9 @@ type V13 struct {
} `json:"stream"` } `json:"stream"`
URL string `json:"url"` URL string `json:"url"`
} }
type dooronly struct {
State struct {
Open interface{} `json:"open"`
} `json:"state"`
}