Skip to main content

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-безопасность и удобный API
  • ControllerCreator — фабрика создания контроллеров по имени модели (см. 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/

📦 Добавление нового контроллера

  1. Реализуй YourControllerDI и YourControllerRelay, наследуя DIInterface, RelayInterface
  2. Создай YourController, в котором:
self.interface = ControllerInterface(di_interface=..., relay_interface=...)
  1. Добавь контроллер в AVAILABLE_CONTROLLERS в controller_factory.py

📁 Структура

controllers_super.py          # Базовые интерфейсы
controllers/                  # Реализации контроллеров
controller_operator.py        # Обёртка ControllerOperator ✅
controller_factory.py         # AVAILABLE_CONTROLLERS + фабрика ✅
exceptions.py                 # Кастомные исключения ✅
tests/                        # Тесты
README.md

🤝 Контакты

Проект поддерживается Артуром (PunchyArchy, Qodex)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gravity_controller_operator-2.3.0.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gravity_controller_operator-2.3.0-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

Details for the file gravity_controller_operator-2.3.0.tar.gz.

File metadata

File hashes

Hashes for gravity_controller_operator-2.3.0.tar.gz
Algorithm Hash digest
SHA256 5e7af2c34ecb722d21854c7b2c835f993818e1e3bc3e9b2ddaa83f9c8532420e
MD5 59c1b407ecfa224e6730ae47663f197e
BLAKE2b-256 c77708fb444aa451d00df1a70b5d44bf9b5683c39ffca24be547760a34756dbc

See more details on using hashes here.

File details

Details for the file gravity_controller_operator-2.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for gravity_controller_operator-2.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dde8ec9d646db52420b288b5d9d065b66546f73dfa1fe72dd6f2f5f9a8b783b1
MD5 a56b77c5ada3b2d9c5c60e8f83f6ea96
BLAKE2b-256 34102d118abffab0f7476e98b9f25493ee109e46efb201d12d079b3a93f398e1

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.3.0 This release

2 files

2.2.5

1 file

2.2.4

1 file

2.2.3

1 file

2.2.2

1 file

2.2.1

1 file

2.2.0

1 file

2.1.8

1 file

2.1.7

1 file

2.1.6

1 file

2.1.5

1 file

2.1.4

1 file

2.1.3

1 file

2.1.2

1 file

2.1.1

1 file

2.1.0

1 file

2.0.9

1 file

2.0.8

1 file

2.0.7

1 file

2.0.6

1 file

2.0.5

1 file

2.0.4

1 file

2.0.3

1 file

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

1.3.7

1 file

1.3.6

1 file

1.3.3

1 file

1.3.2

1 file

1.3.1

1 file

1.3.0

1 file

1.2.8

1 file

1.2.7

1 file

1.2.6

1 file

1.2.5

1 file

1.2.4

1 file

1.2.3

1 file

1.2.2

1 file

1.2.1

1 file

1.2.0

1 file

1.1.0

1 file

1.0.13

1 file

1.0.12

1 file

1.0.11

1 file

1.0.1

1 file

1.0.0

1 file

0.1.23

1 file

0.1.22

1 file

0.1.21

1 file

0.1.2

1 file

0.1.1

1 file

0.1.0

1 file

0.0.1

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page