Hardware:
- Raspberry Pi Zero W
- nRF52840 DK running Serial Example and connected to RPi via USB
- Custom nRF52840 board acting as a Vendor Model Server
Software:
- nRF SDK for Mesh v5.0.0
I'm trying to implement a vendor model that is a modified SimpleOnOff Server instance on my custom board. I've set up the opcodes and added it to the element using the guide for SimpleOnOff model. I am able to provision and bind an appkey using the interactive_pyaci guide for provisioning and configuration. However, when I get to this step:
In [16]: gc.set(True)
2020-03-24 14:51:37,274 - INFO - COM27: PacketSend: {'token': 4}
2020-03-24 14:51:37,303 - INFO - COM27: {event: MeshTxComplete, data: {'token': 4}}
2020-03-24 14:51:37,329 - INFO - COM27.GenericOnOffClient: Present OnOff: on
I do not receive my model's equivalent of the status message from the GenericOnOff example ie. the last line of this snippet. I've already created a python script mirroring generic_on_off.py's implementation:
SET_LIGHT_TEST = Opcode(0xc1, manufacturer_id, "Light Functional Test")
STATUS_GET = Opcode(0xc2, manufacturer_id, "Status Request")
STATUS = Opcode(0xc4, manufacturer_id, "Light Status")
TEST_RESULT = Opcode(0xc5, manufacturer_id, "Light Test RESULT")
def __init__(self):
self.opcodes = [
(self.STATUS, self.__light_status_handler),
(self.TEST_RESULT, self.__light_test_result_handler)
]
.....
def set(self, state):
message = bytearray()
#message += struct.pack("<BB", int(state), self._tid)
message += struct.pack("<BIHI", 1, 0, 0, 0)
self.send(self.SET_LIGHT_TEST, message)
def ___light_status_handler(self, opcode, message):
on_off = "on" if message.data[0] > 0 else "off"
self.logger.info("Present value is %s", on_off)
def ___light_test_result_handler(self, opcode, message):
ack_type, code = struct.unpack("<BL", message)
self.logger.info("Acknowledgement type: %d, code: %d", ack_type, code)
I should get both a status message and a test result message when I call the set method. I do see the message go to my custom board, and it executes the light test successfully. On RTT I was able to find that both access_model_publish() and access_model_reply() returned NRF_INVALID_PARAM. My opcodes are valid so I believe that the model is not being bound to the appkey for some reason.
Perhaps I need to do something specific with the Configuration Client on interactive_pyaci?