Coder Social home page Coder Social logo

cpgw's Introduction

COOPER Control Tool

Travis Release License PyPI

This is the Gateway tool for cooper dongle

Installation

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...

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

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

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

Usage as Python module

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.

cpgw's People

Contributors

blavka avatar worepix avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

cpgw's Issues

Decimal is not JSON Serializable with pyzmq==22.2.1

Hello Hardwario Team,

with a new installation of the cpgw, the pyzmq version 22.2.1 was pulled. The socket.send_json(payload) from app.py throws the Decimal not JSON Serializable error. I bypassed the issue by downgrading pyzmq, so it is not blocking, just so you are aware of this issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.