Added a paper config file with airly settings, fixed some minor issues with airly data not being printed.

This commit is contained in:
kplaczek
2018-04-15 20:09:08 +02:00
parent 1f1743adc2
commit 8e181ec4c6
3 changed files with 30 additions and 3 deletions

View File

@@ -6,18 +6,28 @@ namespace App\Paper;
class Airly
{
private $apiKey = '8b6d77b2950e4e018b0684912bf7b9ed';
private $apiKey;
public $icon = 'cloud';
private $stations = ['2210', '2256', '2180'];
private $stations = [];
private $airlyApi = 'https://airapi.airly.eu/v1';
public function __construct()
{
$this->apiKey = config('paper.airly.api_key');
}
public function getStations()
{
return $this->stations;
}
public function setStations($stations){
$this->stations = $stations;
}
function getStationInfo($stationId)
{
return json_decode(file_get_contents(sprintf('%s/sensors/%d?apikey=%s', $this->airlyApi, $stationId, $this->apiKey)), 1);