Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hardwario/cpgw
COOPER Gateway Service
https://github.com/hardwario/cpgw
iot multisensor python usb zeromq
Last synced: 9 days ago
JSON representation
COOPER Gateway Service
- Host: GitHub
- URL: https://github.com/hardwario/cpgw
- Owner: hardwario
- License: mit
- Created: 2018-09-11T08:05:52.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-09-25T09:19:03.000Z (about 3 years ago)
- Last Synced: 2024-09-29T09:25:50.098Z (about 2 months ago)
- Topics: iot, multisensor, python, usb, zeromq
- Language: Python
- Homepage:
- Size: 36.1 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# COOPER Control Tool
[![Travis](https://img.shields.io/travis/hardwario/cpgw/master.svg)](https://travis-ci.org/hardwario/cpgw)
[![Release](https://img.shields.io/github/release/hardwario/cpgw.svg)](https://github.com/hardwario/cpgw/releases)
[![License](https://img.shields.io/github/license/hardwario/cpgw.svg)](https://github.com/hardwario/cpgw/blob/master/LICENSE)
[![PyPI](https://img.shields.io/pypi/v/cpgw.svg)](https://pypi.org/project/cpgw/)This is the Gateway tool for cooper dongle
## Installation
You can install **cpgw** directly from PyPI:
```sh
sudo pip3 install -U cpgw
```> Note: You may need to use `sudo` before the command - it depends on the operating system used...
## Configuration
Insert this snippet to the file /etc/cooper/cpgw.yml:
```
device: /dev/ttyUSB0
zmq:
publisher:
host: 127.0.0.1
port: 5680
dispatcher:
host: 127.0.0.1
port: 5681
```## Usage
```sh
cpgw -c /etc/cooper/cpgw.yml
```### Start using systemd
Insert this snippet to the file `/etc/systemd/system/cpgw.service`:
```
[Unit]
Description=COOPER cpgw
After=network.target[Service]
Type=simple
User=pi
ExecStart=/usr/local/bin/cpgw -c /etc/cooper/cpgw.yml
Restart=always
RestartSec=5
StartLimitIntervalSec=0[Install]
WantedBy=multi-user.target
```Start the service:
systemctl start cpgw.service
Enable the service start on boot:
systemctl enable cpgw.service
View the service log:
journalctl -u cpgw.service -f
### Start using PM2
```sh
pm2 start `which python3` --name "cpgw" -- `which cpgw` -c /etc/cooper/cpgw.yml
```### Usage as Python module
```python
from cpgw.gateway import Gatewaydef on_recv(payload):
print(payload)gw = Gateway("/dev/ttyUSB0")
gw.on_recv = on_recv
gw.run()```
## License
This project is licensed under the [**MIT License**](https://opensource.org/licenses/MIT/) - see the [**LICENSE**](LICENSE) file for details.