Skip to content

Commit 07a4cd5

Browse files
Merge pull request robertogallea#23 from robertogallea/robertogallea-patch-1
Add getHomeZoneStates
2 parents 485c09a + a9edc36 commit 07a4cd5

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ Currently these methods are supported:
115115
### Home zones
116116
- getHomeZones($access_token);
117117
- getHomeZoneState($access_token, $zone_id);
118+
- getHomeZoneStates($access_token, $home_id);
118119
- getHomeZoneDayReport($access_token, $zone_id, $date);
119120
- getHomeZoneCapabilities($access_token, $zone_id);
120121
- getHomeZoneEarlyStart($access_token, $zone_id);

src/Restado.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,24 @@ public function getHomeZoneState($access_token, $zone_id) {
307307
$response = $client->send($request);
308308
return json_decode($response->getBody());
309309
}
310+
311+
/**
312+
* @param $access_token
313+
* @param $home_id
314+
* @return mixed
315+
*/
316+
public function getHomeZoneStates($access_token, $home_id) {
317+
$provider = $this->getProvider();
318+
319+
$request = $provider->getAuthenticatedRequest(
320+
'GET',
321+
'https://my.tado.com/api/v2/homes/' . $home_id . '/zoneStates',
322+
$access_token
323+
);
324+
$client = new \GuzzleHttp\Client();
325+
$response = $client->send($request);
326+
return json_decode($response->getBody());
327+
}
310328

311329
/**
312330
* @param $access_token
@@ -929,4 +947,4 @@ private function getProvider() {
929947
'urlResourceOwnerDetails' => null,
930948
]);
931949
}
932-
}
950+
}

0 commit comments

Comments
 (0)