Control devices using chatGPT (Deprecated)
Flibbert includes a custom GPT integration that allows users to remotely execute actions on their devices through natural language commands. This powerful feature bridges the gap between AI assistance and device control.
How It Works
The Flibbert custom GPT communicates with your devices through a secure action request system. When you send a command to the custom GPT, it translates your natural language request into specific actions that are executed on your target device.
Usage
- Setup: Ensure your device is connected to the Flibbert app and online
- Action Definition: Configure available actions in your app's settings page in the Flibbert dashboard
- Natural Language: Send commands to the Flibbert custom GPT using natural language
- Execution: The GPT translates commands to action codes and queues them for your device
Example
Here's a simple example showing how to set up device control through ChatGPT:
Device Code (main.ts)
import {
delay,
dequeueActionRequest,
getActionRequestCode,
destroyActionRequest,
println,
} from "./env";
import {
gpioSetDirection,
gpioSetLevel,
GpioMode,
} from "./gpio";
export function main(): void {
// Configure GPIO pin 2 as output (mode 2)
gpioSetDirection(2, GpioMode.Output);
while (true) {
const actionRequest = dequeueActionRequest();
const actionRequestCode = getActionRequestCode(actionRequest);
destroyActionRequest(actionRequest);
if (actionRequestCode) {
println(changetype<usize>(String.UTF8.encode("Action request:" + actionRequestCode.toString(), true)));
}
if (actionRequestCode === 1) {
gpioSetLevel(2, 0); // Turn off LED
} else if (actionRequestCode === 2) {
gpioSetLevel(2, 1); // Turn on LED
}
delay(500);
}
}
Action Configuration in Flibbert Dashboard
Configure your app's actions in the app settings page:
| Action Code | Description |
|---|---|
| 1 | Turn on the light |
| 2 | Turn off the light |
These actions are automatically discovered by the custom GPT.
Using ChatGPT
With this setup, you can now tell ChatGPT:
- "Turn on the light" → Executes action code 1
- "Turn off the light" → Executes action code 2