Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. Serial Gateway not connecting - ttyUSB0 in use

Serial Gateway not connecting - ttyUSB0 in use

Scheduled Pinned Locked Moved Development
30 Posts 5 Posters 185 Views 5 Watching
  • 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.
  • C CraigDubya

    @niclas Hi,

    I don't think it's permissions related, I used:

    sudo usermod -a -G dialout openhab
    sudo usermod -a -G tty openhab
    

    when I was setting up according to this setup guide

    C Offline
    C Offline
    CraigDubya
    wrote on last edited by
    #17

    So I think I have solved the ttyUSB0 in use problem - I had a bridge definition in my things file, and I had added a serial gateway through paperui, and I think they were conflicting.

    I've removed the paperui gateway and reverted to the things file entry, and visa-versa and have not seen that error again.

    However, I can't seem to get an example binary switch sensor node to be registered by the gateway, or read the serial debug of the gateway using the arduino ide

    T 1 Reply Last reply
    0
    • C CraigDubya

      So I think I have solved the ttyUSB0 in use problem - I had a bridge definition in my things file, and I had added a serial gateway through paperui, and I think they were conflicting.

      I've removed the paperui gateway and reverted to the things file entry, and visa-versa and have not seen that error again.

      However, I can't seem to get an example binary switch sensor node to be registered by the gateway, or read the serial debug of the gateway using the arduino ide

      T Offline
      T Offline
      TimO
      Hero Member
      wrote on last edited by
      #18

      @CraigDubya is your user which is executing the Arduino ide also in the dialout group? Did you program the gateway via this ide?
      Please ensure, that only one software is using the serial connection at a time. But you are able to switch between Arduino ide and Openhab if you shut down the other software before using the other.

      C 1 Reply Last reply
      0
      • T TimO

        @CraigDubya is your user which is executing the Arduino ide also in the dialout group? Did you program the gateway via this ide?
        Please ensure, that only one software is using the serial connection at a time. But you are able to switch between Arduino ide and Openhab if you shut down the other software before using the other.

        C Offline
        C Offline
        CraigDubya
        wrote on last edited by
        #19

        @TimO Hi,

        So, something interesting... If I stop the openhab2.service I still get no debug information on the serial monitor of the Arduino IDE. Then, if I stop the mysgw.service and open the Arduino IDE I can no longer select the ttyUSB0 port for the serial monitor.

        I didn't use the native Arduino IDE to program the serial monitor, but I used my laptop to do that.

        C 1 Reply Last reply
        0
        • C CraigDubya

          @TimO Hi,

          So, something interesting... If I stop the openhab2.service I still get no debug information on the serial monitor of the Arduino IDE. Then, if I stop the mysgw.service and open the Arduino IDE I can no longer select the ttyUSB0 port for the serial monitor.

          I didn't use the native Arduino IDE to program the serial monitor, but I used my laptop to do that.

          C Offline
          C Offline
          CraigDubya
          wrote on last edited by
          #20

          I've also tried adding the user pi to the dialout and tty groups, but still I can't select any port in the arduino ide when mysgw.service and openhab2.service are stopped. It's as if the mysgw.service is creating the ttyUSB0 port (virtually?) :confused:

          C 1 Reply Last reply
          0
          • C CraigDubya

            I've also tried adding the user pi to the dialout and tty groups, but still I can't select any port in the arduino ide when mysgw.service and openhab2.service are stopped. It's as if the mysgw.service is creating the ttyUSB0 port (virtually?) :confused:

            C Offline
            C Offline
            CraigDubya
            wrote on last edited by
            #21

            I did a ls /dev/tty* and ttyUSB0 had disappeared...so I unplugged the gateway and plugged it back in again (all while mysgw.service is stopped) then another ls /dev/tty* and ttyUSB0 was back. I started the arduino ide and selected ttyUSB0 and in the serial monitor I now have:

            0;255;3;0;9;0 MCO:BGN:INIT GW,CP=RNNGA---,FQ=16,REL=255,VER=2.3.2
            0;255;3;0;9;5 TSM:INIT
            0;255;3;0;9;7 TSF:WUR:MS=0
            0;255;3;0;9;15 TSM:INIT:TSP OK
            0;255;3;0;9;18 TSM:INIT:GW MODE
            0;255;3;0;9;21 TSM:READY:ID=0,PAR=0,DIS=0
            0;255;3;0;9;24 MCO:REG:NOT NEEDED
            0;255;3;0;14;Gateway startup complete.
            0;255;0;0;18;2.3.2
            0;255;3;0;9;28 MCO:BGN:STP
            0;255;3;0;9;35 MCO:BGN:INIT OK,TSP=1
            0;255;3;0;9;38 TSM:READY:NWD REQ
            0;255;3;0;9;45 ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
            
            C 1 Reply Last reply
            0
            • C CraigDubya

              I did a ls /dev/tty* and ttyUSB0 had disappeared...so I unplugged the gateway and plugged it back in again (all while mysgw.service is stopped) then another ls /dev/tty* and ttyUSB0 was back. I started the arduino ide and selected ttyUSB0 and in the serial monitor I now have:

              0;255;3;0;9;0 MCO:BGN:INIT GW,CP=RNNGA---,FQ=16,REL=255,VER=2.3.2
              0;255;3;0;9;5 TSM:INIT
              0;255;3;0;9;7 TSF:WUR:MS=0
              0;255;3;0;9;15 TSM:INIT:TSP OK
              0;255;3;0;9;18 TSM:INIT:GW MODE
              0;255;3;0;9;21 TSM:READY:ID=0,PAR=0,DIS=0
              0;255;3;0;9;24 MCO:REG:NOT NEEDED
              0;255;3;0;14;Gateway startup complete.
              0;255;0;0;18;2.3.2
              0;255;3;0;9;28 MCO:BGN:STP
              0;255;3;0;9;35 MCO:BGN:INIT OK,TSP=1
              0;255;3;0;9;38 TSM:READY:NWD REQ
              0;255;3;0;9;45 ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
              
              C Offline
              C Offline
              CraigDubya
              wrote on last edited by
              #22

              When I restart the mysgw.service and do a ls /dev/tty* the ttyUSB0 is shown in blue as opposed to yellow as seen below.

              ttyUSB0.png

              mfalkviddM 1 Reply Last reply
              0
              • C CraigDubya

                When I restart the mysgw.service and do a ls /dev/tty* the ttyUSB0 is shown in blue as opposed to yellow as seen below.

                ttyUSB0.png

                mfalkviddM Offline
                mfalkviddM Offline
                mfalkvidd
                Mod
                wrote on last edited by mfalkvidd
                #23

                @CraigDubya mysgw.service is partly a software gateway. From earlier posts, it seems you also have a hardware gateway (based on an Arduino Nano). Is that correct?

                If so, the two gateways might conflict. Is your intention to run two gateways?

                C 1 Reply Last reply
                0
                • mfalkviddM mfalkvidd

                  @CraigDubya mysgw.service is partly a software gateway. From earlier posts, it seems you also have a hardware gateway (based on an Arduino Nano). Is that correct?

                  If so, the two gateways might conflict. Is your intention to run two gateways?

                  C Offline
                  C Offline
                  CraigDubya
                  wrote on last edited by
                  #24

                  @mfalkvidd Hi,

                  No, my intention is not to run 2 gateways, I did a make on the mysgw.service and changed the port to ttyUSB020 in the config and restarted openhab. I now have communication with the hardware gateway. It seems it's all working properly now, but I'm a bit concerned that I may still have a software gateway running aswell.

                  karaf.png

                  C 1 Reply Last reply
                  0
                  • C CraigDubya

                    @mfalkvidd Hi,

                    No, my intention is not to run 2 gateways, I did a make on the mysgw.service and changed the port to ttyUSB020 in the config and restarted openhab. I now have communication with the hardware gateway. It seems it's all working properly now, but I'm a bit concerned that I may still have a software gateway running aswell.

                    karaf.png

                    C Offline
                    C Offline
                    CraigDubya
                    wrote on last edited by
                    #25

                    I just rebooted my pi, and whatever I did to get the bridge working has reset, and I'm not getting any node connections anymore :confused:

                    C 1 Reply Last reply
                    0
                    • C CraigDubya

                      I just rebooted my pi, and whatever I did to get the bridge working has reset, and I'm not getting any node connections anymore :confused:

                      C Offline
                      C Offline
                      CraigDubya
                      wrote on last edited by
                      #26

                      If I stop the mysgw.service and restart openhab2.service the gateway works fine. So, the mysgw.service is starting on bootup, how do I remove or disable mysgw.service from bootup?

                      C 1 Reply Last reply
                      0
                      • C CraigDubya

                        If I stop the mysgw.service and restart openhab2.service the gateway works fine. So, the mysgw.service is starting on bootup, how do I remove or disable mysgw.service from bootup?

                        C Offline
                        C Offline
                        CraigDubya
                        wrote on last edited by
                        #27

                        @mfalkvidd Sorry, in answer to your earlier question, that's correct... I have an Arduino Nano connected via USB to the raspberry pi as a hardware serial gateway

                        C 1 Reply Last reply
                        0
                        • C CraigDubya

                          @mfalkvidd Sorry, in answer to your earlier question, that's correct... I have an Arduino Nano connected via USB to the raspberry pi as a hardware serial gateway

                          C Offline
                          C Offline
                          CraigDubya
                          wrote on last edited by
                          #28

                          Ah I found it using:

                          sudo systemctl disable mysgw.service
                          

                          Now when I reboot the pi the gateway is working and my sensor node is reporting correctly.

                          Thanks for everyones help, it's been 2 years since I last played with openhab and mysensors, and what I learned back then I had mostly forgotten. Also with the openhab and mysensors updates that have happened in that time it's been a struggle to get back on track :grin:

                          mfalkviddM 1 Reply Last reply
                          2
                          • C CraigDubya

                            Ah I found it using:

                            sudo systemctl disable mysgw.service
                            

                            Now when I reboot the pi the gateway is working and my sensor node is reporting correctly.

                            Thanks for everyones help, it's been 2 years since I last played with openhab and mysensors, and what I learned back then I had mostly forgotten. Also with the openhab and mysensors updates that have happened in that time it's been a struggle to get back on track :grin:

                            mfalkviddM Offline
                            mfalkviddM Offline
                            mfalkvidd
                            Mod
                            wrote on last edited by
                            #29

                            Great work @CraigDuby, thanks for reporting back.

                            1 Reply Last reply
                            1
                            • C Offline
                              C Offline
                              CraigDubya
                              wrote on last edited by
                              #30

                              And so here is my serial gateway with 3d printed case:

                              20200411_212514.jpg

                              1 Reply Last reply
                              3
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              21

                              Online

                              11.7k

                              Users

                              11.2k

                              Topics

                              113.1k

                              Posts


                              Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                              • Login

                              • Don't have an account? Register

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • MySensors
                              • OpenHardware.io
                              • Categories
                              • Recent
                              • Tags
                              • Popular