Giter Club home page Giter Club logo

python-gc100's Introduction

python-gc100

This is a Python-based socket client for Global Cache GC100 digital I/O interface

The global cache GC100 features an array of digital inputs / IR outputs (switchable), serial ports, and solid state relays, accessible via a TCP interface.

More info can be found at the manufaturer's website: https://www.globalcache.com/products/gc-100/

python-gc100 provides a TCP client to interface with a GC100.

Currently serial port communication and IR functions are not supported. Digital input (including notification mode) and changing relay state are supported.

Usage

Given a callback function

>>> def callback_fn(state):
>>>   print(state)

Initialize the connection to the socket server

>>> hostname = 'myserver'
>>> port = 4998
>>> gc = gc100.GC100SocketClient(hostname,port)

Example, if you want to read and print the state of module address '4:1':

>>> gc.read_sensor('4:1', callback_fn)

Or turn the relay on at address '3:2', and confirm its new state:

>>> gc.write_switch('3:2', 1, callback_fn)

Turn it off again:

>>> gc.write_switch('3:2', 0, callback_fn)

If you want to subscribe to be notified (push) of state changes to digital input '4:3':

>>> gc.subscribe_notify('4:3', callback_fn)

Close the connection

>>> gc.quit()

Compatibility

This module is only tested with Python 3.5.2, and will definitely not be compatible with python 2.x

Author and License

This software is (c) 2017 David Grant <[email protected]>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

GC100 is a trademark of Global Cache, with whom the author of this software is not affiliated in any way other than using some of the their hardware

python-gc100's People

Contributors

davegravy avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

brettahale

python-gc100's Issues

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.