A Python API wrapper for the Gira X1 smart home controller, providing easy access to the Gira IoT REST API.
- Python >= 3.13
- uv (recommended for package management)
# Clone the repository
git clone https://github.com/j-tobias/X1_Controller.git
cd X1_Controller
# Install dependencies
uv sync
# Or install in development mode
uv sync --devpip install -e .from x1_controller import GiraController
# Initialize the controller
controller = GiraController("192.168.1.100")
# Check availability
if controller.check_availability():
print("X1 is available!")
# Register and authenticate
token = controller.register_client("your_username", "your_password")
print(f"Token: {token}")
# Get all devices
devices = controller.get_devices()
for device in devices:
print(f"Device: {device.display_name} ({device.uid})")
# Get a specific device
dimmer = controller.get_device(display_name="Living Room Light")
if dimmer:
# Update values from device
dimmer.update_values()
# Control the dimmer
dimmer.toggle()
dimmer.dim_to(50) # Set to 50%
dimmer.turn_off()
# When done
controller.unregister_client()- KNXDimmer - Dimmable lights with on/off, brightness, and shift control
- Switch - Binary on/off switches
- BlindWithPos - Motorized blinds with position control
Main controller class for interacting with the X1.
controller = GiraController(ip="192.168.1.100", client_id="de.myapp.client")check_availability()- Check if the X1 API is reachableregister_client(username, password)- Authenticate and get a tokenunregister_client(token=None)- Deregister the clientget_uid()- Get configuration unique identifierget_config(filename=None)- Get X1 configuration (optionally save to file)get_devices()- Get all devices as objectsget_device(display_name=None, uid=None)- Get a specific device
All devices inherit from GiraDevice and share common methods:
update_values()- Fetch current values from deviceset_value(datapoint_name, value)- Set a datapoint value
dimmer.toggle() # Toggle on/off
dimmer.turn_on() # Turn on
dimmer.turn_off() # Turn off
dimmer.dim_to(percent) # Set brightness (0-100)
# Properties
dimmer.on_off # Current on/off state
dimmer.brightness # Current brightness
dimmer.has_brightness # Whether brightness control is availableswitch.toggle() # Toggle on/off
switch.turn_on() # Turn on
switch.turn_off() # Turn off
# Properties
switch.on_off # Current on/off stateblind.move_up() # Move blind up
blind.move_down() # Move blind down
blind.step_up() # Small step up
blind.step_down() # Small step down
blind.set_position(50) # Set position (0-100)
blind.set_slat_position(30) # Set slat position (0-100)
# Properties
blind.position # Current position
blind.slat_position # Current slat position
blind.has_position # Whether position control is available
blind.has_slat_position # Whether slat control is availableuv sync --devuv run ruff check .
uv run ruff format .uv run mypy src/uv run pytestIf you're updating from the old API, here are the key changes:
| Old | New |
|---|---|
from X1API import GiraControl |
from x1_controller import GiraController |
gira.availability_check() |
controller.check_availability() |
gira.get_uid_config() |
controller.get_config() |
device.displayName |
device.display_name |
dimmer.dimm_to(50) |
dimmer.dim_to(50) |
MIT License