The business logic package for Shelly Manager.
Contains the core business logic that defines how Shelly Manager works. Framework-agnostic and can be used by any interface (CLI, API, Web).
- Domain models for Shelly devices and operations
- Business rules for device management
- Use cases that orchestrate operations (scan, update, reboot)
- Component action discovery and execution use cases
- Gateway contracts for external dependencies
- No dependencies on frameworks, databases, or UI
Follows Clean Architecture principles:
packages/core/src/core/
├── domain/ # Core business logic
│ ├── entities/ # Business objects (ShellyDevice)
│ ├── value_objects/ # Immutable data objects
│ ├── services/ # Domain business logic
│ └── enums/ # Domain enumerations
├── use_cases/ # Application business logic
│ ├── scan_devices.py # Device discovery
│ ├── update_device_firmware.py
│ ├── reboot_device.py
│ ├── execute_component_action.py # Component action execution
│ ├── get_component_actions.py # Component action discovery
│ └── ...
├── gateways/ # External interfaces (abstract)
│ ├── device/ # Device communication contracts
│ ├── configuration/ # Configuration management contracts
│ └── network/ # Network communication contracts
└── settings.py # Configuration and utilities
Dependencies point inward - the domain layer knows nothing about external concerns.
# Install core package only
uv sync --package shelly-manager-core
# Or install with dev dependencies
uv sync --package shelly-manager-core --extra devimport asyncio
from core.domain.entities.shelly_device import ShellyDevice
from core.domain.value_objects.scan_request import ScanRequest
# Create a Shelly device
device = ShellyDevice(
ip="192.168.1.100",
device_type="shelly1pm",
device_name="Living Room Light"
)
print(f"Device: {device.device_name} at {device.ip}")
print(f"Status: {'Online' if device.is_online() else 'Offline'}")
# Create a scan request
scan_request = ScanRequest(
start_ip="192.168.1.1",
end_ip="192.168.1.10"
)
print(f"Scanning {scan_request.get_ip_count()} IP addresses")- Main Documentation: ../../README.md
- Development Guide: ../../DEVELOPMENT.md
- API Package: ../api/README.md (implements Core interfaces)
- CLI Package: ../cli/README.md (uses Core use cases)