Language Interface Model for Machine Automation - Control ESP devices with natural language
Project description
๐ค LIMMA
Language Interface Model for Machine Automation
Control your ESP8266/ESP32 devices with natural language commands
๐ What is LIMMA?
LIMMA is a revolutionary Python SDK that bridges the gap between natural language and IoT device control. Simply speak or type commands like "turn on the living room lights" or "off the fan", and watch your ESP8266/ESP32 devices respond instantly!
๐ฏ Perfect For
- ๐ Smart Home Automation
- ๐ Car Automation Systems
- ๐ญ Industrial IoT Control
- ๐ค Voice-Controlled Robotics
- ๐ฑ Custom IoT Applications
โจ Key Features
๐ง AI-Powered Processing
๐ Network Intelligence
|
โก Real-time Control
๐ง Developer Friendly
|
๐ฆ Installation
Quick Install
pip install limma
With Voice Support
pip install limma pyvoicekit
Development Installation
git clone https://github.com/firoziya/limma.git
cd limma
pip install -e ".[dev]"
๐ฏ Quick Start
1๏ธโฃ Basic Setup
from limma import Limma, LimmaConfig
# Configure your setup
config = LimmaConfig(
esp_ip="192.168.1.100", # Your ESP device IP
application_type="home", # or "car", "office", etc.
device_map={
"living room light": "ch01",
"bedroom fan": "ch02",
"kitchen light": "ch03",
"garage door": "ch04"
},
api_key="your-limma-api-key", # Get from https://pylimma.vercel.app
reply=True # Enable voice responses
)
# Initialize LIMMA
limma = Limma(config)
2๏ธโฃ Execute Commands
# Single commands
success, reply = limma.execute_command("turn on the living room light")
if success:
print(f"โ
{reply or 'Command executed successfully!'}")
# Complex commands
limma.execute_command("turn on all lights and wait 5 seconds then turn off the fan")
# Multiple device control
limma.execute_command("turn on the AC, set bedroom light to dim, and close the curtains")
3๏ธโฃ Voice Control Example
from limma import Limma, LimmaConfig
from pyvoicekit import listen, speak
def voice_control():
# ... config setup ...
limma = Limma(config)
print("๐ค Voice control ready! Say something...")
while True:
command = listen() # Listen for voice input
if command:
print(f"๐ค You said: {command}")
success, reply = limma.execute_command(command)
if success and reply:
speak(reply) # Voice response
print(f"๐ค LIMMA: {reply}")
voice_control()
๐ ๏ธ ESP8266/ESP32 Code
Upload this code to your ESP device:
๐ Click to view ESP8266 Arduino Code
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
const char* ssid = "your-wifi-ssid";
const char* password = "your-wifi-password";
ESP8266WebServer server(80);
// Pin definitions
const int CH01_PIN = D1; // Living room light
const int CH02_PIN = D2; // Bedroom fan
const int CH03_PIN = D3; // Kitchen light
const int CH04_PIN = D4; // Garage door
void setup() {
Serial.begin(115200);
// Initialize pins
pinMode(CH01_PIN, OUTPUT);
pinMode(CH02_PIN, OUTPUT);
pinMode(CH03_PIN, OUTPUT);
pinMode(CH04_PIN, OUTPUT);
// Connect to WiFi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.print(".");
}
Serial.println("โ
Connected!");
Serial.print("IP: ");
Serial.println(WiFi.localIP());
// Setup routes
server.on("/ch01on", []() { digitalWrite(CH01_PIN, HIGH); server.send(200, "text/plain", "CH01 ON"); });
server.on("/ch01off", []() { digitalWrite(CH01_PIN, LOW); server.send(200, "text/plain", "CH01 OFF"); });
server.on("/ch02on", []() { digitalWrite(CH02_PIN, HIGH); server.send(200, "text/plain", "CH02 ON"); });
server.on("/ch02off", []() { digitalWrite(CH02_PIN, LOW); server.send(200, "text/plain", "CH02 OFF"); });
// ... add more routes for other channels
server.on("/ping", []() { server.send(200, "application/json", "{\"status\":\"pong\",\"device\":\"LIMMA-ESP8266\"}"); });
server.begin();
}
void loop() {
server.handleClient();
}
๐ Advanced Usage
๐ Auto-Discovery
Automatically find ESP devices on your network
esp_ip = limma.auto_discover_esp()
if esp_ip:
print(f"Found ESP device at: {esp_ip}")
config.esp_ip = esp_ip
โ๏ธ Device Management
# Check ESP connection
if limma.esp_manager.check_connection():
print("โ
ESP is online")
# Get device status
status = limma.esp_manager.get_esp_status()
print(f"Device info: {status}")
# Configure WiFi remotely
limma.esp_manager.configure_wifi("new-ssid", "new-password")
๐ง Context Management
# View command history
context_info = limma.get_context_info()
print(f"Remembered commands: {context_info['context_count']}")
# Clear context
limma.clear_context()
๐ง Custom Applications
# Car automation
car_config = LimmaConfig(
esp_ip="192.168.4.1",
application_type="car",
device_map={
"headlights": "ch01",
"engine": "ch02",
"air conditioning": "ch03",
"radio": "ch04"
},
api_key="your-api-key"
)
car_limma = Limma(car_config)
car_limma.execute_command("start the engine and turn on headlights")
๐๏ธ API Reference
LimmaConfig
LimmaConfig(
esp_ip: str, # ESP device IP address
application_type: str, # "home", "car", "office", etc.
device_map: dict, # Device name -> channel mapping
api_key: str, # LIMMA API key
server_url: str = "...", # LIMMA server URL
reply: bool = False # Enable voice replies
)
Limma Methods
execute_command(command: str)โTuple[bool, Optional[str]]send_to_server(command: str)โList[str]send_to_esp(functions: List[str])โTuple[bool, Optional[str]]setup_esp(ssid, password)โboolauto_discover_esp()โOptional[str]get_context_info()โDictclear_context()โNone
ESPManager Methods
check_connection()โboolget_esp_status()โDictreset_esp()โboolconfigure_wifi(ssid, password)โbool
NetworkUtils Methods
scan_network_for_esp(base_ip)โList[str]get_local_ip()โstr
๐ก Examples & Use Cases
๐ Smart Home Scenarios
# Morning routine
limma.execute_command("good morning")
# Automatically: turn on lights, start coffee maker, open curtains
# Movie time
limma.execute_command("movie mode")
# Automatically: dim lights, turn on TV, close curtains
# Security mode
limma.execute_command("activate security")
# Automatically: turn off all lights, lock doors, arm sensors
๐ Car Automation
# Starting the car
limma.execute_command("start my car")
# Automatically: engine on, headlights on, AC on
# Parking mode
limma.execute_command("parking mode")
# Automatically: engine off, lights off, lock doors
๐ญ Industrial Control
# Production line control
limma.execute_command("start production line 1")
# Automatically: conveyor on, machines on, monitoring systems active
# Emergency stop
limma.execute_command("emergency stop all systems")
# Automatically: all equipment off, alarms on, safety protocols active
๐ Troubleshooting
Common Issues
| Issue | Solution |
|---|---|
| ๐ด ESP not found | Check IP address, WiFi connection |
| ๐ด API key error | Verify key at https://pylimma.vercel.app |
| ๐ด Command not working | Check device mapping, try simpler commands |
| ๐ด Network issues | Use auto_discover_esp() function |
Debug Mode
import logging
logging.basicConfig(level=logging.DEBUG)
# Now LIMMA will show detailed logs
limma.execute_command("turn on light")
๐ License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
๐จโ๐ป Author
Yash Kumar Firoziya
- ๐ง Email: ykfiroziya@gmail.com
- ๐ฑ GitHub: @firoziya
- ๐ Website: pylimma.vercel.app
๐ Acknowledgments
- Thanks to all contributors and users
- Inspired by the growing IoT community
- Built with โค๏ธ for makers and developers
โญ Show Your Support
If you found LIMMA helpful, please consider:
- โญ Starring this repository
- ๐ Reporting bugs and issues
- ๐ก Suggesting new features
- ๐ข Sharing with friends and colleagues
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file limma-0.1.0.tar.gz.
File metadata
- Download URL: limma-0.1.0.tar.gz
- Upload date:
- Size: 18.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c540f1b9443807bcdafbf88bae15204ab47ce2ca39e13afc860a11c90e434f8a
|
|
| MD5 |
248c151a7b29d26077f732cafdc15513
|
|
| BLAKE2b-256 |
b1b06a8aa5e4cb4a4c461a2a13115732adf8b7e11835fe0886f01949832492a3
|
File details
Details for the file limma-0.1.0-py3-none-any.whl.
File metadata
- Download URL: limma-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7885355af273b959ebde94f590f4552d3be57ff9693d45cadceac06dbb44cba
|
|
| MD5 |
90651c0bfa3d1a3455afc5869d0e93de
|
|
| BLAKE2b-256 |
20f9db731fba82fc7e3bbd329ababd5dea30f79d315492e5be00a63ecb03a33a
|