pschocke / netatmo-weather-laravel-dashboard-tile
A tile to show your Netatmo weather stations
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:Blade
Requires
- php: ^7.4
- guzzlehttp/guzzle: ^7.0
- illuminate/console: ^8.0
- illuminate/http: ^8.0
- illuminate/support: ^8.0
- spatie/laravel-dashboard: ^2.0
Requires (Dev)
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-12-13 06:17:54 UTC
README
This tile can be used on the Laravel Dashboard to display all or just some of your Netatmo weather stations.
Installation
You can install the package via composer:
composer require pschocke/netatmo-weather-laravel-dashboard-tile
Creating a Netatmo OAuth App
Before we can access the Netatmo API to get the weather data, you first need to create an OAuth App. Netatmo only allows the owner of an app to use the password auth grand, so be sure to create the app with the same account that has all your devices registered.
Configure the config file
In the dashboard
config file, you must add this configuration in the tiles
key. Since package uses the password oauth authorisation grand, you need to provide the e-mail and password of your netatmo account.
// in config/dashboard.php return [ // ... 'tiles' => [ 'netatmo-weather' => [ 'client_id' => env('NETATMO_CLIENT_ID'), 'client_secret' => env('NETATMO_CLIENT_SECRET'), 'email' => env('NETATMO_ACCOUNT_EMAIL'), 'password' => env('NETATMO_ACCOUNT_PASSWORD') ] ] ];
Make sure you also create the matching entries in your .env
file.
Register the cronjob
In app\Console\Kernel.php
you should schedule the \Pschocke\NetatmoWeatherTile\FetchNetatmoWeatherDataCommand
to run. Since Netatmo only updates its data every 10 minutes on their server we only need to run our command every 10 minutes.
// in app/console/Kernel.php protected function schedule(Schedule $schedule) { // ... $schedule->command(\Pschocke\NetatmoWeatherTile\FetchNetatmoWeatherDataCommand::class)->everyTenMinutes(); }
Usage
In your dashboard view you use the netatmo-weather-tile
component.
<x-dashboard> <livewire:netatmo-weather-tile position="b1:b4" /> </x-dashboard>
Displaying only specific stations
If you want to display only a few of your stations in one tile you can specify which stations should be shown by providing the :show-devices
attribute:
<x-dashboard> <livewire:netatmo-weather-tile position="b1:b4" :show-devices="['Office', 'Rain']"/> </x-dashboard>
Customizing the view
If you want to customize the view used to render this tile, run this command:
php artisan vendor:publish --provider="Pschocke\NetatmoWeatherTile\NetatmoWeatherTileServiceProvider" --tag="dashboard-muenster-bus-tile-views"
Testing
composer test
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email patrick@ausbildung-ms.de instead of using the issue tracker.