The Pymesh BLE library provides support for connecting to a BLE Mesh Network with various Server and Client models.
For examples, please check the section Pymesh BLE Examples.
Pymesh BLE features:
Initializes the BLE Mesh module with the pre-configured Elements and Models.
name
is the name which will be used to identify the device during Provisioningauth
is the Out-Of-Band (OOB) method. Currently BLE_Mesh.OOB_OUTPUT
is supported. Without specifying this argument, NO_OOB
will be used during provisioning.callback
is the callback to be registered. It must have the following arguments:
event
returns current event of provisioning.oob_pass
returns the generated pass in case of BLE_Mesh.OOB_OUTPUT
.Enable provisioning bearers to get the device ready for provisioning. If OOB is enabled, the callback is used to inform the user about OOB information.
bearer
is the transport data protocol between endpoints, can be BLE_Mesh.PROV_ADV
and/or BLE_Mesh.PROV_GATT
.Resets the Node Provisioning information.
This API creates a new BLE_Mesh_Element object. The BLE_Mesh_Element on concept level is equivalent to the Element in the BLE Mesh terminology.
primary
shows whether this new Element will act as the Primary Element of the Node. When a Primary Element is created, the corresponding Configuration Server Model is also automatically created. There can only be 1 Primary Element per Node.feature
shows what features to enable on the new Element. It is an ORED combination of BLE_Mesh.RELAY
, BLE_Mesh.LOW_POWER
, BLE_Mesh.GATT_PROXY
, BLE_Mesh.FRIEND
ttl
is the default Time To Live value of the packets belonging to the new ElementThis API creates a new BLE_Mesh_Model object. The BLE_Mesh_Model on concept level is equivalent to the Model in the BLE Mesh terminology.
type
is the type of the new Model.server_client
shows whether the new Model will act as a Server or Client.callback
is the user defined callback to call when any event happens on the Model. It accepts 3 parameters: new_state
, event
, op_code
. The new_state
is the corresponding state of BLE_Mesh_Model, the event
and the op_code
are belonging of the BLE Mesh packet received.value
is the initial value represented by the Model.sen_min
is the minimum value of Sensor State in case of Sensor Model.sen_max
is the maximum value of Sensor State in case of Sensor Model.sen_res
is the resolution of Sensor State in case of Sensor Model.Gets the State of the Sensor Model. If called from Server Model, returnes with State, in case of Client Model, it sends a Get Message, and returns State through the registered callback.
addr
is the address of the remote Node to send the update message.app_idx
is the index of one of the registered Application IDs to use when sending out the message.state_type
is the type of Get State.Sets the State of the Sensor Model. If called from Server Model, sets State directly, in case of Client Model, it sends a Set Message, and updates State.
state
is the new value to update the current value with.addr
is the address of the remote Node to send the update message.app_idx
is the index of one of the registered Application IDs to use when sending out the message.state_type
is the type of Set State.Calling this function only makes sense when the BLE_Mesh_Model is a Server Model. It sends a Status message with the State to the Client Model(s).
addr
is the address of the remote Node to send the update message.app_idx
is the index of one of the registered Application IDs to use when sending out the message.state_type
is the type of Status State.BLE_Mesh.PROV_ADV
, BLE_Mesh.PROV_GATT
, BLE_Mesh.PROV_NONE
BLE_Mesh.RELAY
, BLE_Mesh.LOW_POWER
, BLE_Mesh.GATT_PROXY
, BLE_Mesh.FRIEND
BLE_Mesh.OOB_INPUT
, BLE_Mesh.OOB_OUTPUT
BLE_Mesh.ADDR_ALL_NODES
, BLE_Mesh.ADDR_PUBLISH
BLE_Mesh.GEN_ONOFF
, BLE_Mesh.GEN_LEVEL
, BLE_Mesh.GEN_SENSOR
, BLE_Mesh.GEN_SENSOR_SETUP
BLE_Mesh.SERVER
, BLE_Mesh.CLIENT
BLE_Mesh.STATE_ONOFF
, BLE_Mesh.STATE_LEVEL
, BLE_Mesh.STATE_LEVEL_DELTA
, BLE_Mesh.STATE_LEVEL_MOVE
, BLE_Mesh.SEN_DESCRIPTOR
, BLE_Mesh.SEN
, BLE_Mesh.SEN_COLUMN
, BLE_Mesh.SEN_SERIES
, BLE_Mesh.SEN_SET_CADENCE
, BLE_Mesh.SEN_SETTINGS
, BLE_Mesh.SEN_SETTING
BLE_Mesh.PROV_REGISTER_EVT
, BLE_Mesh.PROV_ENABLE_EVT
, BLE_Mesh.PROV_DISABLE_EVT
, BLE_Mesh.LINK_OPEN_EVT
, BLE_Mesh.LINK_CLOSE_EVT
, BLE_Mesh.PROV_COMPLETE_EVT
, BLE_Mesh.PROV_RESET_EVT
, BLE_Mesh.PROV_OUTPUT_OOB_REQ_EVT
, BLE_Mesh.PROV_INPUT_OOB_REQ_EVT