BT MESH: Setting values for models internally

Hello,

for a device I'm developing I need to be able to set values from an App as well as from the device itself (buttons on said device). So far everything works fine, from the outside the set and get handlers are called, from the "inside" publishing methods are called. This results in a consistent state between device and app.

However there is one case that breaks in the light_lightness_server_model:

  • Set lightness of 100 (or any value X) using the app
  • press button that sets lightness to 250 (or any value Y!=X) on the device

At this point app and device show a value of 250, which is correct.

  • now turn the lightness server off via the application (this sets a brightness of 0)

Now both ends show 0 or off.

But now comes the broken part:

  • Turn the lightness server back on using the application

The expected value would be a 250 as it was the last value that was published by the device. The actual value entering the set handler however is 100.

Why is that? Because the model handles its state internally and publishing a new state does not change whatever is held within the model.

I have looked for functions to set these values from the firmware but so far haven't found anything that works. I tried using a client within the same firmware, but that requires me to set an application key for said client as well. I tried using functions from the opcode handler list, but these require handcrafting buffers and somehow tracking transaction ids.

So my question is: Is there a simple way of just setting a value given some model?

Parents Reply Children
No Data
Related