Silvair EnOcean Proxy Server

The Silvair EnOcean Proxy Server model integrates an EnOcean switch together with Generic OnOff Server and Generic Level Server models, enabling dimming and on/off light control. It implements the Silvair EnOcean Switch Mesh Proxy Server specification.

The model initializes the Bluetooth EnOcean library. The EnOcean switch can be automatically commissioned/decommissioned if option CONFIG_BT_MESH_SILVAIR_ENOCEAN_AUTO_COMMISSION is set.

The Silvair EnOcean Proxy Server uses either one or two elements on a node. Each element handles its own button pair and has its own corresponding Generic OnOff Server and Generic Level Server models. These models should not be accessed by the user application as the Silvair EnOcean Proxy Server model uses them to send messages. The publication settings of these client models can be configured to control a specific light or a group of lights. However, the Generic OnOff Server and Generic Level Server models need to be instantiated for each element. BT_MESH_MODEL_SILVAIR_ENOCEAN_BUTTON is provided to do this, and should be used as presented below:

struct bt_mesh_silvair_enocean_srv enocean;

static struct bt_mesh_elem elements[] = {
        BT_MESH_ELEM(
      1,
                BT_MESH_MODEL_LIST(BT_MESH_MODEL_SILVAIR_ENOCEAN_BUTTON(&silvair_enocean, 0)),
                BT_MESH_MODEL_LIST(BT_MESH_MODEL_SILVAIR_ENOCEAN_SRV(&silvair_enocean))),
     BT_MESH_ELEM(
      2,
                BT_MESH_MODEL_LIST(BT_MESH_MODEL_SILVAIR_ENOCEAN_BUTTON(&silvair_enocean, 1)),
                BT_MESH_MODEL_NONE),
};

The Silvair EnOcean Proxy Server does not require any message handler callbacks.

States

None

Extended models

None

Persistent storage

If CONFIG_BT_ENOCEAN_STORE is enabled, the Silvair EnOcean Proxy Server stores the commissioned EnOcean device address.

API documentation

Header file: include/bluetooth/mesh/vnd/silvair_enocean_srv.h
Source file: subsys/bluetooth/mesh/vnd/silvair_enocean_srv.c
group bt_mesh_silvair_enocean_srv

API for the Silvair EnOcean Server.

Defines

BT_MESH_COMPANY_ID_SILVAIR
BT_MESH_MODEL_ID_SILVAIR_ENOCEAN_SRV
BT_MESH_SILVAIR_ENOCEAN_PROXY_BUTTONS
BT_MESH_MODEL_SILVAIR_ENOCEAN_SRV(_srv)

Silvair Enocean Proxy Server model entry.

Parameters
BT_MESH_MODEL_SILVAIR_ENOCEAN_BUTTON(_srv, _idx)

Model entries for a button for a Silvair Enocean Proxy Server model.

One of these should be added for each rocker switch handled by the Silvair Enocean Proxy Server instance, each on its own element. This macro includes the Generic Level Client and Generic OnOff Client.

Parameters
  • _srv[in] Pointer to a Light Lightness Server model instance.

  • _idx[in] Button index for the model entries. Must be in the range 0 to BT_MESH_SILVAIR_ENOCEAN_PROXY_BUTTONS.

Enums

enum bt_mesh_silvair_enocean_state

Silvair Enocean Proxy Server state machine state

Values:

enumerator BT_MESH_SILVAIR_ENOCEAN_STATE_IDLE

Idle state

enumerator BT_MESH_SILVAIR_ENOCEAN_STATE_WAIT

Waiting state

enumerator BT_MESH_SILVAIR_ENOCEAN_STATE_PHASE_A

Phase A state

enumerator BT_MESH_SILVAIR_ENOCEAN_STATE_PHASE_B

Phase B state

enumerator BT_MESH_SILVAIR_ENOCEAN_STATE_PHASE_C

Phase C state

enumerator BT_MESH_SILVAIR_ENOCEAN_STATE_PHASE_D

Phase D state

struct bt_mesh_silvair_enocean_srv
#include <silvair_enocean_srv.h>

Silvair Enocean Proxy Server instance.

Public Members

bt_addr_le_t addr

Enocean device address

struct bt_mesh_model_pub pub

Publish parameters

struct net_buf_simple pub_buf

Publication buffer

uint8_t pub_data[BT_MESH_MODEL_BUF_LEN(BT_MESH_SILVAIR_ENOCEAN_PROXY_OP, BT_MESH_SILVAIR_ENOCEAN_PROXY_MSG_MAXLEN)]

Publication data

struct bt_mesh_model *mod

Access model pointer.

sys_snode_t entry

Entry in global list of Enocean Proxy models.

struct bt_mesh_silvair_enocean_button
#include <silvair_enocean_srv.h>

State for each button controlled by this instance

Public Members

struct bt_mesh_lvl_cli lvl

Generic Level Client instance

struct bt_mesh_onoff_cli onoff

Generic OnOff Client instance

enum bt_mesh_silvair_enocean_state state

Current state of the state machine

bool target

Target on/off in the state machine

int tick_count

Tick counter

bool release_pending

Flag for moving to phase D

int32_t delta

Current delta

struct k_work_delayable timer

Timer used for state machine timeouts