Giter VIP home page Giter VIP logo

openwrt-serial2mqtt's Introduction

2022-06-30 RadioOperator updated: (Compile passed but not tested, just for reference.)

version: 1.0.0-20220630

The source code copied from the following sites (before 2021-09-06, not included later updated):

https://github.com/halfbakery/serial2mqtt-openwrt
https://github.com/eclipse/paho.mqtt.c
https://github.com/bblanchon/ArduinoJson
https://github.com/vortex314/Common
https://github.com/vortex314/serial2mqtt

And deleted some unnecessary files.

Installation and compile:

  1. setup your openwrt build environments, make sure it can build a firmware for your equipments.

  2. open a Terminal in the [openwrt-root/package/] directory, and clone my repo:

git clone https://github.com/RadioOperator/openwrt-serial2mqtt.git

  1. back your openwrt-root directory and run "make menuconfig":
    find [serial2mqtt] item under [network], press [Y] or [M], then [exit/save].

  2. build serial2mqtt package only, use:

make package/openwrt-serial2mqtt/compile V=s

  1. if no errors, check the "serial2mqtt_1.0.0-20220630_xxxxxx.ipk" file in [openwrt-root/bin/packages/.../base] directory.

  2. then you could modify the code for your hardware related, e.g. serial port no., baudrate ....

  3. testing and dont forget report your issues.

==========================================================================================================================

serial2mqtt-openWrt README

Experimental OpenWrt package for the serial2mqtt project.

Do not worry, building an OpenWrt package is amazingly easy. There are two different way to build the package, here's how.

Traditional build

In this case you need to install some basic developments tools and libraries. These tools are part of your distribution and they could be already installed if you compiled anything before.

The SDK itself is a tar file, where most of the tools are pre-compiled. The Using the SDK is an introductionary how you do it. After that here's how you can build serial2mqtt (the example is about building serial2mqtt on OpenWrt 21.02.0rc1 on a ramips/mt7621 target):

[halfbakery BUILD]$ tar xfJ ~/Download/openwrt-sdk-21.02.0-rc1-ramips-mt7621_gcc-8.4.0_musl.Linux-x86_64.tar.xz
[halfbakery BUILD]$ cd openwrt-sdk-21.02.0-rc1-ramips-mt7621_gcc-8.4.0_musl.Linux-x86_64/
[halfbakery openwrt-sdk-21.02.0-rc1-ramips-mt7621_gcc-8.4.0_musl.Linux-x86_64]$ ./scripts/feeds update -a
...output...
[halfbakery openwrt-sdk-21.02.0-rc1-ramips-mt7621_gcc-8.4.0_musl.Linux-x86_64]$ git clone https://github.com/halfbakery/serial2mqtt-openwrt.git package/serial2mqtt
...output...
[halfbakery openwrt-sdk-21.02.0-rc1-ramips-mt7621_gcc-8.4.0_musl.Linux-x86_64]$ make defconfig
...output...
[halfbakery openwrt-sdk-21.02.0-rc1-ramips-mt7621_gcc-8.4.0_musl.Linux-x86_64]$ make package/serial2mqtt/compile
...output...
[halfbakery openwrt-sdk-21.02.0-rc1-ramips-mt7621_gcc-8.4.0_musl.Linux-x86_64]$ ls bin/packages/mipsel_24kc/base/
serial2mqtt_0.0-1_mipsel_24kc.ipk

Use an OpenWrt SDK docker container

This method is even easier. No need to install anything on the host system, just run the following commands:

$ mkdir openwrt_packages
[halfbakery BUILD]$ cd openwrt_packages
[halfbakery openwrt_packages]$ pwd
/home/halfbakery/BUILD/openwrt_packages
[halfbakery openwrt_packages]$ docker run --rm -v "$(pwd)":/home/build/openwrt/bin -it openwrtorg/sdk:ramips-mt7621-21.02-SNAPSHOT
...output...
...the following prompt comes from the container...
build@ad4880501358:~/openwrt$ ./scripts/feeds update -a
...output...
build@ad4880501358:~/openwrt$ git clone https://github.com/halfbakery/serial2mqtt-openwrt.git package/serial2mqtt
...output...
build@ad4880501358:~/openwrt$ make defconfig
...output...
build@ad4880501358:~/openwrt$ make package/serial2mqtt/compile
...output...
build@ad4880501358:~/openwrt$ $ exit
exit
...the following prompt comes from the host...
[halfbakery openwrt_packages]$ ls packages/mipsel_24kc/base/
serial2mqtt_0.0-1_mipsel_24kc.ipk

Of course you can use podman instead of docker if you like, but you have to add permission on the build directory to the container to put the results into (e.g. chown 777 openwrt_packages is an easy & lazy solution).

openwrt-serial2mqtt's People

Contributors

radiooperator avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.