Metadata-Version: 2.4
Name: secontrol
Version: 0.2.0
Summary: Space Engineers Redis helper utilities
Author: secontrol contributors
License: MIT License
        
        Copyright (c) 2024 secontrol contributors
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://www.outenemy.ru/se
Project-URL: Repository, https://github.com/rootfabric/secontrol
Project-URL: Issues, https://github.com/rootfabric/secontrol/issues
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: redis>=4.5
Requires-Dist: python-dotenv>=1.0
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: twine>=4.0; extra == "dev"
Dynamic: license-file

# secontrol

`secontrol` is a high-level client for interacting with the Space Engineers Redis gateway. The library simplifies obtaining telemetry, sending commands, and implementing automations using persistent subscriptions to key events.

## Features

- Connecting to Redis using configuration from `.env` or constructor arguments.
- Monitoring keys and channels with automatic subscription recovery.
- Utilities for obtaining owner, player, and grid identifiers.
- Examples demonstrating command publishing and state monitoring.

## Installation

```bash
pip install secontrol
```

## Quick Start

```python
from secontrol.common import prepare_grid

# First player's grid
grid = prepare_grid()
# Devices on the grid
print(", ".join((d.name or f"{d.device_type}:{d.device_id}") for d in grid.devices.values()) or "(no devices)")

```

### Environment Variables

| Variable         | Purpose                                               |
| ---------------- | ----------------------------------------------------- |
| `REDIS_USERNAME` | Username for authorization.                           |
| `REDIS_PASSWORD` | Password for connection.                              |

Variables can be defined in the `.env` file in the project or system root.
Variable values must be obtained in the personal account on the page https://www.outenemy.ru/se/

## Examples

Ready-made scripts are located in the [`examples/organized`](examples/organized) directory, organized by device type and complexity level:

- `basic/` - Basic examples for getting started
  - `basic/` - Simple introductory examples
  - `intermediate/` - Moderately complex examples
  - `advanced/` - Complex examples with advanced features

- `lamp/` - Examples for controlling lamp devices
  - `basic/` - Simple lamp control examples
  - `intermediate/` - More complex lamp automation
  - `advanced/` - Advanced lamp control with complex logic

- `container/` - Examples for managing container devices
  - `basic/` - Simple container operations
  - `intermediate/` - Container inventory management
  - `advanced/` - Complex inventory tracking and transfers

- `assembler/` - Examples for controlling assembler devices
  - `basic/` - Simple production commands
  - `intermediate/` - Queue management and monitoring
  - `advanced/` - Complex production workflows

- `rover/` - Examples for controlling rover devices
  - `basic/` - Simple rover movement
  - `intermediate/` - Wheel control and steering
  - `advanced/` - Complex rover automation

- `display/` - Examples for controlling display devices
  - `basic/` - Simple display content
  - `intermediate/` - Dynamic content updates
  - `advanced/` - Complex graphics and animations

- `grid/` - Examples for grid-level operations
  - `basic/` - Grid information and listings
  - `intermediate/` - Grid resource management
  - `advanced/` - Grid damage tracking and advanced operations

- `ai/` - Examples for AI automation
  - `basic/` - Simple AI tasks
  - `intermediate/` - AI behavior control
  - `advanced/` - Complex AI automation

- `refinery/` - Examples for controlling refinery devices
  - `basic/` - Simple refinery operations
  - `intermediate/` - Priority and queue management
  - `advanced/` - Complex refinement workflows

- `radar/` - Examples for radar and detection devices
  - `basic/` - Simple detection
  - `intermediate/` - Radar telemetry processing
  - `advanced/` - Complex detection and visualization

- `inventory/` - Examples for inventory management
  - `basic/` - Simple inventory operations
  - `intermediate/` - Inventory tracking
  - `advanced/` - Complex inventory automation and transfers

To run an example:

## Wiki
https://github.com/rootfabric/secontrol/wiki/home

## License

The project is distributed under the MIT license. See the [LICENSE](LICENSE) file.
