mirror of
https://github.com/Xevion/go-ha.git
synced 2025-12-07 18:07:09 -06:00
Add functionality to list entities from REST endpoint
This commit is contained in:
@@ -40,6 +40,14 @@ func (c *HttpClient) GetState(entityId string) ([]byte, error) {
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (c *HttpClient) States() ([]byte, error) {
|
||||
resp, err := get(c.url+"/states", c.token)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func get(url, token string) ([]byte, error) {
|
||||
req, err := http.NewRequest("GET", url, nil)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user