Skip to content

Control your Valetudo-powered robot vacuum with a PS4 controller using real-time joystick input and API commands

Notifications You must be signed in to change notification settings

Sloth-on-meth/valetudo-gamepad-control

Repository files navigation

GitHub stars Commits CI

Valetudo Gamepad Control

Control your Valetudo-powered robot vacuum with a game controller — now with real-time joystick input, async network commands, and a terminal-based UI (TUI) for visual feedback.


🚀 Features

  • 🎮 Smooth joystick control via PlayStation/Xbox controller
  • ⚡ Toggle speed level (Circle)
  • 🄀 Visualize joystick axes in real-time
  • 🔊 Play test sound (Square)
  • 🏠 Return to dock and quit (Triangle)
  • 🧠 Async aiohttp backend for snappy control
  • 🔢 Terminal UI (TUI) built with curses
  • ❌ Cooldown-based button debounce (no double actions)

🧪 Requirements

  • Python 3.8+
  • A robot vacuum running Valetudo > 2025.05.0 (with HighResolutionManualControlCapability)
  • A joystick/gamepad supported by pygame
  • aiohttp, pygame, curses (built-in on Linux/macOS)
pip install -r requirements.txt
# or individually
pip install aiohttp pygame

🎮 Controls

Button Action
Left Stick Move the robot
Circle Cycle speed level
Square Play test sound
Triangle Dock robot and exit
X Toggle Vaccuum

🛠️ Usage

  1. Connect your gamepad
  2. Edit config.json and set valetudo_url to your robot's IP
  3. Run:
python controller.py
  1. Control the robot with the left stick. Use buttons as described above.

🌟 TUI Display

  • Real-time joystick position bars
  • Battery level of robot (polled every 5s)
  • Current speed level
  • Button guide

🧪 Testing

This repository includes a pytest-based test suite with stubs for pygame, curses, and network calls, so you can run tests without special hardware.

Install dependencies and run tests:

pip install -r requirements.txt
pip install pytest pytest-asyncio
pytest -q

🤖 Continuous Integration (CI)

GitHub Actions runs the test suite on every push and pull request. See the status badge at the top of this README.

Workflow file: .github/workflows/ci.yml

It sets up Python and runs pytest. Tests use internal stubs for pygame, curses, and network calls, so the CI job does not need to install heavy dependencies.

About

Control your Valetudo-powered robot vacuum with a PS4 controller using real-time joystick input and API commands

Topics

Resources

Stars

Watchers

Forks

Languages