Saravanan666/pypi-org huggingface dataset:
Package: modbus2websocket
Modbus2WebsocketModbus2Websocket (further, M2W) is an python-based application that routes data between Modbus TCP protocol and Websockets.PurposeThe main goal of M2W router is to deliver data between industrial system and web application. Modbus TCP - industrial protocol, used to exchange information between industrial devices and HMIs. Usually, to visualize data engineers have to use heavy and expensive SCADA or HMI. On other hand web technologies provide easy and powerful tools for data visualization in your own web browser, without any thick client. That is why M2W was created in first place - to make simple webHMI server that works with Industrial systems.Componentsasync Modbus TCP serverasync_modbus_server.pyasync Modbus TCP clientasync_modbus_client.pyasync Websocket serverasync_websocket_server.pyRouterrouter.pyWhat it supportsReading Input Registers, Digital Inputs, Coils and Holding Registers$Sending to the websocket client.Future development:Async Modbus ServerAsync Modbus ClientAsync Websocket ServerRouterHtml example pageDatabase connectionInstallation stepsModule installationDetailsCreating appExampleModbus detailsInstallationModule installationModbus2websocket library installs with pip:pip install modbus2websocketDetailsBefore creating you application you have to specify following:Websocket server IP, for example, 192.168.220.10Websocket port, by default, it is 8888Modbus/TCP server's IP, for example, 192.168.220.5Modbus serverIf you don't have running Modbus/TCP server, you can use server simulator.Creating appClass Router will manage data between Modbus/TCP and websockets client, that runs in your browserfrommodbus2websocket.routerimportRouterRouter has two public methods:Router.add_modbus_reg()- that adds registers you want to readRouter.run()- that runs router.You should add registers that you want to read, as a list of dictionaries.
Structure of single registers looks like that:Input_register_1={'ir':{'adr':0,'num':1,'name':'Input Register 1',},},Where:ir- registers type. (seeModbus details).adr- regsiter's address. It starts from 0 to 65535.num- number of registers to read. It is limited between 1 to 2000.name- unique name for your register.Examplefrommodbus2websocket.routerimportRouterif__name__=='__main__':ws_ip='192.168.220.10'# websocket ip addressws_port=8888# websocket portmodbus_ip='192.168.220.5'# Modbus ip addressrouter=Router(ws_ip,ws_port,modbus_ip)# Modbus registers to readregs=[{'ir':{'adr':0,'num':1,'name':'Reg1',},},{'hr':{'adr':1,'num':1,'name':'Reg2',},},{'ir':{'adr':2,'num':1,'name':'Reg3',},},]router.add_modbus_reg(regs)router.run()Modbus detailsRegisters typeShort nameDescriptionDigital InputDIRead only, bool, 1-bitInput RegisterIRRead only, float/int, 16-bitCoilCRead/write, bool, 1-bitHolding registerHRRead/write, float/int, 16-bit
Package: modbusclc
ModbusCLC (Modbus Command Line Client)ModbusCLCis simple but useful.ConceptFreeShowing beautifyFeaturesUser defined data template about data typesInstallation$pipinstallmodbusclcor$gitclonehttps://github.com/RavenKyu/modbus-command-line-client.git
$cdmodbus-command-line-client
$pythonsetup.pyinstallRunning$python-mmodbusclcRunning Dummy Modbus Server with dockerIf you use docker, you can try it like below.Build$dockerbuild-fdummy-modbus-server/Dockerfile-tdummy-modbus-server:latest.or$docker-composebuilddummy-modbus-serverRunningDummy-Modbus-Server Start ...$dockerrun--rm-d-p502:502dummy-modbus-server:latestor$docker-composerun--rmdummy-modbus-serverConnect to Dummy Server with ModbusCLCModbusCLCis set default the address as localhost and port as 502.python-mmodbusclcSampleThere is a simple sample data you can read withread holding register. (versionv0.3.0)Things you can doHelpAll most each menu can show its help message or usage.(Cmd)helpDocumentedcommands(typehelp<topic>):========================================exithelpread_holding_registerRead Holding Register(Cmd)read_holding_register-h
usage:read_holding_register[-h][-tTEMPLATE][-aADDRESS][-pPORT][-iUNIT_ID][-fFIRST_REGISTER][-cCOUNT]optionalarguments:-h,--helpshowthishelpmessageandexit-tTEMPLATE,--templateTEMPLATEtemplatename-aADDRESS,--addressADDRESShostaddress-pPORT,--portPORTport-iUNIT_ID,--unit-idUNIT_IDunitid-fFIRST_REGISTER,--first-registerFIRST_REGISTERfirstregisteraddress-cCOUNT,--countCOUNTnumberofregisters(Cmd)read_holding_register-alocalhost-p502-c20-tsample2020-10-0423:39:00|request|192.168.200.124>000000142020-10-0423:39:00|respose|localhost:502>28556e697432332d41fffffc19fffffffa80000000437ee2c6420ac326427d7aeb41070e38ffff0007datatyperegbytesvaluenote
----------------------------------------------------------------------------
64bsting40001556e697432332d41Unit23-Atextlabel
16buint40005ffff6553516bitunsignedinteger
16bint40006fc19-99916bitinteger
32buint40007fffffffa429496729032bitunsignedinteger
32bint4000980000000-214748364832bitinteger
32bfloat40011437ee2c6254.8858337402343832bitfloat
32bfloat40013420ac32634.69057464599609432bitfloat
32bfloat40015427d7aeb63.3700370788574232bitfloat
32bfloat4001741070e388.44097137451171932bitfloat
8buint40019ff2558bitunsignedint
8bint40019ff-18bitint8bits400200000000008bitsBoolean8bits400200700001118bitsBoolean(Cmd)TemplateTemplateis very useful function of this program. The file format is yaml.Template file name is alwaystemplates.ymlThis is the sample template for data above.---sample:-note:text labeldata_type:B64_STRING-note:16 bit unsigned integerdata_type:B16_UINT-note:16 bit integerdata_type:B16_INT-note:32 bit unsigned integerdata_type:B32_UINT-note:32 bit integerdata_type:B32_INT-note:32 bit floatdata_type:B32_FLOAT-note:32 bit floatdata_type:B32_FLOAT-note:32 bit floatdata_type:B32_FLOAT-note:32 bit floatdata_type:B32_FLOAT-note:8 bit unsigned intdata_type:B8_UINT-note:8 bit intdata_type:B8_INT-note:8 bits Booleandata_type:BIT8-note:8 bits Booleandata_type:BIT8
Package: modbus-configuretools-xzf8971
temperature_sensor_readerThis is a temperature sensor package designed for modbus. Implemented in pymodbus only. PyPI website:https://pypi.org/project/modbus-configuretools-xzf8971/Installfrom pypi:pipinstallmodbus-configuretools-xzf8971from github:pip install git+https://github.com/xzf89718/temperature_sensor_readerJiandarenke modbus RS485 as exampleBefore run scriptsCheck the COM and chmodchmod666\dev\ttyUSBxImport modulesfrommodbus_configuretoolsimporttemperature_sensor.RS485_JiandarenkeasRS485_JDRKfrommodbus_configuretoolsimporttemperature_sensor.JDRKAddressConfigasConfigConfigure parameters for Jiandarenke RS485 sensorIt's OK to set None for unkown value# Modify these config values# Please configure these value in temperature_sensor before read or write values# SLAVEID must be specified. If SLAVEID is none, set to 1# ADDRESS_HUMIDITY = 0x0000# ADDRESS_TEMPERATURE_DEW_POINT = 0x0001# ADDRESS_TEMPERATURE = 0x0002# ADDRESS_TEMPERATURE_CALI = 0x0050# ADDRESS_HUMUDITY_CALI = 0x0051# ADDRESS_SLAVEID = 0x07D0# ADDRESS_BAUDRATE = 0x07D1# TEMPERATURE_CALI = 164# HUMIDITY_CALI = 7# SLAVEID = 1# BAUDRATE = 1myconfig=Config(ADDRESS_HUMIDITY,ADDRESS_TEMPERATURE_DEW_POINT,ADDRESS_TEMPERATURE,ADDRESS_SLAVEID,ADDRESS_BAUDRATE,ADDRESS_TEMPERATURE_CALI,ADDRESS_HUMUDITY_CALI,TEMPERATURE_CALI,HUMIDITY_CALI,SLAVEID,BAUDRATE)Calibration of sensor. Not necessary calibration every timesensor.CalibrationJiandarenke(myconfig)Set slaveID and baudratePlease make sure only 1 sensor connect to the modbus bussensor.WriteSlaveIDAndBaudrate(myconfig)Init and read measured values from sensor# Create a wrapper for JDRK sensorsensor=RS485_JDRK(port="/dev/ttyUSB0")# Init and connect clientsensor.InitClient()# Read slaveID and baudrateslaveID,baudrate=sensor.ReadSalveIDAndBaudrate(myconfig)# Read temperature, dew point, humidity in one request# Only correct for specified sensortemperature,dew_point_temperature,humidity=sensor.ReadTemperatureAndHumidity(myconfig)# Read temperature onlytemperature=sensor.ReadTemperature(myconfig)# Read dew point temperaturedew_point_temperature=sensor.ReadTemperatureDewPoint(myconfig)# Read humidity onlyhumidity=sensor.ReadTemperature(myconfig)Close the sensorsensor.close()
Package: modbus-connect
Modbus Connect package for PythonModbus Connect is a Python package that provides a configurable Modbus TCP data adquisition library from Modbus TCP devices. It is designed to be used as a library for a data acquisition application, managing the connection to the devices and the data exchange with them. The data is returned in a format that can be easily used for sending to a database or MQTT broker.The Modbus data table can be supplied as a csv file or as a Python dictionary. A dictionary is used to configure the Modbus Gateway. The dictionary can be created manually or by using the importer module from a csv file.It is based on thePyModbusfor the Modbus TCP communication.Themodbus-mqtt-digital-twinpackage provides a data acquisition application that uses the Modbus Gateway library. (Under development)InstallationThe package can be installed from PyPI:pipinstallmodbusUsageFor a complete example of the usage of the package, check the examples folder.Here is a simple example of the usage of the package:frommodbus_gatewayimportModbusGateway# Create a dictionary with the configuration of the Modbus Gatewayconfig=[{"name":"var1","address":0,"memory_bank":utils.MemoryBanks.HOLDING_REGISTERS,"datatype":"float32",},{"name":"var2","address":2,"memory_bank":utils.MemoryBanks.HOLDING_REGISTERS,"datatype":"float32",},]gateway=ModbusGateway(host=<host>,port=<port>,tags_list=config,)# Read the values from the modbus servervalues=gateway.read_tags()print(values)This behaviour can be easly used for continuous data adquisition using rocktry or any other scheduler and fastly deploied using docker.LicenseMITContributingPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Please make sure to update tests as appropriate.AuthorsÁngel Fernández Sobrino-AngelFernandezSobrino
Package: modbus-crc
Modbus CRC-16CRC-16 calculation library for Modbus protocolInstallationInstall it with pip:$pipinstallmodbus-crcOr you can add it as dependency in requirements.txt file of your python application:modbus-crc~=1.3UsageFor signing byte package useadd_crc:frommodbus_crcimportadd_crcsigned_package=add_crc(b'\x00\x12\x34\xAB\xCD\xEF')Result isb'\x00\x12\x34\xAB\xCD\xEF\xD2\xD4. For validation signed package usecheck_crc:frommodbus_crcimportcheck_crcifnotcheck_crc(b'\x00\x12\x34\xAB\xCD\xEF\xD2\xD4'):raiseSomeException()Testing$python-munittestdiscover-v-p"tests.py"
Package: modbus-query
Queries Modbus registers and handles printing the values to the terminal or a log file, as well as storing the values into a CSV file.Installation:
1. Install python.
2. To install the package locally, first create a virtual environment.
3. Install the package using “pip install modbus-query”.
4. Run the package using “modbus-query”.The package is configured through its config.yaml file, and it can be configured to create a .csv and .log file each time the app is run.
The .csv, .log, and config.yaml files are located in an OS-specific data folder. On Windows, this location is “%LocalAppData%ModbusQuery”.
Package: modbus-scanner
Modbus ScannerFor RTU mode, you need to specify the serial port and baud rate.modbus_scanner -r 0 -f 3 -i 1 -e 10 -c rtu -h COM9 -b 9600 -s 1 -d 8 -p N -t 10ORFor TCP mode, you need to specify a host and port.modbus_scanner -r 0 -f 3 -i 1 -e 10 -c tcp -h 192.168.1.10 -l 502--register or -r : Register number to start scanning from.Default is 0.--fc or -f : Function code to use.Default is 3.--start or -i : Starting address to scan from.Default is 1.--end or -e : Ending address to scan to.Default is 254.--conn_type or -c : Connection type to use.Default is rtu.--device or -h : Device to connect to.(Required).Note: For RTU mode, this is the serial port. For TCP mode, this is the IP address.--port or -l : Port to connect to.Default is 502.--baud or -b : Baud rate to use.Default is 9600.--stop or -s : Stop bits to use.Default is 1.--data or -d : Data bits to use.Default is 8.--parity or -p : Parity to use.Default is N.--timeout or -t : Timeout to use.Default is 60.
Package: modbus_server
modbus_serverA ModbusTCP server implementation in pure Python.Installationpipinstallmodbus_serverMinimal Exampleimportmodbus_servers=modbus_server.Server(port=5020)s.start()s.set_coil(1,True)FunctionsServer Objects = modbus_server.Server(host='localhost', port=502, datastore=None, loglevel="INFO", autostart=False)Initializes a Server instance. If thedatastoreis not explicitly given, an emptyDictDatastoreis instantiated and used.s.start()s.stop()Start and stop the server thread which accepts requests. The thread does not block the main thread, but it prevents the program from exiting until s.stop() is called.Set Coils and Discrete Inputset_coil(address, value)set_discrete_input(address, value)Set the coil or discrete_input ataddresstovalue. This function can only process one value.set_coils(start_address, values)set_discrete_inputs(start_address, values)Set Input and Holding Registersset_input_register(address, value, encoding)set_holding_register(address, value, encoding)Set the input or holding register ataddresstovalueusingencoding. This function can only process one value.set_input_registers(start_address, values, encoding)set_holding_registers(start_address, values, encoding)Datastore ObjectThe modbus_server pulls the data it serves from adatastore. The simplest datastore is just a dictionary that is filled from the Server object using the variousset_-functions described below. In that case, the data needs to be ingested directly in the program that starts the server as in the minimal example above.datastore = modbus_server.DictDatastore()An alternative is using redis to hold the data. That way, other processes in the system can change the data in the datastore and the modbus_server always has up to data from e.g. a measurement process. In order to link keys in redis with modbus object references (coil, discrete input, input register, and holding register) and addresses, the RedisDatastore object uses amodbus_address_map, a dictionary that follows a special convention.datastore = modbus_server.RedisDatastore(modbus_address_map={}, redis_host="localhost", redis_port=6379, redis_db=0)Development:For testing, install a symlink to the package in the python environment using flit:flitinstall.-s
Package: modbus-tcprtu
modbus_tcprtuA ModbusRTU Over TCP/IP library, depends on modbus_tk. It's often use with 485-to-TCP converter.# must install modbus_tkimportmodbus_tk.definesascstfrommodbus_tcprtuimportTcpRtuMaster# create a mastermaster=TcpRtuMaster(host='127.0.0.1',port=9001)master.set_timeout(2)foriinrange(10):# read data from modbus# just use as modbus_tk.Masterprint(i,master.execute(1,cst.READ_HOLDING_REGISTERS,0,i+1))CHANGES1.0.0First version
Package: modbus-tcp-server
modbus-tcp-serverA thread-based MODBUS TCP server for testing purposes.InstallationJust typepipinstallmodbus-tcp-serverAnd to run itmodbus-tcp-server127.0.0.1502Port is optional, it will be assumed to be 502 by default.Just run it without any arguments to see the command line.If you want verbosity, you can drop-vor-vvafter providing port number.
Note that in this case giving port number is mandatory.LimitationsIt does only the commands related to reading and writing
analog inputs, discrete inputs, holding registers and coils,
so only commands 1-6 and 15-16 are supported.Also, it spawns a thread per a client. This might be unacceptable to you,
however it can also with with gevent.Client connections will be closed after 60 seconds of inactivity.Custom data providerTo implement a custom data provider, just extendBaseDataSourceto provide data of your choosing and launch it that way:frommodbus_tcp_server.networkimportModbusTCPServerfrommodbus_tcp_server.data_sourceimportBaseDataSourceclassCustomDB(BaseDataSource):...c_db=CustomDB()at=ModbusTCPServer('0.0.0.0',502,c_db).start()Note that since everything is handled in a single thread,
if your reads or writes take too long this will hang on them.
File a Issue if you've got a problem with that.Change logv0.6made logging received data log level debugsocket will be opened with SO_REUSEADDRv0.4added automatic connection termination after 60 seconds of inactivitybetter error detection on connectionsbugfix: fixed CustomMODBUSErrorv0.3addedCustomMODBUSErrorrenamedAcceptThreadtoModbusTCPServerv0.2added support for commands 15 and 16added exceptionsGatewayPathUnavailableandGatewayTargetDeviceFailedToRespond
Package: modcfg
ModCFGYEs, another configuration languageSeriously, how many configuration languages do we have? From the top of my head, I can only name:JSONYAMLINITOMLXMLHmmm... that'sitI think. wE NeEd MOrE cOnfIGURaTion LanGuaGEs!!1!1!!But actually thoughI originally based this off of the Ruby/DSL for homebrew formulas.Here are my complaints for the alternatives:JSON, while simple, isn't too readable andonly has the bear minimum of datatypes.That may be a feature for some people, though.YAML isdangerous. Andunpredictable.INI and TOML are quite similar and they both are quite nice with a lot of datatypes but, in my opinion,the format isn't as natural to read as YAML. TOML supports dates and datetime, though.Finally, XML is garbage. It's barely human-readable and can decode into a super wonky format. So no.Finally, I just wanted an excuse to play with Lark.FeaturesEnums with a built-in resolverDate time and Date supportYAML-like syntaxSupport for comments,unicode escape sequences,string modifications, andcleanly managed indented stringsExamplesGiven this modcfg document:module hello_world:hello => worldthis:"alsoworks"'singlequotes'= "equals double quotes"how -> {about:{some:- very- crazy- data:structures = o_0}}and this python script:importmodcfgmodcfg.loads(DOC)# `DOC` is the document aboveThe output is[Module(name="hello_world",contents=[{"hello":"world","this":"also works","single quotes":"equals double quotes","how":{"about":{"some":["very","crazy",{"data":{"structures":"o_0"}}]}},}],)]Crazy, right? It gets better with enums and date(time)s... You might as well read the wholedocumentation.Installation$pipinstallmodcfgDevelop-installThe classic method:$gitclonehttps://github.com/ThatXliner/modcfg.git
$cdmodcfg
$python3-mvenv.venv
$source.venv/bin/activate
$pipinstall-e.The best method (requiresPoetry):$gitclonehttps://github.com/ThatXliner/modcfg.git
$cdmodcfg
$poetryinstallFAQWhy did you make thisLarkis epic.Why the name?ModularConfiguration language.
Package: mod-chalice
Chalice is a microframework for writing serverless apps in python. It allows
you to quickly create and deploy applications that use AWS Lambda.  It provides:A command line tool for creating, deploying, and managing your appA decorator based API for integrating with Amazon API Gateway, Amazon S3,
Amazon SNS, Amazon SQS, and other AWS services.Automatic IAM policy generationYou can create Rest APIs:fromchaliceimportChaliceapp=Chalice(app_name="helloworld")@app.route("/")defindex():return{"hello":"world"}Tasks that run on a periodic basis:fromchaliceimportChalice,Rateapp=Chalice(app_name="helloworld")# Automatically runs every 5 minutes@app.schedule(Rate(5,unit=Rate.MINUTES))defperiodic_task(event):return{"hello":"world"}You can connect a lambda function to an S3 event:fromchaliceimportChaliceapp=Chalice(app_name="helloworld")# Whenever an object is uploaded to 'mybucket'# this lambda function will be invoked.@app.on_s3_event(bucket='mybucket')defhandler(event):print("Object uploaded for bucket:%s, key:%s"%(event.bucket,event.key))As well as an SQS queue:fromchaliceimportChaliceapp=Chalice(app_name="helloworld")# Invoke this lambda function whenever a message# is sent to the ``my-queue-name`` SQS queue.@app.on_sqs_message(queue='my-queue-name')defhandler(event):forrecordinevent:print("Message body:%s"%record.body)And several other AWS resources.Once you’ve written your code, you just runchalice deployand Chalice takes care of deploying your app.$ chalice deploy
...
https://endpoint/dev

$ curl https://endpoint/api
{"hello": "world"}Up and running in less than 30 seconds.
Give this project a try and share your feedback with us here on Github.The documentation is availableon readthedocs.Related ProjectsAWS Chalice- Repository from which this
project was forked.serverless- Build applications
comprised of microservices that run in response to events, auto-scale for
you, and only charge you when they run.Zappa- Deploy python WSGI applications
on AWS Lambda and API Gateway.claudia- Deploy node.js projects
to AWS Lambda and API Gateway.Domovoi- An extension to Chalice that
handles a variety of AWS Lambda event sources such as SNS push notifications,
S3 events, and Step Functions state machines.
Package: mod-cli
Mod = (Mojo Dep)English |简体中文IntroMojoPackage Manager Toollike:Rust:CargoPython:Pip/Poetry/PDMGo:Dep + VendorQuick Start✅ requirements:mojo 0.6+python 3.10+gitmojo-vmojo0.6.1(876ded2e)python--version07:27:03Python3.10.9✅ installmod:pipinstallmod-cli# orpoetryaddmod-cli--dev✅ Usage: (Using themodcommand)mod new: create a new mojo project--lib: Create a library project.--bin: Create an application (executable binary).mod init: Create a new mojo package in an existing directorymod build: build amojopkgmod install: download mojo dependencies totarget/depsmod hack:mod hack build: buildtarget/depsdependencies intomojopkgmod hack install: installtarget/depsdependencies to `mojo standard library pathmod hack uninstall: uninstalltarget/depsdependenciesmod hack clean: Clean the mojopkg (binary library) generated by compiling target/deps.mod run: Run a mojo file.mod test: Run unit tests.mod add: Add a dependency.mod remove: Remove a dependency.mod list: List all dependencies.mod search: Search for dependencies (fuzzy search).mod sync: Sync dependencies.mod lint: Code style check.mod publish: Publish a mojo project.mod workspace: Manage monorepo workspaces.mod workspace init: Initialize a workspace.mod workspace list: List workspaces.mod workspace add: Add a workspace.mod workspace remove: Remove a workspace.mod self: Manage itself.mod self update: Update the mod command itself.mod help: Show help information.mod--helpManualmod cmds✅ Create a new projectlikecargo newstyle:# new a libarymodnewyour/path/to/project--lib# new a appmodnewyour/path/to/project--bin❎ Build Mojo Package❎ TODOmodbuildReferenceshttps://taskfile.devtyper:https://typer.tiangolo.compackage managerpython + poetrypython + pdmrust + cargogolang + dep