GreenPonik WaterPump i2c driver
Reason this release was yanked:
not work
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
"""
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
"""
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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 294cbcd193d8289b621f4d61064c2fe099368acbbce4934ad82e8a1127b9676f |
|
MD5 | c55efa86fdf37be11511952f2e8a9bad |
|
BLAKE2b-256 | 053729f94e3e0772fdfe84d76f0b6e569c2b199f2dcee0903d0ed91f5696e4d9 |
Close
Hashes for greenponik_waterpump_driver-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 362492d75c29a4cff92cf9715f2745108637008c07106507c7c1a1784dfe4d45 |
|
MD5 | ecf55d2ab9039e1554dc76ebc19b8c20 |
|
BLAKE2b-256 | bc3c185cb456ca8ee54472ca890c5821b00974eeeacc287d955d89431adff701 |