Skip to main content

Cooper Gateway

Project description

Cooper Control Tool

Travis Release License PyPI

This is the Gateway tool for cooper dongle

Installing

You can install cpgw directly from PyPI:

sudo pip3 install -U cpgw

Note: You may need to use sudo before the command - it depends on the operating system used...

Config

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

As cli tool

cpgw -c /etc/cooper/cpgw.yml

Systemd

Insert this snippet to the file /lib/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

PM2

pm2 start `which python3` --name "cpgw" -- `which cpgw` -c /etc/cooper/cpgw.yml

As library

from cpgw.gateway import Gateway

def 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 - see the LICENSE file for details.

Project details


Download files

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

Source Distribution

cpgw-1.5.0.tar.gz (6.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page