chipneedham/laravel-govee
Laravel package to control Govee smart lights via the Govee Smart Home API. Includes a Govee facade to list devices and control power, brightness, RGB/hex color, and white temperature. Configure with your GOVEE_API_KEY.
A Laravel package for interacting with the Govee Smart Home API, allowing easy control and management of Govee smart devices. At the moment only lights are supported.
You can install the package via Composer:
composer require chipneedham/laravel-govee
Publish the configuration file:
php artisan vendor:publish --tag="config"
This will create a config/govee.php file. Add your Govee API key to your .env file:
GOVEE_API_KEY=your_govee_api_key_here
use Govee;
// Get all Govee devices
$devices = Govee::getDevices();
foreach ($devices as $device) {
echo $device->name; // Device name
echo $device->deviceId; // Device ID
}
// Turn a device on/off
$device->setPowerState(true); // Turn on
$device->setPowerState(false); // Turn off
// Set brightness (1-100)
$device->setBrightness(50);
// Set color using RGB
$device->setColor(255, 0, 0); // Red
// Set color using Hex
$device->setHexColor('#00FF00'); // Green
// Set white color temperature (2000-9000K)
$device->setWhiteTemperature(4000);
// If you know the device ID and model
$specificDevice = Govee::getDevice('your-device-id', 'your-device-model');
Govee's rate limits are annoyingly low. Sorry.
| Endpoint | Limit |
|---|---|
| DeviceList | 10 per minute |
| DeviceControl | 10 per minute per device |
| DeviceState | 10 per minute per device |
| Total Requests | 10000 per day |
Error handling has a lot of work to be done, at the moment be sure to use trys. The package throws exceptions for invalid inputs or API errors:
try {
$device->setBrightness(150); // Will throw an exception
} catch (\Exception $e) {
// Handle error
echo $e->getMessage();
}
The package includes a Govee facade for easy access to the Govee API client.
Please ensure your Govee API key is kept secure and not committed to version control.
Contributions are welcome! Please submit pull requests or file issues on the GitHub repository.
If you encounter any issues or have questions, please file an issue on the GitHub repository.
How can I help you explore Laravel packages today?