Topic | Python API not connecting to Mooshi

Home Forums Mooshimeter Support Python API not connecting to Mooshi

Viewing 4 reply threads
  • Author
    Posts
    • #8666 Reply
      MikeB
      Member

      I am trying to get the python API example working but can’t seem to get it to connect to the meter.
      Hopefully someone might be able to help me solve the issue.
      I have tried both the master and dev branch of the code with the same outcome.
      The example code enumerates the Mooshi and I assume writes out some BLE profile data ok but when the code tries to connect to the Mooshi it errors at File “D:\Mooshimeter-PythonAPI-dev\BGWrapper.py”, line 149, in enableNotify (See console output below)

      D:\Mooshimeter-PythonAPI-dev>Example.py
      A7:BF:A0:39:CD:20: -78 1BC5FFA0-0200-62AB-E411-F254E005DBD4
      Connected to 20:CD:39:A0:BF:A7
      Interval: 24ms
      Service Groups:
      0018
      0118
      0A18
      D4DB05E0-54F2-11E4-AB62-0002A0FFC51B
      1: 2800
      2: 2803
      3: 2A00
      4: 2803
      5: 2A01
      6: 2803
      7: 2A02
      8: 2803
      9: 2A03
      10: 2803
      11: 2A04
      12: 2800
      13: 2803
      14: 2A05
      15: 2902
      16: 2800
      17: 2803
      18: 2A23
      19: 2803
      20: 2A24
      21: 2803
      22: 2A25
      23: 2803
      24: 2A26
      25: 2803
      26: 2A27
      27: 2803
      28: 2A28
      29: 2803
      30: 2A29
      31: 2803
      32: 2A2A
      33: 2803
      34: 2A50
      35: 2800
      36: 2803
      37: 1BC5FFA1-0200-62AB-E411-F254E005DBD4
      38: 2901
      39: 2803
      40: 1BC5FFA2-0200-62AB-E411-F254E005DBD4
      41: 2901
      42: 2803
      43: 1BC5FFA3-0200-62AB-E411-F254E005DBD4
      44: 2901
      45: 2803
      46: 1BC5FFA4-0200-62AB-E411-F254E005DBD4
      47: 2901
      48: 2803
      49: 1BC5FFA5-0200-62AB-E411-F254E005DBD4
      50: 2901
      51: 2803
      52: 1BC5FFA6-0200-62AB-E411-F254E005DBD4
      53: 2902
      54: 2901
      55: 2803
      56: 1BC5FFA7-0200-62AB-E411-F254E005DBD4
      57: 2902
      58: 2901
      59: 2803
      60: 1BC5FFA8-0200-62AB-E411-F254E005DBD4
      61: 2902
      62: 2901
      63: 2803
      64: 1BC5FFA9-0200-62AB-E411-F254E005DBD4
      65: 2902
      66: 2901
      67: 2803
      68: 1BC5FFAA-0200-62AB-E411-F254E005DBD4
      69: 2902
      70: 2901
      71: 2803
      72: 1BC5FFAB-0200-62AB-E411-F254E005DBD4
      73: 2901
      74: 2803
      75: 1BC5FFAC-0200-62AB-E411-F254E005DBD4
      76: 2901
      Traceback (most recent call last):
      File “D:\Mooshimeter-PythonAPI-dev\Example.py”, line 50, in <module>
      main_meter.connect()
      File “D:\Mooshimeter-PythonAPI-dev\Mooshimeter.py”, line 214, in connect
      self.meter_serout.enableNotify(True,tmp_cb)
      File “D:\Mooshimeter-PythonAPI-dev\BGWrapper.py”, line 58, in enableNotify
      self.p.enableNotify(self.uuid, enable)
      File “D:\Mooshimeter-PythonAPI-dev\BGWrapper.py”, line 149, in enableNotify
      raise
      TypeError: exceptions must be old-style classes or derived from BaseException, not NoneType

    • #8674 Reply
      admin
      Keymaster

      Hi Bruce,

      It looks like you’re on the “dev” branch of the Python API. Can you try the master branch? The dev branch is under active development and I’m testing it against a new version of firmware that’s not backwards compatible.

      Best
      ~James

    • #8677 Reply
      MikeB
      Member

      Hi James,

      I have tried the Master branch but get the same error see console output below.
      Also I have to reset the Mooshi after I use the python app before the phone app can find and connect again.

      Thanks Bruce

      D:\Mooshimeter-PythonAPI-master>Example.py
      A7:BF:A0:39:CD:20: -75 1BC5FFA0-0200-62AB-E411-F254E005DBD4
      Connected to 20:CD:39:A0:BF:A7
      Interval: 24ms
      Service Groups:
      0018
      0118
      0A18
      D4DB05E0-54F2-11E4-AB62-0002A0FFC51B
      1: 2800
      2: 2803
      3: 2A00
      4: 2803
      5: 2A01
      6: 2803
      7: 2A02
      8: 2803
      9: 2A03
      10: 2803
      11: 2A04
      12: 2800
      13: 2803
      14: 2A05
      15: 2902
      16: 2800
      17: 2803
      18: 2A23
      19: 2803
      20: 2A24
      21: 2803
      22: 2A25
      23: 2803
      24: 2A26
      25: 2803
      26: 2A27
      27: 2803
      28: 2A28
      29: 2803
      30: 2A29
      31: 2803
      32: 2A2A
      33: 2803
      34: 2A50
      35: 2800
      36: 2803
      37: 1BC5FFA1-0200-62AB-E411-F254E005DBD4
      38: 2901
      39: 2803
      40: 1BC5FFA2-0200-62AB-E411-F254E005DBD4
      41: 2901
      42: 2803
      43: 1BC5FFA3-0200-62AB-E411-F254E005DBD4
      44: 2901
      45: 2803
      46: 1BC5FFA4-0200-62AB-E411-F254E005DBD4
      47: 2901
      48: 2803
      49: 1BC5FFA5-0200-62AB-E411-F254E005DBD4
      50: 2901
      51: 2803
      52: 1BC5FFA6-0200-62AB-E411-F254E005DBD4
      53: 2902
      54: 2901
      55: 2803
      56: 1BC5FFA7-0200-62AB-E411-F254E005DBD4
      57: 2902
      58: 2901
      59: 2803
      60: 1BC5FFA8-0200-62AB-E411-F254E005DBD4
      61: 2902
      62: 2901
      63: 2803
      64: 1BC5FFA9-0200-62AB-E411-F254E005DBD4
      65: 2902
      66: 2901
      67: 2803
      68: 1BC5FFAA-0200-62AB-E411-F254E005DBD4
      69: 2902
      70: 2901
      71: 2803
      72: 1BC5FFAB-0200-62AB-E411-F254E005DBD4
      73: 2901
      74: 2803
      75: 1BC5FFAC-0200-62AB-E411-F254E005DBD4
      76: 2901
      Traceback (most recent call last):
      File “D:\Mooshimeter-PythonAPI-master\Example.py”, line 51, in <module>
      main_meter.connect()
      File “D:\Mooshimeter-PythonAPI-master\Mooshimeter.py”, line 216, in connect
      self.meter_serout.enableNotify(True,tmp_cb)
      File “D:\Mooshimeter-PythonAPI-master\BGWrapper.py”, line 61, in enableNotify
      self.p.enableNotify(self.uuid, enable)
      File “D:\Mooshimeter-PythonAPI-master\BGWrapper.py”, line 152, in enableNotify
      raise
      TypeError: exceptions must be old-style classes or derived from BaseException, not NoneType

    • #8678 Reply
      admin
      Keymaster

      Hi Bruce,

      Regarding needing to reset the meter after the script crash: I think what’s happening is that the BLED112 (the USB dongle) is staying connected after the script crashes. If you unplug the dongle it will force a disconnection.

      Regarding the script crash itself, I think you may be facing some git issues. I can tell by the error message, specifically “File “D:\Mooshimeter-PythonAPI-master\Mooshimeter.py”, line 216, in connect
      self.meter_serout.enableNotify(True,tmp_cb)”, that the code you’re trying to run is for an experimental version of firmware. How did you move to the master branch? If you’re on the command line, after saving your work, you’ll want to do a “git reset –hard origin/master”

      Hope this helps, best
      ~James

    • #8679 Reply
      MikeB
      Member

      Hi James,

      You were 100% correct. My master branch was actually the dev version.
      Once I reset the master branch it worked first time.
      Thanks for you help.

      Cheers Bruce

Viewing 4 reply threads
Reply To: Reply #8678 in Python API not connecting to Mooshi
Your information:




This site is protected by reCaptcha and the Google Privacy Policy and Terms of Service apply.
Cancel