Code Monkey home page Code Monkey logo

modbus2mqtt's Introduction

modbus2mqtt

读取modbus数据并通过mqtt发布

版本持续更新中,当前仅支持tcpmodbus方式

配置文件使用yaml格式,具体含义如下

mqttinfo:

 host: 127.0.0.1 #MQTT服务器地址
 
 port: 1883   #MQTT端口号

 username: aaaa  #用户名

 password: 1234   #密码

 sublist:  #MQTT订阅列表

   - test

   - test2

 qos: 0 #qos

tcpmodbus:

 enable: True  #是否启用modbuds tcp采集数据

 host: 127.0.0.1 #modbus slave IP地址

 port: 502  #端口号

 slaveid: 1  #slave ID

 interval: 4 #读取频率 4秒/次

 devices:  #采集设备配置

    - register: holding  #要读取的寄存器 holding或 coil

      pubtopic: dev1pub  #采集的数据要发布的MQTT主题

      maptable:  #数据含义及地址映射表

       - startaddr: 0  #起始地址

          datalen: 1   #数据长度

          type: int   #数据类型

          name: temperature  #数据含义

       - startaddr: 3

          datalen: 1

          type: int

          name: humidity

如果成功采集到数据,程序会通过以下JSON格式发布到对应的dev1pub主题中:

{"key":"temperature","val":1}

{"key":"humidity","val":4} 

modbus2mqtt's People

Contributors

nmoumou avatar dependabot[bot] avatar

Stargazers

碧龍 avatar  avatar  avatar

Watchers

 avatar

modbus2mqtt'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.