SDK предоставляющий универсальный интерфейс для работы со многими промышленными контроллерами ввода-вывода (количество расширяемо)
Project description
Gravity Controller Operator
Модуль для унифицированной работы с промышленными контроллерами (реле, дискретные входы и т.д.). Позволяет взаимодействовать с различными устройствами через единый интерфейс.
🚀 Поддерживаемые контроллеры
- EmulatorController — заглушка для тестов
- ARMK210Controller — Modbus TCP
- WBMR6LV — Modbus RTU
- NetPing2Controller — HTTP API
- Sigur — доступ через TCP (СКУД)
- MoxaE1214 — REST API (vdn.dac.v1)
🧩 Архитектура
🧠 Интерфейсы:
DIInterface: чтение дискретных входовRelayInterface: чтение/управление релейными выходамиControllerInterface: объединяет оба
Все интерфейсы наследуют SoftStateMixin, в котором реализовано хранение состояния точек (state, changed, addr).
🛠 Контроллер
Каждый контроллер реализует:
self.interface = ControllerInterface(di_interface=..., relay_interface=...)
🧪 Обёртки:
ControllerOperator— отвечает за автоматическое обновление, mutex-безопасность и удобный APIControllerCreator— фабрика создания контроллеров по имени модели (см.controller_factory.py)
🧪 Как использовать
from gravity_controller_operator.controllers.moxa import MoxaE1214
from gravity_controller_operator.controller_operator import ControllerOperator
moxa = MoxaE1214("192.168.60.103")
operator = ControllerOperator(moxa)
print(operator.get_points())
operator.change_relay_state(0, 1) # включить реле 0
🔬 Тестирование
Установка:
pip install pytest
Запуск:
pytest gravity_controller_operator/tests/
📦 Добавление нового контроллера
- Реализуй
YourControllerDIиYourControllerRelay, наследуяDIInterface,RelayInterface - Создай
YourController, в котором:
self.interface = ControllerInterface(di_interface=..., relay_interface=...)
- Добавь контроллер в
AVAILABLE_CONTROLLERSвcontroller_factory.py
📁 Структура
controllers_super.py # Базовые интерфейсы
controllers/ # Реализации контроллеров
controller_operator.py # Обёртка ControllerOperator ✅
controller_factory.py # AVAILABLE_CONTROLLERS + фабрика ✅
exceptions.py # Кастомные исключения ✅
tests/ # Тесты
README.md
🤝 Контакты
- 📧 Email: ksmdrmvstchny@gmail.com
- 💬 Telegram: @PunchyArchy
- 📞 Phone: +7 996 294-75-95
Проект поддерживается Артуром (PunchyArchy, Qodex)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gravity_controller_operator-2.2.3-py3-none-any.whl.
File metadata
- Download URL: gravity_controller_operator-2.2.3-py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc039618014c7b3030f8beb71ed8b73d83bc6d569f0f2b5385fc626d4504b039
|
|
| MD5 |
1e42aaa53ef7a6432168520f5dbbf5e0
|
|
| BLAKE2b-256 |
e66d6c46b358f820c8d4bd48bf86aceb5ed4c9ec0c0f2e5bfd237271bc478977
|