Topic | Python API and April update issue. Not connecting.

Home Forums Mooshimeter Support Python API and April update issue. Not connecting.

Viewing 9 reply threads
  • Author
    Posts
    • #9583 Reply
      Seergio
      Guest

      Hi, I recently updated the firmware to 1460332895 version and I am trying to connect vía BLE112 but it seems to be impossible to read some fields of the packets with the master and development API. Here is the error I always get. BTW I’m using W10 x64.

      When Python script enters in the next line:

      self.pcb_version = b.get(1)

      I get this :(:

      top_b = self.bytes[self.i]
      IndexError: list index out of range

      The complete sequence is below:

      E:\BAJADOS\Box Sync\MOOSHIMETER\MOOSHIMETER_PC\Mooshimeter-PythonAPI-master>Example.py
      F9:9B:A0:39:CD:20: -49 1BC5FFA0-0200-62AB-E411-F254E005DBD4
      Connected to 20:CD:39:A0:9B:F9
      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: 2902
      42: 2901
      Traceback (most recent call last):
      File “E:\BAJADOS\Box Sync\MOOSHIMETER\MOOSHIMETER_PC\Mooshimeter-PythonAPI-master\Example.py”, line 59, in <module>
      connectToMeterAndStream(meters[0])
      File “E:\BAJADOS\Box Sync\MOOSHIMETER\MOOSHIMETER_PC\Mooshimeter-PythonAPI-master\Example.py”, line 33, in connectToMeterAndStream
      m.connect()
      File “E:\BAJADOS\Box Sync\MOOSHIMETER\MOOSHIMETER_PC\Mooshimeter-PythonAPI-master\Mooshimeter.py”, line 322, in connect
      assignHandleAndRead(self.meter_info)
      File “E:\BAJADOS\Box Sync\MOOSHIMETER\MOOSHIMETER_PC\Mooshimeter-PythonAPI-master\Mooshimeter.py”, line 321, in assignHandleAndRead
      c.read()
      File “E:\BAJADOS\Box Sync\MOOSHIMETER\MOOSHIMETER_PC\Mooshimeter-PythonAPI-master\BGWrapper.py”, line 51, in read
      self.unpack()
      File “E:\BAJADOS\Box Sync\MOOSHIMETER\MOOSHIMETER_PC\Mooshimeter-PythonAPI-master\Mooshimeter.py”, line 215, in unpack
      self.pcb_version = b.get(1)
      File “E:\BAJADOS\Box Sync\MOOSHIMETER\MOOSHIMETER_PC\Mooshimeter-PythonAPI-master\Mooshimeter.py”, line 35, in get
      top_b = self.bytes[self.i]
      IndexError: list index out of range

      E:\BAJADOS\Box Sync\MOOSHIMETER\MOOSHIMETER_PC\Mooshimeter-PythonAPI-master>___

    • #9597 Reply

      I have tried with Python 2.7.11 and windows 10 x64. My mooshimeter was updated from android.

      I have explored as fas as I could to my low knowledge in Python, and I realized that:

      b = BytePack(self.byte_value)

      On line 214 From Mooshimeter.py is a fully empty List Object.

      1->>MeterInfo SELF:>>37: 1BC5FFA1-0200-62AB-E411-F254E005DBD4<<
      2->>MeterInfo LENGTH OF self.byte_value:>>0<<
      3->>MeterInfo List self.byte_value:>>[]<<
      4->>MeterInfo b after BytePack :>><Mooshimeter.BytePack instance at 0x0291DE90><<

      I would like to have a little advice on that issue. My experience in Python is limited and that’s all I can do. Thank you mates!

    • #9598 Reply

      Another hint with dev version of Python-API (28/4/16) :

      E:\BAJADOS\Box Sync\MOOSHIMETER\MOOSHIMETER_PC\Mooshimeter-PythonAPI-dev>Example.py
      F9:9B:A0:39:CD:20: -49 1BC5FFA0-0200-62AB-E411-F254E005DBD4
      Connected to 20:CD:39:A0:9B:F9
      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: 2902
      42: 2901
      Received out of order packet!
      Expected: 1
      Got : 0
      Packet 0
      Packet 1
      Packet 2
      Packet 3
      Packet 4
      Packet 5
      Packet 6
      Packet 7
      Packet 8
      Packet 9
      Packet 10
      Packet 11
      Packet 12
      Packet 13
      Packet 14
      Packet 15
      Packet 16
      Packet 17
      Packet 18
      Traceback (most recent call last):
      File “E:\BAJADOS\Box Sync\MOOSHIMETER\MOOSHIMETER_PC\Mooshimeter-PythonAPI-dev\Example.py”, line 56, in <module>
      BGWrapper.idle()
      File “E:\BAJADOS\Box Sync\MOOSHIMETER\MOOSHIMETER_PC\Mooshimeter-PythonAPI-dev\BGWrapper.py”, line 203, in idle
      ble.check_activity(ser)
      File “C:\Python27\lib\bglib.py”, line 659, in check_activity
      while ser.inWaiting(): self.parse(ord(ser.read()))
      File “C:\Python27\lib\bglib.py”, line 1038, in parse
      self.ble_evt_attclient_attribute_value({ ‘connection’: connection, ‘atthandle’: atthandle, ‘type’: type, ‘value’: value_data })
      File “C:\Python27\lib\bglib.py”, line 116, in fire
      func(self.obj, earg)
      File “E:\BAJADOS\Box Sync\MOOSHIMETER\MOOSHIMETER_PC\Mooshimeter-PythonAPI-dev\BGWrapper.py”, line 107, in notifyHandler
      self.chars[args[‘atthandle’]].onNotify(args[‘value’])
      File “E:\BAJADOS\Box Sync\MOOSHIMETER\MOOSHIMETER_PC\Mooshimeter-PythonAPI-dev\BGWrapper.py”, line 54, in onNotify
      self.unpack()
      File “E:\BAJADOS\Box Sync\MOOSHIMETER\MOOSHIMETER_PC\Mooshimeter-PythonAPI-dev\Mooshimeter.py”, line 77, in unpack
      self.interpretAggregate()
      File “E:\BAJADOS\Box Sync\MOOSHIMETER\MOOSHIMETER_PC\Mooshimeter-PythonAPI-dev\Mooshimeter.py”, line 58, in interpretAggregate
      node.notification_handler(b.getBytes(expecting_bytes))
      File “E:\BAJADOS\Box Sync\MOOSHIMETER\MOOSHIMETER_PC\Mooshimeter-PythonAPI-dev\Mooshimeter.py”, line 140, in expandReceivedTree
      self.tree.unpack(”.join([chr(c) for c in payload]))
      File “E:\BAJADOS\Box Sync\MOOSHIMETER\MOOSHIMETER_PC\Mooshimeter-PythonAPI-dev\ConfigNode.py”, line 197, in unpack
      l = msgpack.unpackb(plain)
      File “C:\Python27\lib\site-packages\msgpack\fallback.py”, line 100, in unpackb
      raise ExtraData(ret, unpacker._fb_get_extradata())
      msgpack.exceptions.ExtraData: unpack(b) received extra data.

      It seems there is a problem with development API as well.

    • #9610 Reply
      admin
      Keymaster

      Hi Seergio,

      The new firmware has some deep changes that aren’t accounted for in the python API yet. I’m working on updating the iOS app to use the new firmware right now, then moving on to the PC API.

      To use the python API before then, you’ll have to downgrade your firmware. You can do this by downloading the production version of the Android or iOS app and running a firmware update.

      Best
      ~James

    • #9616 Reply

      Thank you very much James! I’m gonna try the downgrade, and then if successful I would like to develop some GUI in Python or C# for plotting the data as in the Android App.

      I am not sure, but is there any mooshimeter API protocol documentation? I mean, in order to avoid to dive into python code to learn how to send commands to the mooshimeter device? I’d like to take the plunge and help to develop a GUI or some app that integrates/exports data logs able to filter and analyse data into a PC.
      I made use of this device in electrical installations and it is really helpful to detect problems related to noise, wiring isolation and earth defects with this little tool in pumping systems.

    • #13800 Reply
      Anonymous
      Inactive

      I’m actually looking for a way for a separate script can be used to do the initialisation and then another script to take a measurement to be saved. The script provided just makes a connection and starts streaming data. As this is in a command window it will be very difficult to capture.

    • #13837 Reply
      admin
      Keymaster

      Hi Mark123,

      I answered you in a different thread and I think I got your question, please let me know over there so we don’t cross threads too much!

    • #13915 Reply
      admin
      Keymaster

      Hi Seergio,

      Not sure if this is still relevant to you, but if it is I just pushed some updates to the Mooshimeter Python API to work with the latest firmware (1470628829).

      Best
      ~James

    • #19425 Reply
      Anonymous
      Guest

      Hi all,
      I have a similar issue:

      “Received out of order packet!
      Expected: 1
      Got : 216”

      I have firmware version:
      1477971088
      Is there a new API that will work with this version?
      Thanks,
      John

    • #19488 Reply
      admin
      Keymaster

      Hi John,

      I answered over email but am answering here so others can find it – the “Received out of order packet!” warning on initialization is nothing to be alarmed about and I’ve corrected it in the latest version on github.

      https://github.com/mooshim/Mooshimeter-PythonAPI/commit/350230984ebbcd9a14bb1bcbe4b4bfc6dd2662dd

      ~James

Viewing 9 reply threads
Reply To: Python API and April update issue. Not connecting.
Your information:




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

The reCAPTCHA verification period has expired. Please reload the page.