All Magic Methods Implement. You can easyly to implement all magic methods or part of them
Project description
Description
Version: 0.0.1 python 2.x,3.x
Project easy Modbus.
In this package you can connect in TCP, RTU or ASC mode in modbus usign a mask to collect everything from your device
Donate
PIX: +55 31 99101-8619
Contact
URL: http://estaleiroweb.com.br
GIT: https://github.com/estaleiroweb/emodbus
Instalation
pip install emodbus
Upgrade
pip install emodbus -upgrade
Use
import emodbus as emb
# connect to bus of devices
tcp = emb.ConnTCP('192.168.1.45')
rtu = emb.ConnRTU('COM4')
# define default MIB
# {name: (Address:int,functionCode:int,callbackFunction_modbustype:'None|str|tuple|list'),....},
addrs = {
'Temperature': [1, 4, ('Dec', {'dec': 1})],
'Humidy': [2, 4, ['Dec', {'dec': 1}]],
'TemperatureRaw': [1, 4],
'HumidyRaw': [2, 4],
}
emb.Conn.defSlave(1, addrs)
# Read MIB of any slave of the connection
print('TCP MIB Slave 1', tcp.slave(1)(), sep=':')
print()
# define MIB of connection/slave
tcp.slave(1, addrs)
# read all MIB
slaves = [1]
for slave in slaves:
print('Read All Slave ', slave)
print('TCP',tcp.read(slave), sep=':')
print('RTU',rtu.read(slave), sep=':')
print()
# read only some address
addr = ['Temperature', 'xxxxxxxxxx', 'Humidy']
for slave in slaves:
print('Read Slave '+str(slave), addr, sep=':')
print('TCP',tcp.read(slave, addr), sep=':')
print('RTU',rtu.read(slave, addr), sep=':')
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file emodbus-0.0.5-py3-none-any.whl.
File metadata
- Download URL: emodbus-0.0.5-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
adfe42bbd4851cb9b5c1f2c17e55bef5a9bc54d6ede8b177d8552f66bf52c436
|
|
| MD5 |
8c0d38db000cb9302bf4439ac9a4b961
|
|
| BLAKE2b-256 |
e4a163fd9c0ce295aa3e34418a3c5cbeee1ec2c815243a4f407a27e2749c5b44
|