• Categories
  • Recent
  • Tags
  • Popular
  • Register
  • Login
  • Categories
  • Recent
  • Tags
  • Popular
  • Register
  • Login

serial, Ethernet to MQTT

Scheduled Pinned Locked Moved Announcements
13 Posts 2 Posters 1.7k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    jkandasa
    last edited by 14 Jun 2021, 09:58

    Hi,

    I have developed a new MQTT bridge to convert from serial, ethernet to MQTT.
    Supports for MySensors.
    You can have more than one serial ports and/or ethernet connections.
    If you are interested in, https://github.com/mycontroller-org/2mqtt
    Thanks!

    J 1 Reply Last reply 14 Jul 2021, 17:04 Reply Quote 1
    • J Offline
      j54n1n @jkandasa
      last edited by j54n1n 14 Jul 2021, 17:04

      Hello @jkandasa,

      I was testing if I could use the old workflow that we used in our weather station school project, using an Arduino with RFM69 radio as a serial gateway broadcasting messages to local Mosquitto MQTT broker from where MyController then picks up the messages.

      I noticed that compared to your new v2 MyController's internal serial gateway, your 2mqtt bridge consumes more CPU cycles.

      Compare that when your builtin serial gateway is enabled from within MyController v2 UI with low CPU usage:
      MyController-SerialGW.png
      to your standalone 2mqtt bridge with higher CPU usage:
      MyController-2mqtt.png

      And I double checked that the builtin serial gateway was disabled from within the MyController v2 UI. I even tried to terminate MyController and checked with MQTT.fx if data was incoming from the bridge and I can confirm that I was still receiving valid data besides the high CPU usage.

      I was using your suggested settings as mentioned in your documentation MySensors | MyController.org and from your readme file on 2mqtt/README.md.

      Is this normal, or should I file a issue on your GitHub repository?

      Kind regards

      J 1 Reply Last reply 14 Jul 2021, 18:29 Reply Quote 0
      • J Offline
        jkandasa @j54n1n
        last edited by 14 Jul 2021, 18:29

        Hi, @j54n1n Thanks for the detailed report.
        It does not look normal. It can be a bug in 2mqtt
        Can you share your configuration details used in 2mqtt? (remove sensitive details)

        J 1 Reply Last reply 15 Jul 2021, 04:51 Reply Quote 0
        • J Offline
          j54n1n @jkandasa
          last edited by 15 Jul 2021, 04:51

          @jkandasa yes sure, I was not using any special configuration. I adapted the config file only to suit the configuration that we used before.

          Here we go for the config.yaml file:

          logger:
            mode: development
            encoding: console
            level: info
          
          adapters:
            - name: adapter1
              enabled: true
              reconnect_delay: 20s
              provider: mysensors_v2
              source:
                type: serial
                port: /dev/serial0
                baud_rate: 115200
                transmit_pre_delay: 10ms
              mqtt:
                broker: tcp://127.0.0.1:1883
                insecure_skip_verify: false
                username:
                password:
                subscribe: mysensors-in/#
                publish: mysensors-out
                qos: 0
                transmit_pre_delay: 0s
                reconnect_delay: 5s
          
            - name: adapter2
              enabled: false
              reconnect_delay: 20s
              provider: mysensors_v2
              source:
                type: ethernet
                server: tcp://192.168.10.21:5003
                transmit_pre_delay: 10ms
              mqtt:
                broker: tcp://192.168.10.21:1883
                insecure_skip_verify: false
                username:
                password:
                subscribe: in_nrf24/#
                publish: out_nrf24
                qos: 0
                transmit_pre_delay: 0s
                reconnect_delay: 5s
          
            - name: adapter3
              enabled: false
              reconnect_delay: 20s
              provider: raw
              source:
                type: serial
                port: /dev/ttyUSB0
                baud_rate: 115200
                transmit_pre_delay: 10ms
                message_splitter: 10
              mqtt:
                broker: tcp://192.168.10.21:1883
                insecure_skip_verify: false
                username:
                password:
                subscribe: in/my_topic
                publish: out/my_topic
                qos: 0
                transmit_pre_delay: 0s
                reconnect_delay: 5s
          

          and for my environment on the Raspberry Pi:

          $ cat /etc/*release
          PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
          NAME="Raspbian GNU/Linux"
          VERSION_ID="10"
          VERSION="10 (buster)"
          VERSION_CODENAME=buster
          ID=raspbian
          ID_LIKE=debian
          HOME_URL="http://www.raspbian.org/"
          SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
          BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
          
          $ uname -a
          Linux metteo-dev2 5.10.17-v7+ #1421 SMP Thu May 27 13:59:01 BST 2021 armv7l GNU/Linux
          
          $ ls -l /dev/serial0
          lrwxrwxrwx 1 root root 7 Jul 14 20:00 /dev/serial0 -> ttyAMA0
          
          $ ls -l /dev/ttyAMA0
          crw-rw---- 1 root dialout 204, 64 Jul 14 20:00 /dev/ttyAMA0
          
          $ groups pi
          pi : pi adm dialout cdrom sudo audio video plugdev games users input netdev spi i2c gpio lpadmin
          
          $ apt-cache policy mosquitto
          mosquitto:
            Installed: 1.5.7-1+deb10u1
            Candidate: 1.5.7-1+deb10u1
            Version table:
           *** 1.5.7-1+deb10u1 500
                  500 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages
                  100 /var/lib/dpkg/status
          

          Thanks in advance

          J 1 Reply Last reply 15 Jul 2021, 06:20 Reply Quote 1
          • J Offline
            jkandasa @j54n1n
            last edited by 15 Jul 2021, 06:20

            @j54n1n Thanks for the detailed configuration. I try to create this setup in my environment.

            J 1 Reply Last reply 15 Jul 2021, 17:57 Reply Quote 0
            • J Offline
              jkandasa @jkandasa
              last edited by 15 Jul 2021, 17:57

              @j54n1n I can reproduce this issue. kindly file a bug. I will work on it. Thanks!

              J 1 Reply Last reply 15 Jul 2021, 19:12 Reply Quote 0
              • J Offline
                j54n1n @jkandasa
                last edited by 15 Jul 2021, 19:12

                @jkandasa thanks, ok here is the link to the issue: https://github.com/mycontroller-org/2mqtt/issues/1

                Cheers j54n1n

                J 2 Replies Last reply 16 Jul 2021, 00:26 Reply Quote 1
                • J Offline
                  jkandasa @j54n1n
                  last edited by 16 Jul 2021, 00:26

                  Thnaks, @j54n1n!

                  1 Reply Last reply Reply Quote 0
                  • J Offline
                    jkandasa @j54n1n
                    last edited by 16 Jul 2021, 18:45

                    @j54n1n I have fixed the issue, can you please verify it in the master build?

                    J 1 Reply Last reply 17 Jul 2021, 05:39 Reply Quote 0
                    • J Offline
                      j54n1n @jkandasa
                      last edited by 17 Jul 2021, 05:39

                      @jkandasa thanks, yes now I get low CPU usage.

                      Nice work ^^

                      J 1 Reply Last reply 17 Jul 2021, 05:43 Reply Quote 1
                      • J Offline
                        jkandasa @j54n1n
                        last edited by 17 Jul 2021, 05:43

                        Thanks @j54n1n
                        I believe I my change will not impact the functionality
                        Please let me know if you see a different behavior in the recent build 🙂

                        J 1 Reply Last reply 17 Jul 2021, 06:04 Reply Quote 0
                        • J Offline
                          j54n1n @jkandasa
                          last edited by 17 Jul 2021, 06:04

                          @jkandasa Ok, I quickly looked through it with MQTT.fx and it seems to be fine.

                          Thanks again. Now I will start looking for strange behaviors with MySensors in your MyController v2.

                          J 1 Reply Last reply 17 Jul 2021, 09:11 Reply Quote 1
                          • J Offline
                            jkandasa @j54n1n
                            last edited by 17 Jul 2021, 09:11

                            @j54n1n thanks again! please report back if you find any

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post

                            2

                            Online

                            618

                            Users

                            531

                            Topics

                            3.4k

                            Posts
                            Copyright © 2015-2025 MyController.org | Contributors | Localization