mapo-89/laravel-homeassistant-api

Laravel package to interact with Home Assistant REST API.

Installs: 4

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/mapo-89/laravel-homeassistant-api

v1.2.0 2025-12-07 04:05 UTC

This package is auto-updated.

Last update: 2025-12-07 04:06:37 UTC


README

Latest Version on Packagist Total Downloads GitHub Actions

A simple Laravel integration for the Homeassistant API. This package provides a clean interface to interact with the API.

📖 This README is also available in 🇩🇪 German.

📦 Installation

Install the package via Composer:

composer require mapo-89/laravel-homeassistant-api

Add your API token to your .env file:

HA_URL=http://homeassistant.local:8123
HA_TOKEN=your_long_lived_token

⚡️ Dynamic configuration (URL & token at runtime)

In addition to static configuration via config/homeassistant.php, this package also supports dynamic configurations at runtime. This is useful, for example, if each user has their own Home Assistant token or if the instance URL is to be set dynamically.

Optionally, you can publish the config file:

php artisan vendor:publish --provider="Mapo89\LaravelHomeassistantApi\HomeassistantApiServiceProvider" --tag="config"

⚙️ Usage

use Mapo89\LaravelHomeassistantApi\Facades\HomeassistantApi;

// Example: Fetch all states
$homeassistantApi = HomeassistantApi::make();

//Alternative with dynamic configuration
$config = [
    'url' => 'http://homeassistant.local:8123',
    'token' => 'your_long_lived_token'
];
$homeassistantApi = HomeassistantApi::make($config);
$homeassistantApi->states()->all(); // customize this based on your needs

📚 Full API documentation available at: home-assistant.io

Artisan Command

The following Artisan commands always use the static configuration from .env or config/homeassistant.php:

# List all states
php artisan ha:call

# Call a service (e.g., switch lights) (in implementation)
php artisan ha:call light toggle --entity=light.livingroom

📒 Changelog

Please see CHANGELOG for recent changes.

🤝 Contributing

Contributions are welcome! Please see CONTRIBUTING for details.

🔐 Security

If you discover any security issues, please do not use the issue tracker. Instead, email us directly at info@postler.de.

👥 Credits

📄 License

The MIT License (MIT). Please see the License File for more information.

🛠️ Laravel Package Boilerplate

Generated using the Laravel Package Boilerplate.