This nifty tool lets you boss around your smart home devices using plain old English. No more fumbling with apps or remembering device names!
Imagine telling your house, "I'm cold" and having it crank up the heat. Or saying, "Movie night!" and watching your living room transform into a mini-cinema. That's what we're doing here! We've got an AI agent that understands what you want and makes it happen.
You can read an article about Smart Home control system with LLM Agents on Medium.
- PHP 8.3 or later (we're using some fancy new features!)
- An LLM service (like OpenAI's GPT-4)
First things first, let's get this package installed:
composer require llm-agents/agent-smart-home-control
To get the Site Status Checker Agent up and running in your Spiral Framework project, you need to register its bootloader.
Here's how:
- Open up your
app/src/Application/Kernel.php
file. - Add the bootloader like this:
public function defineBootloaders(): array
{
return [
// ... other bootloaders ...
\LLM\Agents\Agent\SmartHomeControl\Integrations\Spiral\SmartHomeControlBootloader::class,
];
}
And that's it! Your Spiral app is now ready to use the agent.
Here's a quick look at how everything fits together:
classDiagram
class SmartHomeControlAgent {
+execute(prompt: string): string
}
class SmartHomeSystem {
+getDevices(): array
+controlDevice(deviceId: string, action: string): bool
}
class Device {
+id: string
+name: string
+type: string
+room: string
+getState(): array
+setState(state: array): bool
}
class Light {
+turnOn()
+turnOff()
+setBrightness(level: int)
}
class Thermostat {
+setTemperature(temp: float)
}
class TV {
+turnOn()
+turnOff()
+setChannel(channel: string)
}
SmartHomeControlAgent --> SmartHomeSystem: uses
SmartHomeSystem --> Device: manages
Device <|-- Light
Device <|-- Thermostat
Device <|-- TV
We love contributions! If you've got ideas to make this agent even cooler, here's how you can chip in:
- Fork the repo
- Make your changes
- Create a new Pull Request
Just make sure your code is clean, well-commented, and follows PSR-12 coding standards.
This project is licensed under the MIT License - see the LICENSE file for details.
That's all, folks! If you've got any questions or run into any trouble, don't hesitate to open an issue.