This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

include Mesh Serial device into the Light Switch Mesh

Hello, I want to include Mesh Serial Example into the Mesh Light Switch example.

The aim is to allow the serial device to listen to the mesh messages.

What is the best way to do this ? Do i need to write a new Model ?

My idea was just to extend the Client Model by the Serial features but I'm not sure if it will work and before i spend a lot of time on it i better ask.

Parents
  • Hi,

     

    Do you want to let the light switch model runs autonomously on the serial node or you want to let the model run on the peer device (e.g PC) and the serial still act a just connectivity chip ? 

    If you want to let the model run on the peer device, we already do that in this guide, look for "blinking LEDs"

    But you can add a model in the serial code as well, shouldn't have any problem. 

  • I want to run the client model on the serial node or rather I want to integrate the seril communication abilities  into the client model of the mesh  light switch example. For that :
    in mesh_init(void) I added : nrf_mesh_serial_init(NULL);   
    in the start() I added : nrf_mesh_serial_enable();

    And I added all necessery files for serial communication from the mesh into the Light Switch Client Model to activate the serial communication, but  if I try to send some messages  from Server to Client the application does not work proper and after some "button messages" it seems that the Client Model application crashes.

    My aim is to build a mesh with several servers and client and one node with the serial communication abilities. All nodes should have all the necessary keys. And in the end i want to receive with this serial node all the mesh messages and send them to the host pc


    the problem is:

    1) i dont know how add the same keys to all devices by the "hand"

    2) i dont know how to receive the mesh messages with the serial node or rather i dont know how to implement the receive funktion in serial node (is it implemented allready ?)

     3) I can not use interactive.py script to send comands to the serial device, I can just receive events from serial device. Because of this unsolved problem : devzone.nordicsemi.com/.../mesh-serial-example-problem-timeout-waiting-for-event

    That's why i tried to use the Light-Switch Example and to activate the Serial Communication by the Client. Because in this example I have one provisioner and all nodes get the keys.

  • after provisioning of the light switch server+serial_enable and light switch client with the pyACI script,

    I connect to the server serial and can see this if I press the button on the client site:

    {event: MeshMessageReceivedUnicast, data: {'src': 18, 'dst': 16, 'appkey_handle': 0, 'subnet_handle': 0, 'ttl': 1, 'adv_addr_type': 1, 'adv_addr': bytearray(b'\x16\xfc\xb4\xb0\xd7\xea'), 'rssi': -30, 'actual_length': 5, 'data': bytearray(b'\xc1\x00Y\x00\x13')}}

    the problem is in this code line.

    element_index = event._data["dst"] - self.elements[0].address
    assert(element_index < len(self.elements) and element_index >= 0)

    the element_index=15 in this case but the number of the elements is 1 in this case.

  • Hi,

     It's just an update. We found a bug in the python code that we didn't update the element addresses database. 

    You can just add this code: 

          for i, e in enumerate(self.iaci.access.elements):

                    e.address = event._data["address"] + i

    At the end of Provisionee() in provisioning.py right before "else:"
    This will update the iaci database of the address.

    Please let us know if this workaround works. 

  • Hey, no did not work

    2018-07-26 14:18:50,659 - ERROR - COM11: Exception in pkt handler <bound method Access.__event_handler of <mesh.access.Access object at 0x03AC64F0>>
    2018-07-26 14:18:50,661 - ERROR - COM11: traceback: Traceback (most recent call last):
      File "C:\Users\Lab\nRF\mesh_2.1.1\scripts\interactive_pyaci\aci\aci_uart.py", line 94, in process_packet
        fun(packet)
      File "C:\Users\Lab\nRF\mesh_2.1.1\scripts\interactive_pyaci\mesh\access.py", line 209, in __event_handler
        assert(element_index < len(self.elements) and element_index >= 0)
    AssertionError

    I want to point this out to you: I use two pyACI instances one instance i run with the pure serial device to provide the provisioning process for server with serial feature enable and client. After the provisioning i use another instance of pyACI and connect to the another port to the server with serial feature enable and try to get messages send to this server.

    But this fixed partly another problem I had: to communicate from Several Clients to one Server

    devzone.nordicsemi.com/.../interactive-mesh-provisioning-and-configuration-provisioning-several-clients-problem

  • This customer has almost the same set up like your and with the fix it worked for him. Could you have a look here

    Note that you need to start the provisionee() in python on the PC when you do provisioning of the node, so that the python app can update the address of the node. 

  • What I did is fallow: i ues the pure serial device as Provisioner on COM10 and use the Server Device with serial enable on COM11 as Provisionee, start the Provisionee(device) and start to listen.

    the provisioning process works but after that i get no response from the device and I can not control anything.

    In [1]: db = MeshDB("database/example_database.json")

    In [2]: p = Provisioner(d[0], db)
    add packet recipient
    <bound method Provisioner.__event_handler of <mesh.provisioning.Provisioner object at 0x04

    In [3]: 2018-07-27 10:36:15,036 - INFO - COM10: Success
    2018-07-27 10:36:15,038 - INFO - COM10: Success
    2018-07-27 10:36:15,042 - INFO - COM10: SubnetAdd: {'subnet_handle': 0}
    2018-07-27 10:36:15,046 - INFO - COM10: AppkeyAdd: {'appkey_handle': 0}
    2018-07-27 10:36:15,050 - INFO - COM10: AppkeyAdd: {'appkey_handle': 1}



    In [4]: pe=Provisionee(d[1])
    add packet recipient
    <bound method Provisionee.__event_handler of <mesh.provisioning.Provisionee object at 0x04

    2018-07-27 10:36:50,910 - INFO - COM11: Success
                                                           2018-07-27 10:36:50,920 - INFO - CO
    In [5]: pe.listen()

    2018-07-27 10:37:04,388 - INFO - COM11: SuccessIn
    In [6]: p.scan_start()

    2018-07-27 10:37:12,056 - INFO - COM10: SuccessIn
     [7]:   2018-07-27 10:37:13,242 - INFO - COM10: Received UUID 0059ffff00000000c4e0725be36e
    In [7]: p.scan_stop()

    I2018-07-27 10:37:32,578 - INFO - COM10: Successn
    In [8]: p.provision(name="Light bulb")

    In [2018-07-27 10:37:40,290 - INFO - COM10: Provision: {'context': 0}9
    ]:      2018-07-27 10:37:40,303 - INFO - COM11: Link established
    2018-07-27 10:37:40,318 - INFO - COM10: Link established
    2018-07-27 10:37:40,372 - INFO - COM10: Received capabilities
    2018-07-27 10:37:40,374 - INFO - COM10: Number of elements: 1
    2018-07-27 10:37:40,378 - INFO - COM10: OobUse: {'context': 0}
    2018-07-27 10:37:40,571 - INFO - COM10: ECDH request received
    2018-07-27 10:37:40,581 - INFO - COM10: EcdhSecret: {'context': 0}
    2018-07-27 10:37:40,959 - INFO - COM10: Provisioning complete
    2018-07-27 10:37:40,962 - INFO - COM10:         Address(es): 0x10-0x10
    2018-07-27 10:37:40,964 - INFO - COM10:         Device key: c58ef2bd05d6876e372d719eac1972
    2018-07-27 10:37:40,967 - INFO - COM10:         Network key: 18eed9c2a56add85049ffc3c59ad0
    2018-07-27 10:37:40,969 - INFO - COM10: Adding device key to subnet 0
    2018-07-27 10:37:40,972 - INFO - COM10: Adding publication address of root element
    2018-07-27 10:37:40,984 - INFO - COM10: DevkeyAdd: {'devkey_handle': 8}
    2018-07-27 10:37:40,989 - INFO - COM10: AddrPublicationAdd: {'address_handle': 0}
    2018-07-27 10:37:40,992 - INFO - COM11: Provisioning complete
    2018-07-27 10:37:40,993 - INFO - COM11:         Address(es): 0x10-0x10
    2018-07-27 10:37:40,994 - INFO - COM11:         Device key: c58ef2bd05d6876e372d719eac1972
    2018-07-27 10:37:40,995 - INFO - COM11:         Network key: 18eed9c2a56add85049ffc3c59ad0
    2018-07-27 10:37:40,996 - INFO - COM11: Adding network key (subnet)
    2018-07-27 10:37:40,997 - INFO - COM11: Adding device key to subnet 0
    2018-07-27 10:37:40,998 - INFO - COM11: Setting the local unicast address range
    2018-07-27 10:37:41,003 - INFO - COM11: SubnetAdd: {'subnet_handle': 0}
    2018-07-27 10:37:41,005 - INFO - COM11: Provisioning link closed
    2018-07-27 10:37:41,007 - INFO - COM11: DevkeyAdd: {'devkey_handle': 1}
    2018-07-27 10:37:41,008 - INFO - COM11: Success
    2018-07-27 10:37:41,079 - INFO - COM10: Provisioning link closed
    In [9]: cc = ConfigurationClient(db)

    In [10]: d[0].model_add(cc)

    In [11]: cc.publish_set(8, 0)

    In [12]: cc.composition_data_get()

    2018-07-27 10:38:38,336 - INFO - COM10: SuccessIn
    In [13]: cc.appkey_add(0)

    In 2018-07-27 10:38:52,380 - INFO - COM10: Success[
    In [14]: cc.model_app_bind(db.nodes[0].unicast_address, 0, mt.ModelId(0, 0x59))

    2018-07-27 10:39:03,965 - INFO - COM10: Success
    In [15]: sc = SimpleOnOffClient()

    In [16]: d[0].model_add(sc)

    In [17]: sc.publish_set(0, 0)

    In [18]: sc.set(True)

    2018-07-27 10:39:44,809 - INFO - COM10: SuccessI

Reply
  • What I did is fallow: i ues the pure serial device as Provisioner on COM10 and use the Server Device with serial enable on COM11 as Provisionee, start the Provisionee(device) and start to listen.

    the provisioning process works but after that i get no response from the device and I can not control anything.

    In [1]: db = MeshDB("database/example_database.json")

    In [2]: p = Provisioner(d[0], db)
    add packet recipient
    <bound method Provisioner.__event_handler of <mesh.provisioning.Provisioner object at 0x04

    In [3]: 2018-07-27 10:36:15,036 - INFO - COM10: Success
    2018-07-27 10:36:15,038 - INFO - COM10: Success
    2018-07-27 10:36:15,042 - INFO - COM10: SubnetAdd: {'subnet_handle': 0}
    2018-07-27 10:36:15,046 - INFO - COM10: AppkeyAdd: {'appkey_handle': 0}
    2018-07-27 10:36:15,050 - INFO - COM10: AppkeyAdd: {'appkey_handle': 1}



    In [4]: pe=Provisionee(d[1])
    add packet recipient
    <bound method Provisionee.__event_handler of <mesh.provisioning.Provisionee object at 0x04

    2018-07-27 10:36:50,910 - INFO - COM11: Success
                                                           2018-07-27 10:36:50,920 - INFO - CO
    In [5]: pe.listen()

    2018-07-27 10:37:04,388 - INFO - COM11: SuccessIn
    In [6]: p.scan_start()

    2018-07-27 10:37:12,056 - INFO - COM10: SuccessIn
     [7]:   2018-07-27 10:37:13,242 - INFO - COM10: Received UUID 0059ffff00000000c4e0725be36e
    In [7]: p.scan_stop()

    I2018-07-27 10:37:32,578 - INFO - COM10: Successn
    In [8]: p.provision(name="Light bulb")

    In [2018-07-27 10:37:40,290 - INFO - COM10: Provision: {'context': 0}9
    ]:      2018-07-27 10:37:40,303 - INFO - COM11: Link established
    2018-07-27 10:37:40,318 - INFO - COM10: Link established
    2018-07-27 10:37:40,372 - INFO - COM10: Received capabilities
    2018-07-27 10:37:40,374 - INFO - COM10: Number of elements: 1
    2018-07-27 10:37:40,378 - INFO - COM10: OobUse: {'context': 0}
    2018-07-27 10:37:40,571 - INFO - COM10: ECDH request received
    2018-07-27 10:37:40,581 - INFO - COM10: EcdhSecret: {'context': 0}
    2018-07-27 10:37:40,959 - INFO - COM10: Provisioning complete
    2018-07-27 10:37:40,962 - INFO - COM10:         Address(es): 0x10-0x10
    2018-07-27 10:37:40,964 - INFO - COM10:         Device key: c58ef2bd05d6876e372d719eac1972
    2018-07-27 10:37:40,967 - INFO - COM10:         Network key: 18eed9c2a56add85049ffc3c59ad0
    2018-07-27 10:37:40,969 - INFO - COM10: Adding device key to subnet 0
    2018-07-27 10:37:40,972 - INFO - COM10: Adding publication address of root element
    2018-07-27 10:37:40,984 - INFO - COM10: DevkeyAdd: {'devkey_handle': 8}
    2018-07-27 10:37:40,989 - INFO - COM10: AddrPublicationAdd: {'address_handle': 0}
    2018-07-27 10:37:40,992 - INFO - COM11: Provisioning complete
    2018-07-27 10:37:40,993 - INFO - COM11:         Address(es): 0x10-0x10
    2018-07-27 10:37:40,994 - INFO - COM11:         Device key: c58ef2bd05d6876e372d719eac1972
    2018-07-27 10:37:40,995 - INFO - COM11:         Network key: 18eed9c2a56add85049ffc3c59ad0
    2018-07-27 10:37:40,996 - INFO - COM11: Adding network key (subnet)
    2018-07-27 10:37:40,997 - INFO - COM11: Adding device key to subnet 0
    2018-07-27 10:37:40,998 - INFO - COM11: Setting the local unicast address range
    2018-07-27 10:37:41,003 - INFO - COM11: SubnetAdd: {'subnet_handle': 0}
    2018-07-27 10:37:41,005 - INFO - COM11: Provisioning link closed
    2018-07-27 10:37:41,007 - INFO - COM11: DevkeyAdd: {'devkey_handle': 1}
    2018-07-27 10:37:41,008 - INFO - COM11: Success
    2018-07-27 10:37:41,079 - INFO - COM10: Provisioning link closed
    In [9]: cc = ConfigurationClient(db)

    In [10]: d[0].model_add(cc)

    In [11]: cc.publish_set(8, 0)

    In [12]: cc.composition_data_get()

    2018-07-27 10:38:38,336 - INFO - COM10: SuccessIn
    In [13]: cc.appkey_add(0)

    In 2018-07-27 10:38:52,380 - INFO - COM10: Success[
    In [14]: cc.model_app_bind(db.nodes[0].unicast_address, 0, mt.ModelId(0, 0x59))

    2018-07-27 10:39:03,965 - INFO - COM10: Success
    In [15]: sc = SimpleOnOffClient()

    In [16]: d[0].model_add(sc)

    In [17]: sc.publish_set(0, 0)

    In [18]: sc.set(True)

    2018-07-27 10:39:44,809 - INFO - COM10: SuccessI

Children
  • Hi,

     

    Could you post the full log of Provisioner and provisionee ? I assume you should have separate python windows to control them. 

    Make sure you declare the simple on of server on the provisionee as well (This I believe has not been implemented in our python code, you need to implement one). 

  • Ok, ill try to implement the SimpleOnOffServer. Can you say me why do I need this ? I dont see the full puzzle

  • Ok there is my first try to implement SimpleOnOffServer:

    class SimpleOnOffServer(Model):
        SIMPLE_ON_OFF_STATUS = Opcode(0xc4, 0x59, "Simple OnOff Status")
        SIMPLE_ON_OFF_SET = Opcode(0xc1, 0x59, "Simple OnOff Set")
        SIMPLE_ON_OFF_GET = Opcode(0xc2, 0x59, "Simple OnOff Get")
        SIMPLE_ON_OFF_SET_UNACKNOWLEDGED = Opcode(0xc3, 0x59, "Simple OnOff Set Unacknowledged")
        ON_OF_STATE = 0
    
        def __init__(self):
            self.opcodes = [
                (self.SIMPLE_ON_OFF_SET, self.__simple_on_off_status_handler),
                (self.SIMPLE_ON_OFF_GET, self.__simple_on_off_status_handler),
                (self.SIMPLE_ON_OFF_SET_UNACKNOWLEDGED, self.__simple_on_off_status_handler)
            ]
            self.__tid = 0
            super(SimpleOnOffServer, self).__init__(self.opcodes)
    
        @property
        def _tid(self):
            tid = self.__tid
            self.__tid += 1
            if self.__tid >= 255:
                self.__tid = 0
            return tid

    1) the problem is, in access.py there is no access_model_publish() or accecc_model_reply()

    just the send method and I don't know how to implement this, that why I use the send(opcode,message) with

    opcode=SIMPLE_ON_OFF_STATUS

    2) At the moment i still does not work and I am not sure that I have implemented the OnOff Server correct and whether I use this Server in correct context

    Provisioner Log:

    C:\Users\AEH4Lab\nRF\mesh_2.1.1\scripts\interactive_pyaci>python interactive_pyaci.py -d COM10 --no-logfile

        To control your device, use d[x], where x is the device index.
        Devices are indexed based on the order of the COM ports specified by the -d option.
        The first device, d[0], can also be accessed using device.

        Type d[x]. and hit tab to see the available methods.

    add packet recipient
    <bound method Access.__event_handler of <mesh.access.Access object at 0x03AC6830>>
    add packet recipient
    <bound method Interactive.__event_handler of <__main__.Interactive object at 0x03AC6750>>
    Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)]
    Type 'copyright', 'credits' or 'license' for more information
    IPython 6.4.0 -- An enhanced Interactive Python. Type '?' for help.

    In [1]: 2018-07-30 12:55:37,932 - ERROR - COM10: Invalid packet: bytearray(b'\x00')
    2018-07-30 12:55:38,497 - INFO - COM10: Device rebooted.
    In [1]: db = MeshDB("database/example_database.json")

    In [2]: p = Provisioner(device, db)
    add packet recipient
    <bound method Provisioner.__event_handler of <mesh.provisioning.Provisioner object at 0x041FDF50>>

    In [3]: 2018-07-30 12:59:11,213 - INFO - COM10: Success
    2018-07-30 12:59:11,214 - INFO - COM10: Success
    2018-07-30 12:59:11,217 - INFO - COM10: SubnetAdd: {'subnet_handle': 0}
    2018-07-30 12:59:11,219 - INFO - COM10: AppkeyAdd: {'appkey_handle': 0}
    2018-07-30 12:59:11,222 - INFO - COM10: AppkeyAdd: {'appkey_handle': 1}
    In [3]: p.scan_start()


    In [4]: 2018-07-30 12:59:17,618 - INFO - COM10: Received UUID 0059ffff00000000c4e0725be36e2477 with RSSI: -35 dB
    In [4]: p.scan_stop()

    2018-07-30 12:59:23,919 - INFO - COM10: Success
    In [5]: p.provision(name="Light bulb")

    In [2018-07-30 12:59:29,999 - INFO - COM10: Provision: {'context': 0}6
    ]:      2018-07-30 12:59:30,013 - INFO - COM10: Link established
    2018-07-30 12:59:30,067 - INFO - COM10: Received capabilities
    2018-07-30 12:59:30,070 - INFO - COM10: Number of elements: 1
    2018-07-30 12:59:30,075 - INFO - COM10: OobUse: {'context': 0}
    2018-07-30 12:59:30,298 - INFO - COM10: ECDH request received
    2018-07-30 12:59:30,308 - INFO - COM10: EcdhSecret: {'context': 0}
    2018-07-30 12:59:30,636 - INFO - COM10: Provisioning complete
    2018-07-30 12:59:30,638 - INFO - COM10:         Address(es): 0x10-0x10
    2018-07-30 12:59:30,640 - INFO - COM10:         Device key: ddf8ee131ea34be4575fa67694f52ca7
    2018-07-30 12:59:30,643 - INFO - COM10:         Network key: 18eed9c2a56add85049ffc3c59ad0e12
    2018-07-30 12:59:30,645 - INFO - COM10: Adding device key to subnet 0
    2018-07-30 12:59:30,647 - INFO - COM10: Adding publication address of root element
    2018-07-30 12:59:30,659 - INFO - COM10: DevkeyAdd: {'devkey_handle': 8}
    2018-07-30 12:59:30,662 - INFO - COM10: AddrPublicationAdd: {'address_handle': 0}
    2018-07-30 12:59:30,731 - INFO - COM10: Provisioning link closed
    In [6]: cc = ConfigurationClient(db)

    In [7]: device.model_add(cc)

    In [8]: cc.publish_set(8, 0)

    In [9]: cc.composition_data_get()

    2018-07-30 13:00:08,871 - INFO - COM10: SuccessI
    In [10]: cc.appkey_add(0)

    2018-07-30 13:01:14,059 - INFO - COM10: Success
    In [11]: cc.model_app_bind(db.nodes[0].unicast_address, 0, mt.ModelId(0, 0x59))

    2018-07-30 13:01:22,205 - INFO - COM10: Success
    In [12]: sc = SimpleOnOffClient()

    In [13]: device.model_add(sc)

    In [14]: sc.publish_set(0, 0)

    In [15]: sc.set(True)

    2018-07-30 13:01:51,189 - INFO - COM10: Success
    In [16]:

    As you can see there is no response from the server after Provisioning Process

    Provisionee Log:

    In [2]: send(cmd.Echo("Test"))

    In [3]: 2018-07-30 12:57:11,885 - INFO - COM11: {event: DeviceEchoRsp, data: {'data': bytearray(b'Test')}}
    pe=Provisionee(device)
    add packet recipient
    <bound method Provisionee.__event_handler of <mesh.provisioning.Provisionee object at 0x03CE0070>>

    In [4]: 2018-07-30 12:57:29,531 - INFO - COM11: Success
    2018-07-30 12:57:29,536 - INFO - COM11: Success
    ss=SimpleOnOffServer()

    In [5]: device.model_add(ss)

    In [6]: ss.publish_set(0,0)

    In [7]: pe.listen()

    In [8]: 2018-07-30 12:58:40,869 - INFO - COM11: Success
    2018-07-30 12:59:30,002 - INFO - COM11: Link established
    2018-07-30 12:59:30,644 - INFO - COM11: Provisioning complete
    2018-07-30 12:59:30,644 - INFO - COM11: Address(es): 0x10-0x10
    2018-07-30 12:59:30,644 - INFO - COM11: Device key: ddf8ee131ea34be4575fa67694f52ca7
    2018-07-30 12:59:30,645 - INFO - COM11: Network key: 18eed9c2a56add85049ffc3c59ad0e12
    2018-07-30 12:59:30,645 - INFO - COM11: Adding network key (subnet)
    2018-07-30 12:59:30,645 - INFO - COM11: Adding device key to subnet 0
    2018-07-30 12:59:30,646 - INFO - COM11: Setting the local unicast address range
    2018-07-30 12:59:30,653 - INFO - COM11: SubnetAdd: {'subnet_handle': 0}
    2018-07-30 12:59:30,655 - INFO - COM11: DevkeyAdd: {'devkey_handle': 1}
    2018-07-30 12:59:30,657 - INFO - COM11: Success
    2018-07-30 12:59:30,664 - INFO - COM11: Provisioning link closed

  • Hi , 

     

    You would need to define  the server on the python code to be able to handle the event comes to your server model implemented on the server node.

    This is similar to the provisionee implemented in provisioning.py and the provisionee.c implemented in the nRF52 code. 

    But of course you can chose to implement everything on the python code instead. 

    In your python code I don't see you implemented "__simple_on_off_status_handler()" , without that how do you expect it to print out anything ? 

    I assume when you sent the command from the client on the python code, you can see the light physically changed on the NRF52 server+serial node ? This is what you should already have after you follow the instruction here

     

  • I have implemented the status_handler but pasted it incorrect. There is the full code I use for the Server :

    class SimpleOnOffServer(Model):
        SIMPLE_ON_OFF_STATUS = Opcode(0xc4, 0x59, "Simple OnOff Status")
        SIMPLE_ON_OFF_SET = Opcode(0xc1, 0x59, "Simple OnOff Set")
        SIMPLE_ON_OFF_GET = Opcode(0xc2, 0x59, "Simple OnOff Get")
        SIMPLE_ON_OFF_SET_UNACKNOWLEDGED = Opcode(0xc3, 0x59, "Simple OnOff Set Unacknowledged")
        ON_OF_STATE = 0
    
        def __init__(self):
            self.opcodes = [
                (self.SIMPLE_ON_OFF_SET, self.__simple_on_off_status_handler),
                (self.SIMPLE_ON_OFF_GET, self.__simple_on_off_status_handler),
                (self.SIMPLE_ON_OFF_SET_UNACKNOWLEDGED, self.__simple_on_off_status_handler)
            ]
            self.__tid = 0
            super(SimpleOnOffServer, self).__init__(self.opcodes)
    
        @property
        def _tid(self):
            tid = self.__tid
            self.__tid += 1
            if self.__tid >= 255:
                self.__tid = 0
            return tid
    
        def __simple_on_off_status_handler(self, opcode, message):
    
            if opcode == self.SIMPLE_ON_OFF_GET:
                message = bytearray()
                message += struct.pack("<BB", int(self.ON_OF_STATE), self._tid)
                self.send(self.SIMPLE_ON_OFF_STATUS, message)
            elif opcode == self.SIMPLE_ON_OFF_SET:
                self.ON_OF_STATE = message.data[0]
                message = bytearray()
                message += struct.pack("<BB", int(self.ON_OF_STATE), self._tid)
                self.send(self.SIMPLE_ON_OFF_STATUS, message)
            elif opcode == self.SIMPLE_ON_OFF_SET_UNACKNOWLEDGED:
                self.ON_OF_STATE = message.data[0]
    

    this is the problem I can not see any light physical change  on my nRF52840 after I do the provisioning and try to switch it on.

    1) If I don't do the : pe=Provisionee(devide) pe.listen() on the server+serial site and do the provisioning process like in the link i can switch the light on and off via sc.set(True) and i can even sent messages to serial port on pc but i get the error like I said above.

    2) And if I do the pe=Provisionee(devide) pe.listen() process on server+serial I don't get any response from the server+serial after provisioning process and i can not switch the light on, to see this look on Provisioner Log I posted above.

Related