'LoRa' object has no attribute 'Mesh'



  • Hello, i made a new subject, but i think is following this subject: Pymesh updates

    I have try to use the pymesh network for see how to use it. I have upgrade a lopy4 with the 1.20.0.rc12:

    rst:0x7 (TG0WDT_SYS_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:1
    load:0x3fff8028,len:8
    load:0x3fff8030,len:2156
    ho 0 tail 12 room 4
    load:0x4009fa00,len:19208
    entry 0x400a05f4
    Initializing filesystem as FatFS!
    Traceback (most recent call last):
      File "main.py", line 336, in <module>
      File "mesh_interface.py", line 36, in __init__
      File "mesh_internal.py", line 105, in __init__
      File "loramesh.py", line 61, in __init__
    AttributeError: 'LoRa' object has no attribute 'Mesh'
    Pycom MicroPython 1.20.0.rc12 [v1.9.4-81167ed] on 2019-07-15; LoPy4 with ESP32
    Type "help()" for more information.
    >>> 
    

    I have get the software in this page: https://software.pycom.io/downloads/LoPy4.html

    Maybe the LoRa object with Mesh attribute was on other folder?

    Can someone explain me my error? Thank's


  • Global Moderator

    As I mentioned before, the pymesh firmware uses closed-source libraries that unfortunately we cannot publish. When you update to the Pymesh firmware through Pybytes, you accept the license agreement, which is why we cannot publish the source or binary for this firmware. Sorry for the inconvenience.



  • This post is deleted!

  • Global Moderator

    To be honest, I don't know. Perhaps the special submodule can be found in versions 1.20.0.rc8 through rc10 as my colleague Catalin described 2 years ago, but I would not recommend using that firmware in a production environment.



  • @Gijs
    Hi, thanks for your quick answer. I understood that is possible to use Pybytes, but I would like to understand if the code in github can be still used with some older firmware version or not.

    BR,
    F-


  • Global Moderator

    Hi,
    As I mentioned in a post above, nowadays you need to get the pymesh firmware through Pybytes. There is a guide here: https://docs.pycom.io/pybytes/pymeshintegration/. The pycom-libraries version of pymesh frozen is a reference to the pymesh code, but the firmware includes some additional closed-source components. If you use the firmware, you do not need to load the pymesh-frozen library seperately.



  • @catalin said in 'LoRa' object has no attribute 'Mesh':

    import pycom
    pycom.pybytes_on_boot(False)
    machine.reset()

    Dear Catalin, many thanks for your support. I still have issues with pmesh on my pycom Fipy.
    Here what I did:
    a. git clone https://github.com/pycom/pycom-libraries.git
    b. in Atom Add a new project from pycom-libraries/pymes/pymesh_frozen
    c. execute the code you suggest

    import machine
    import pycom
    pycom.pybytes_on_boot(False)
    machine.reset()

    d. Upload the project to the device

    result: I got the error:

    Traceback (most recent call last):
      File "main.py", line 35, in <module>
      File "/flash/lib/pymesh.py", line 57, in __init__
      File "/flash/lib/mesh_interface.py", line 56, in __init__
      File "/flash/lib/mesh_internal.py", line 123, in __init__
      File "/flash/lib/loramesh.py", line 73, in __init__
      File "/flash/lib/loramesh.py", line 122, in _lora_init
    AttributeError: 'LoRa' object has no attribute 'Mesh'
    Pycom MicroPython 1.20.3.b3 [v1.11-92f2b22e] on 2021-04-19; FiPy with ESP32
    

    in line 122 does not exist lora.Mesh()
    Wrong firmware version? Which is the right one?
    Here my current version:

    Pycom MicroPython 1.20.3.b3 [v1.11-92f2b22e] on 2021-04-19; FiPy with ESP32
    

    Thanks!
    F.


  • Global Moderator

    I did a quick search for what you mention, and could only find this, from about a year ago: https://forum.pycom.io/topic/6132/pycom-nvs_get-returns-an-exception. Indeed there was a time where it returned 'None' as per the docs, but it has been like this for (at least) a year, so it should also be implemented in the Pymesh :)

    You're correct when mentioning we should keep track of the API per firmware version.



  • @Gijs Wasn't there a few months ago a breaking change in nvs_get which switched from returning None to generating a ValueError exception when the key does not already exists?


  • Global Moderator

    Hi,
    I don't think that has to do with the Pymesh firmware, but rather a missing key in the NVS. You can use a try-except block to catch the error, or use any of the following:

    pycom.nvs_set('loraSaved', value)
    

    to set the key, or

    pycom.nvs_get('loraSaved', value)
    

    Which will return value if the key is not set.



  • @catalin thanks for your response, I am having problems whit the Pymesh Firmware, exactly whit the following code:

    loraSaved = pycom.nvs_get('loraSaved')
    

    I have the follogin error:

    ValueError: No matching object for the provided key
    

    Can you help me, please?

    thanks in advance.



  • @jclo13 As I've tried to explained here https://docs.pycom.io/pymesh/simple-example/ if Pybytes is stopped then you can use directly the Pymesh Library API (like: pymesh = Pymesh(pymesh_config, new_message_cb))

    Stopping Pybytes can be done using (and enabling it can be done by using parameter pycom.pybytes_on_boot(True)):

    import pycom
    pycom.pybytes_on_boot(False)
    machine.reset()
    

    If Pybtyes is stopped then Pymesh is not automatically started, but Pybytes Library scripts are included as frozen.

    1. You can re-upload Pymesh Library scripts (with custom modifications), and this ones will be executed, they are preferred instead of the frozen ones
    2. OR, You can use directly Pybytes low-level micropython API: https://docs.pycom.io/firmwareapi/pycom/network/lora/pymesh/

    Thanks and let me know if anything else is not clear.



  • @catalin I'm a bit confused, the micropython API that is in the DOCs (https://docs.pycom.io/firmwareapi/pycom/network/lora/pymesh/) works with Pymesh from Pybytes? or how it should use the micropython API?.

    thanks in advance.



  • @catalin Thank you very much for the prompt reply, I was trying to use the code found on Github (https://github.com/pycom/pycom-libraries/tree/master/pymesh/pymesh_frozen) and I was getting that error, it will be possible to use this code ?.

    Thanks in advance.



  • Hi @jclo13,

    Sorry to hear about your experience.

    I’ve just flashed a new Lopy4 with the latest v1.20.2.r4, registered to Pybytes, did all the steps from https://docs.pycom.io/pybytes/pymeshintegration/provisioning/; the device updated Pymesh firmware v.1. 20.2.rc11.

    Bellow is the log. After update, you can obtain the pymesh object using:
    pymesh = pybytes.__pymesh.__pymesh

    As explained here: https://docs.pycom.io/pymesh/simple-example/

    Firmware: 1.20.2.r4
    Pybytes: 1.6.1
    Initialized watchdog for WiFi and LTE connection with timeout 1260000 ms
    WiFi connection established
    Connected to MQTT mqtt.pybytes.pycom.io
    Pybytes connected successfully (using the built-in pybytes library)
    Configuration successfully converted to pybytes_config.json
    Pycom MicroPython 1.20.2.r4 [v1.11-ffb0e1c] on 2021-01-12; LoPy4 with ESP32
    Pybytes Version: 1.6.1
    Type "help()" for more information.
    >>> 
    >>> Pymesh configuration written to /flash/pymesh_config.json
    Requesting: manifest.json?current_ver=1.20.2.r4&sysname=LoPy4&token=f10b536c-d264-458f-a5cf-d6676ec8fba8&ota_slot=0x210000&wmac=30AEA4ECAB28&fwtype=pymesh&current_fwtype=pybytes to software.pycom.io:443 with SSL? True
    Wrapping socket
    Sending request
    Requesting: downloads/appimg/firmware_LoPy4_1.20.2.rc11-pymesh.bin to software.pycom.io:443 with SSL? True
    Wrapping socket
    Sending request
    Full Update Image detected. Restart the device to load the new firmware.
    ets Jun  8 2016 00:22:57
    
    rst:0x7 (TG0WDT_SYS_RESET),boot:0x16 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    mode:DIO, clock div:1
    load:0x3fff8020,len:8
    load:0x3fff8028,len:2128
    load:0x4009fa00,len:19760
    entry 0x400a05bc
    WMAC: 30AEA4ECAB28
    Firmware: 1.20.2.rc11
    Pybytes: 1.5.2
    Initialized watchdog for WiFi and LTE connection with timeout 1260000 ms
    WiFi connection established
    Connected to MQTT mqtt.pybytes.pycom.io
    Pybytes connected successfully (using the built-in pybytes library)
    Set MAC in config file as 8121069065078588544
    MAC ok8121069065078588544
    Settings:{'Pymesh': {'key': 'f1a1d8f7-2f9b8274-3d17e71f-3add897c'}, 'debug': 5, 'ble_api': False, 'ble_name_prefix': 'Device-30AEA4ECAB28', 'br_prio': 0, 'MAC': 8121069065078588544, 'LoRa': {'sf': 7, 'freq': 868000000, 'region': 5, 'bandwidth': 0}, 'br_ena': False, 'autostart': True}
    ============ MESH THREAD >>>>>>>>>>> 
    15: MAC 0x70b3d549946c4480(8121069065078588544), State Detached, Single True
    ['fdde:ad00:beef:0:0:0:0:4480', 'fdde:ad00:beef:0:8c3c:4c8d:4cc:b5d5', 'fe80:0:0:0:72b3:d549:946c:4480']
    >>>>>>>>>>> DONE MESH THREAD ============ 49
    
    Pybytes configuration read from /flash/pybytes_config.json
    Pycom MicroPython 1.20.2.rc11 [v1.11-f4d850b] on 2020-07-08; LoPy4 with ESP32
    Pybytes Version: 1.5.2
    Pymesh Version: 1.0.1
    Type "help()" for more information.
    >>> os.uname()
    (sysname='LoPy4', nodename='LoPy4', release='1.20.2.rc11', version='v1.11-f4d850b on 2020-07-08', machine='LoPy4 with ESP32', lorawan='1.0.2', sigfox='1.0.1', pybytes='1.5.2', pymesh='1.0.1')
    >>> ============ MESH THREAD >>>>>>>>>>> 
    25: MAC 0x70b3d549946c4480(8121069065078588544), State Detached, Single True
    ['fdde:ad00:beef:0:0:0:0:4480', 'fdde:ad00:beef:0:8c3c:4c8d:4cc:b5d5', 'fe80:0:0:0:72b3:d549:946c:4480']
    >>>>>>>>>>> DONE MESH THREAD ============ 49
    
    ============ MESH THREAD >>>>>>>>>>> 
    35: MAC 0x70b3d549946c4480(8121069065078588544), State Detached, Single True
    ['fdde:ad00:beef:0:0:0:0:4480', 'fdde:ad00:beef:0:8c3c:4c8d:4cc:b5d5', 'fe80:0:0:0:72b3:d549:946c:4480']
    >>>>>>>>>>> DONE MESH THREAD ============ 51
    
    >>> pymesh = pybytes.__pymesh.__pymesh
    >>> ============ MESH THREAD >>>>>>>>>>> 
    55: MAC 0x70b3d549946c4480(8121069065078588544), State Leader, Single True
    ['fdde:ad00:beef:0:0:ff:fe00:fc00', 'fdde:ad00:beef:0:0:ff:fe00:3c00', 'fdde:ad00:beef:0:0:0:0:4480', 'fdde:ad00:beef:0:8c3c:4c8d:4cc:b5d5', 'fe80:0:0:0:72b3:d549:946c:4480']
    Leader: mac 0x70b3d549946c4480, rloc 0x3c00, net: 0x7b92bd9d
    Neighbors Table: None
    >>>>>>>>>>> DONE MESH THREAD ============ 111
    
    pymesh.debug_level(0)
    >>> pymesh.status_str()
    "Role 4, Single True, IPv6: ['fdde:ad00:beef:0:0:ff:fe00:fc00', 'fdde:ad00:beef:0:0:ff:fe00:3c00', 'fdde:ad00:beef:0:0:0:0:4480', 'fdde:ad00:beef:0:8c3c:4c8d:4cc:b5d5', 'fe80:0:0:0:72b3:d549:946c:4480']"
    >>>
    


  • Hello, I have the same error, I tried whit the FW version 1.20.2.rc7, rc10, r4, can you help me please?, maybe I need another FW.

    thanks in advance.


  • Global Moderator

    Hi, nowadays you can get the pymesh firmware through Pybytes: https://docs.pycom.io/pybytes/pymeshintegration/



  • Hello @catalin I want to implement pymesh but I get the same error, what is the latest version in which pymesh is included? I have tried lowering the version to 1.20.2.rc10 but y get the same error, can you help me please?

    thanks in advanced.



  • Hi @thibault and @angie92v,

    Pymesh (Mesh subclass of Lora) was excluded from build rc12. There are some licensing issues which we are trying to solve.
    Most likely, next week, I'll make a separate pymesh firmware binary release (just latest RC+pymesh module).
    As a temporary workaround, some older releases can be used, 1.20.0.rc8-9-10.



  • I had the same problem, to fix it put the version 1.20.0.rc11 and now i don't have that error but the mesh doesn't detect any neighbor and don't know how fix that


Log in to reply
 

Pycom on Twitter