Decommissioning the EnOcean switch

Hello, I'm an engineer living in Japan.

【Development environment】
"SDK:nRF Connect SDK v2.4.2"
"IDE:VSCode 1.83.1"
"PCA10040(nRF52832)" x 1 (central)
"PTM215B" EnOcean × 1 (peripheral)
"PTM535BZ" + "ECO260" × 1 (peripheral)

This is a question about decommissioning EnOcean switches.

I am proceeding with development based on the enocean sample program stored in SKD.
I sent a commissioning signal from the EnOcean switch to commission the central "PCA10040 (nRF52832)"
and confirmed that it operates normally.

I have confirmed that the main function of "main.c" defines a function that calls back to EnOcean events,
and that the "enocean_commissioned" function is called during commissioning.
However, I did not understand the conditions that would cause the decommission event to occur.
I don't know if there is a way to make the EnOcean switch send a decommission signal.

■main.c (in the main function)
static const struct bt_enocean_callbacks enocean_callbacks = {
.button = enocean_button,
.sensor = enocean_sensor,
.commissioned = enocean_commissioned,
.decommissioned = enocean_decommissioned,
.loaded = enocean_loaded,
};

I have confirmed that there is a "bt_enocean_decommission" function in the EnOcean.c file, but I did not know how to use it.

Question 1)
Please tell me how to decommission EnOcean switches one by one.
It is also possible to send a decommission signal from the EnOcean switch.

Question 2)
Please let me know if there is a way to delete commissioned EnOcean switches all at once.

Thank you for your support.

Parents Reply Children
  • Thank you for your reply tesc.

    The answer was to use "bt_enocean_foreach()" if you want to decommission all EnOcean switches, so I'll try that.

    While checking the answers, I understood that there is no way to decommission EnOcean switches individually, but is my understanding correct?

    Also, am I correct in understanding that there is no way to send a decommission signal from the EnOcean switch?

    Please give me an answer.

  • Hi,

    Terutaka Takeuji said:
    While checking the answers, I understood that there is no way to decommission EnOcean switches individually, but is my understanding correct?

    It is possible to decommission EnOcean switches individually through the use of bt_enocean_decommission() if you have the bt_enocean_device structure for the EnOcean switch.

    Regards,
    Terje

  • Sorry for the late reply.
    I have an additional question for Mr. Taesuk.

    I would like to use the bt_enocean_foreach function to erase everything, but I don't know what to specify as an argument.

    "bt_enocean_foreach syntax"
    bt_enocean_foreach(bt_enocean_foreach_cb_t cb, void *user_data)

    question)
    bt_enocean_foreach has two arguments, but what should I specify for each?
    Please tell me the program code in detail.

  • I mistakenly continued on with another ticket, so I will only write the conclusion in this ticket.

    First of all, the "bt_enocean_foreach()" function is not a function for removing a commissioned EnOcean switch.
    This function executes the callback function associated with "bt_enocean_foreach()" for the number of commissioned devices (valid devices only).

    Therefore, the function that removes the EnOcean switch is the "bt_enocean_decommission()" function.

    I built it based on the "EnOcean" sample, and was able to decommission all commissioned EnOcean switches simply by editing "main.c".

    ■Delete all EnOcean switches (described in main.c)
    static void find_and_decommission(struct bt_enocean_device *dev, void *user_data)
    {
      bt_enocean_decommission(dev);
    }
    bt_enocean_foreach(find_and_decommission, NULL);

    You can remove all EnOcean switches with the above code.
    "bt_enocean_foreach()" can be called anywhere in main.c where you want to perform processing.

    I had a problem with the button interrupt processing description and was repeatedly failing, but the problem was resolved by writing the button interrupt processing as below.

    ■Button interrupt processing code
    static void button_changed(uint32_t button_state, uint32_t has_changed)
    {
      Processing content…
    }
    err = dk_buttons_init(button_changed);

    For more details, please check the following questions in Case ID: 317215.

    thank you very much.

Related