Pybytes registration with Lora OTAA



  • Hello!
    I was able to register Lopy4 with Pytrack with new Pybytes.
    But I don't see its registered on TTN.
    I see there is option to download config.py to local machine.
    I downloaded and checked file I have noticed parameters not the same as I created on TTN for
    'app_key': '',
    'app_eui': '',
    'app_device_eui': ''

    even I corrected file and uploaded to Lopy4, when Lopy4 started I am getting an error message

    Uploading project (flash)...
    Not safe booting, disabled in settings
    Reading file status
    Failed to read project status, uploading all files
    Creating dir lib
    [1/10] Writing file boot.py
    [2/10] Writing file config.py
    [3/10] Writing file lib/OTA.py
    [4/10] Writing file lib/mqtt.py
    [5/10] Writing file lib/mqtt_core.py
    [6/10] Writing file lib/pybytes.py
    [7/10] Writing file lib/pybytes_library.py
    [8/10] Writing file lib/pybytes_protocol.py
    [9/10] Writing file lib/terminal.py
    [10/10] Writing file main.py
    Upload done, resetting board...
    OKets Jun 8 2016 00:22:57

    rst:0x7 (TG0WDT_SYS_RESET),boot:0x17 (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:1728
    load:0x4009fa00,len:0
    load:0x4009fa00,len:14584
    entry 0x400a059c
    Using configuration config.py file from /flash folder
    WMAC: 30aea4785f7c
    Firmware: 1.17.5.b2
    WiFi connection established
    Using 8192 bytes as stack size
    Connected to MQTT mqtt.pybytes.pycom.io
    main.py was executed properly (using a firmware that does not include frozen libraries)
    Traceback (most recent call last):
    File "_main.py", line 184, in <module>
    File "/flash/lib/pybytes.py", line 60, in send_virtual_pin_value
    File "/flash/lib/pybytes_protocol.py", line 526, in send_pybytes_custom_method_values
    TypeError: unsupported types for : 'str', 'int'
    MicroPython v1.8.6-849-b9d53b40 on 2018-05-03; LoPy4 with ESP32
    Type "help()" for more information.

    Thank you



  • Thank you for your comments. I was able to get it work w/o error, but since OTAA connection is more complex I tried to use ABP, but I am facing another issue I believe with 3d parameter for ABP. I could not define it in config.py correctly.
    configuration defined to use first lora_abp first
    server': 'mqtt.pybytes.pycom.io',
    'network_preferences': ["lora_abp","wifi"],
    ABP defined as:
    abp': {
    'nwk_skey': 'xxx',
    'app_skey': 'xxx',
    'dev_addr': 'xxxxxx'
    }

    getting an error message for 3d parameter

    Using configuration config.py file from /flash folder
    WMAC: 30aea4785f7c
    Firmware: 1.17.5.b2
    Traceback (most recent call last):
    File "_main.py", line 95, in <module>
    File "/flash/lib/pybytes.py", line 30, in connect_lora_abp
    TypeError: function takes 3 positional arguments but 2 were given
    MicroPython v1.8.6-849-b9d53b40 on 2018-05-03; LoPy4 with ESP32



  • Hi @asavvin

    Pybytes assigns it's own TTN account to the device, you shouldn't change it to yours. That's probably what caused the issue if I understand it correctly.


Log in to reply
 

Pycom on Twitter