GreenPonik WaterPump i2c driver
Reason this release was yanked:
get errors
Project description
GreenPonik_WaterPump_Driver.py Library for Raspberry pi
This is the python side driver to manage GreenPonik WaterPump devices
Table of Contents
- GreenPonik_WaterPump_Driver.py Library for Raspberry pi
- Table of Contents
- Installation
- Methods
- Examples
- Credits
Installation
> git clone https://github.com/GreenPonik/GreenPonik_WaterPump_Driver.git
cd GreenPonik_WaterPump_Driver
pip3 install -r requirements.txt
or
> pip3 install greenponik-waterpump-driver
from GreenPonik_WaterPump_Driver import i2c_scanner, read_byte_data
Methods
def i2c_scanner():
"""
@brief i2c Scanner use to return the list of all addresses find on the i2c bus
@return list of addresses
"""
def read_byte_data(addr, register):
"""
@brief read byte data from the device
@param addr > byte i2c address of the device
@param register > byte i2c register to read
@return byte
"""
def write_byte_data(addr, register, value):
"""
@brief write byte data on the device
@param addr > byte i2c address of the device
@param register > byte i2c register to write
"""
def read_block_data(addr, register, size = 8):
"""
@brief read block byte data from the device
@param addr > byte i2c address of the device
@param register > byte i2c register to read
@param size > byte size of block read from i2c bus
@return list
"""
def write_block_data(addr, register, data):
"""
@brief write block byte data on the device
@param addr > byte i2c address of the device
@param register > byte i2c register to write
@param data > array of bytes to be send through i2c bus
"""
def pump_run(addr, register, command):
"""
@brief command pump
@param addr > byte i2c address of the pump
@param register > byte i2c register of the pump
@param command > byte order 0x00 = OFF / 0x01 = ON
"""
Example
from time import sleep
from GreenPonik_WaterPump_Driver import i2c_scanner, read_byte_data, read_block_data
if __name__ == "__main__":
try:
while True:
i2c_devices = i2c_scanner()
for device in i2c_devices:
if I2C_DEVICES_TYPE['WATERPUMP'] != read_byte_data(device, I2C_REGISTERS['TYPE']:
raise Exception("Current device is not a WaterPump")
else:
UUID = read_block_data(device, I2C_REGISTERS['UUID'])
print("Device UUID: %s" % UUID)
sleep(0.5)
sleep(2)
except Exception as e:
print("Exception occured", e)
Credits
Write by Mickael Lehoux, from GreenPonik, 2019
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for greenponik-waterpump-driver-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97da1e9773607122a379b83ec45690148982c78e4196c2a2001ca8d05e3d039c |
|
MD5 | 32d2b6224401656ca5805e77f52e5d99 |
|
BLAKE2b-256 | 9da82b39aaddeb5bd200b4179b90177e8443274dae68cd31d7fbc98ba72a5ba7 |
Close
Hashes for greenponik_waterpump_driver-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c69fa5ea567bb5937b2f67eaa7d5a22e25a0f539be531611b1a12c7fef65932a |
|
MD5 | 693e2c3491fa3e86323d6fdbb1273744 |
|
BLAKE2b-256 | be50bae8cb39ffb020856ad834e4dc736b02ef94af7c989910323e309704f56e |