forked from mamu/spacepanel_aggregator
reduced v13 struct to doorstatus only
This commit is contained in:
parent
9cefcf2ff0
commit
a17161d861
2 changed files with 8 additions and 1 deletions
|
@ -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)
|
||||||
|
|
6
types.go
6
types.go
|
@ -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"`
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue