Skip to main content

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


PyPI Version Python Version Downloads License

GitHub Stars GitHub Issues Documentation


๐Ÿš€ 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

  • Natural language understanding
  • Context-aware command parsing
  • Multi-device coordination
  • Smart error handling

๐ŸŒ Network Intelligence

  • Auto-discovery of ESP devices
  • WiFi configuration management
  • Connection monitoring
  • Network scanning utilities

โšก Real-time Control

  • Instant command execution
  • Wait/delay support
  • Batch operations
  • Status monitoring

๐Ÿ”ง Developer Friendly

  • Simple 3-line setup
  • Comprehensive documentation
  • Flexible device mapping
  • Extensive examples

๐Ÿ“ฆ 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) โ†’ bool
  • auto_discover_esp() โ†’ Optional[str]
  • get_context_info() โ†’ Dict
  • clear_context() โ†’ None

ESPManager Methods

  • check_connection() โ†’ bool
  • get_esp_status() โ†’ Dict
  • reset_esp() โ†’ bool
  • configure_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


๐Ÿ™ 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

Made with โค๏ธ by Yash Kumar Firoziya

Bringing the future of IoT control to everyone

GitHub Documentation PyPI

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

limma-0.1.0.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

limma-0.1.0-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

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

Hashes for limma-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c540f1b9443807bcdafbf88bae15204ab47ce2ca39e13afc860a11c90e434f8a
MD5 248c151a7b29d26077f732cafdc15513
BLAKE2b-256 b1b06a8aa5e4cb4a4c461a2a13115732adf8b7e11835fe0886f01949832492a3

See more details on using hashes here.

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

Hashes for limma-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b7885355af273b959ebde94f590f4552d3be57ff9693d45cadceac06dbb44cba
MD5 90651c0bfa3d1a3455afc5869d0e93de
BLAKE2b-256 20f9db731fba82fc7e3bbd329ababd5dea30f79d315492e5be00a63ecb03a33a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page