Pymesh seems to ignore 'key' in configuration



  • Maybe it is me not understanding correctly....

    I though the 'key' in the pymesh_config should control which devices can connect to a given pymesh?

    So if I have one device with config:

    {'Pymesh': {'key': 'fc1ffeed-9fbb06a4-cda815f3-958f7275'}, 'MAC': 2, 'ble_api': False, 'ble_name_prefix': 'Device-F008D1CD09B8', 'debug': 5, 'br_prio': 0, 'LoRa': {'sf': 7, 'freq': 868000000, 'region': 5, 'bandwidth': 0}, 'br_ena': False, 'autostart': True}

    it should not be able to connect to another devices whose config is

    {'Pymesh': {'key': 'fc1ffeed-9fbb06a4-cda815f3-958f7276'}, 'MAC': 1, 'ble_api': False, 'ble_name_prefix': 'Device-3C71BF876D44', 'debug': 5, 'br_prio': 0, 'LoRa': {'sf': 7, 'freq': 868000000, 'region': 5, 'bandwidth': 0}, 'br_ena': False, 'autostart': True}
    

    (Note the different key values)

    BUT they can connect and send messages to and fro.

    If the 'key' is not used to separate devices - what is used? I don't want my device connecting to my neighbours pymesh network!

    For both devices:

    >>> uos.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')
    

    I am using the pymesh-frozen code downloaded from https://github.com/pycom/pycom-libraries/tree/master/pymesh



  • OK, I think loramesh.py, in _lora_init method needs:

        self.mesh = self.lora.Mesh(key = self.key) #start Mesh
    

    where the key has been derived by

        self.key = ubinascii.unhexlify(config.get('Pymesh').get('key').replace('-',''))
    

    in the init method of Loramesh

    If I am correct, I am frankly surprised that such a fundamental part of Pymesh has not been implemented correctly in the sample code!


Log in to reply
 

Pycom on Twitter