<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Can&#x27;t use Bluetooth.BLE_Mesh on Wipy 3 board. Why?]]></title><description><![CDATA[<p dir="auto">Hi!</p>
<p dir="auto">I have some Wipy 3 boards that I want to create a Bluetooth mesh with by using Pymesh BLE. I have started off by following <a href="https://docs.pycom.io/tutorials/networkprotocols/blemesh/" target="_blank" rel="noopener noreferrer nofollow">the sensor example in this link</a>.</p>
<p dir="auto">Here is my code for creating a Pymesh BLE server:</p>
<pre><code>from network import Bluetooth
from hardware.rgb_led import RGBLed
import time
from machine import Timer

class BluetoothMeshServer:

    bluetooth = None
    model_server = None
    ble_mesh = None

    def __init__(self):
        pass

    def start(self):
        BLE_Mesh = Bluetooth.BLE_Mesh

        # BLE Mesh module
        # self.ble_mesh = Bluetooth.BLE_Mesh.init(name=&quot;PYCOM-ESP-BLE-MESH&quot;, *, auth=0, callback=None)
        self.ble_mesh = Bluetooth.BLE_Mesh.init(name=&quot;xxx&quot;, auth=0, callback=None)

        # Need to turn ON Bluetooth before using BLE Mesh
        self.bluetooth = Bluetooth()

        # Create a Primary Element with GATT Proxy feature and add a Server model to the Element
        element = self.ble_mesh.create_element(primary=True, feature=self.ble_mesh.GATT_PROXY)
        self.model_server = element.add_model(self.ble_mesh.SENSOR, self.ble_mesh.SERVER, sen_min = 0, sen_max = 59, sen_res = 1)

        # Initialize self.ble_mesh
        self.ble_mesh.init(&quot;Pycom Sensor Server&quot;, callback=self.prov_callback)

        # Turn on Provisioning Advertisement
        self.ble_mesh.set_node_prov(self.ble_mesh.PROV_ADV|self.ble_mesh.PROV_GATT)

        # Sensor takes measurement every 1 second
        Timer.Alarm(self.read_sensor, 1, periodic=True)

        # Sensor send status every 5 seconds
        Timer.Alarm(self.status_sensor, 5, periodic=True)

    def read_sensor(self, alarm):
        # In this example sensor reads local seconds
        if(device_provisioned):
            self.model_server.set_state(time.localtime()[5])
            print(&quot;SENSOR | State: &quot;, self.model_server.get_state())

    def status_sensor(self, alarm):
        if (device_provisioned):
            self.model_server.status_state()

    def prov_callback(self, event, oob_pass):
        global device_provisioned
        if(event == self.ble_mesh.PROV_REGISTER_EVT or event == self.ble_mesh.PROV_RESET_EVT):
            # Yellow if not Provision yet or Reset
            RGBLed.turn_yellow()
            device_provisioned = False
        if(event == self.ble_mesh.PROV_COMPLETE_EVT):
            # Green if Provisioned
            RGBLed.turn_green
            device_provisioned = True
</code></pre>
<p dir="auto">The trouble I'm having is that the line:</p>
<pre><code>        BLE_Mesh = Bluetooth.BLE_Mesh
</code></pre>
<p dir="auto">throws an exception in the terminal. Here is the error output from the terminal:</p>
<pre><code>Traceback (most recent call last):
  File &quot;main.py&quot;, line 11, in &lt;module&gt;
  File &quot;lib/bluetooth_mesh_server.py&quot;, line 16, in start
AttributeError: type object 'Bluetooth' has no attribute 'BLE_Mesh'
Pycom MicroPython 1.20.2.r6 [v1.11-c5a0a97] on 2021-10-28; WiPy with ESP32
Pybytes Version: 1.7.1
Type &quot;help()&quot; for more information.
</code></pre>
<p dir="auto">As you can see, the error says &quot;AttributeError: type object 'Bluetooth' has no attribute 'BLE_Mesh'&quot;. Why? How do I use BLE_Mesh with Wipy 3 boards to create a Bluetooth mesh?</p>
<p dir="auto">Thanks!</p>
]]></description><link>https://forum.pycom.io/topic/7414/can-t-use-bluetooth-ble_mesh-on-wipy-3-board-why</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Jul 2026 18:36:03 GMT</lastBuildDate><atom:link href="https://forum.pycom.io/topic/7414.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 30 Dec 2021 04:20:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Can&#x27;t use Bluetooth.BLE_Mesh on Wipy 3 board. Why? on Thu, 30 Dec 2021 04:20:04 GMT]]></title><description><![CDATA[<p dir="auto">Hi!</p>
<p dir="auto">I have some Wipy 3 boards that I want to create a Bluetooth mesh with by using Pymesh BLE. I have started off by following <a href="https://docs.pycom.io/tutorials/networkprotocols/blemesh/" target="_blank" rel="noopener noreferrer nofollow">the sensor example in this link</a>.</p>
<p dir="auto">Here is my code for creating a Pymesh BLE server:</p>
<pre><code>from network import Bluetooth
from hardware.rgb_led import RGBLed
import time
from machine import Timer

class BluetoothMeshServer:

    bluetooth = None
    model_server = None
    ble_mesh = None

    def __init__(self):
        pass

    def start(self):
        BLE_Mesh = Bluetooth.BLE_Mesh

        # BLE Mesh module
        # self.ble_mesh = Bluetooth.BLE_Mesh.init(name=&quot;PYCOM-ESP-BLE-MESH&quot;, *, auth=0, callback=None)
        self.ble_mesh = Bluetooth.BLE_Mesh.init(name=&quot;xxx&quot;, auth=0, callback=None)

        # Need to turn ON Bluetooth before using BLE Mesh
        self.bluetooth = Bluetooth()

        # Create a Primary Element with GATT Proxy feature and add a Server model to the Element
        element = self.ble_mesh.create_element(primary=True, feature=self.ble_mesh.GATT_PROXY)
        self.model_server = element.add_model(self.ble_mesh.SENSOR, self.ble_mesh.SERVER, sen_min = 0, sen_max = 59, sen_res = 1)

        # Initialize self.ble_mesh
        self.ble_mesh.init(&quot;Pycom Sensor Server&quot;, callback=self.prov_callback)

        # Turn on Provisioning Advertisement
        self.ble_mesh.set_node_prov(self.ble_mesh.PROV_ADV|self.ble_mesh.PROV_GATT)

        # Sensor takes measurement every 1 second
        Timer.Alarm(self.read_sensor, 1, periodic=True)

        # Sensor send status every 5 seconds
        Timer.Alarm(self.status_sensor, 5, periodic=True)

    def read_sensor(self, alarm):
        # In this example sensor reads local seconds
        if(device_provisioned):
            self.model_server.set_state(time.localtime()[5])
            print(&quot;SENSOR | State: &quot;, self.model_server.get_state())

    def status_sensor(self, alarm):
        if (device_provisioned):
            self.model_server.status_state()

    def prov_callback(self, event, oob_pass):
        global device_provisioned
        if(event == self.ble_mesh.PROV_REGISTER_EVT or event == self.ble_mesh.PROV_RESET_EVT):
            # Yellow if not Provision yet or Reset
            RGBLed.turn_yellow()
            device_provisioned = False
        if(event == self.ble_mesh.PROV_COMPLETE_EVT):
            # Green if Provisioned
            RGBLed.turn_green
            device_provisioned = True
</code></pre>
<p dir="auto">The trouble I'm having is that the line:</p>
<pre><code>        BLE_Mesh = Bluetooth.BLE_Mesh
</code></pre>
<p dir="auto">throws an exception in the terminal. Here is the error output from the terminal:</p>
<pre><code>Traceback (most recent call last):
  File &quot;main.py&quot;, line 11, in &lt;module&gt;
  File &quot;lib/bluetooth_mesh_server.py&quot;, line 16, in start
AttributeError: type object 'Bluetooth' has no attribute 'BLE_Mesh'
Pycom MicroPython 1.20.2.r6 [v1.11-c5a0a97] on 2021-10-28; WiPy with ESP32
Pybytes Version: 1.7.1
Type &quot;help()&quot; for more information.
</code></pre>
<p dir="auto">As you can see, the error says &quot;AttributeError: type object 'Bluetooth' has no attribute 'BLE_Mesh'&quot;. Why? How do I use BLE_Mesh with Wipy 3 boards to create a Bluetooth mesh?</p>
<p dir="auto">Thanks!</p>
]]></description><link>https://forum.pycom.io/post/39744</link><guid isPermaLink="true">https://forum.pycom.io/post/39744</guid><dc:creator><![CDATA[Tobias Eliasson]]></dc:creator><pubDate>Thu, 30 Dec 2021 04:20:04 GMT</pubDate></item><item><title><![CDATA[Reply to Can&#x27;t use Bluetooth.BLE_Mesh on Wipy 3 board. Why? on Thu, 30 Dec 2021 09:21:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/9475">@Tobias-Eliasson</a> I believe you need to enable Pymesh via Pybytes (and accept the associated license) before you can use it. See <a href="https://docs.pycom.io/pybytes/pymeshintegration/provisioning/" target="_blank" rel="noopener noreferrer nofollow">https://docs.pycom.io/pybytes/pymeshintegration/provisioning/</a> for info.</p>
]]></description><link>https://forum.pycom.io/post/39745</link><guid isPermaLink="true">https://forum.pycom.io/post/39745</guid><dc:creator><![CDATA[jcaron]]></dc:creator><pubDate>Thu, 30 Dec 2021 09:21:20 GMT</pubDate></item></channel></rss>