Jump to content

ESP32 Brick MQTT Bricklet not set


Recommended Posts

Posted

Hi,
I have created new ESP32 Brick firmware using VS Code and PlatformIO.
Added to esp32.ini (snippet):

custom_backend_modules = ESP32 Brick
                         Mqtt
                         Mqtt Auto Discovery

custom_frontend_modules = Device Name
                          Mqtt

custom_frontend_components = Proxy
                             Network Group $ Open
                               Mqtt
custom_frontend_status_components = Device Name
                                    Mqtt

and set default_envs = esp32

Successfully build and uploaded to the ESP32 Brick > firmware 2.1.0+68fe6da7 (created 10/26/2025 07:51:19 PM)

In the ESP32 brick web interface enabled MQTT, set broker IP and removed topic prefix.
After reboot, the log shows:
7,151 | mqtt             | Connected to broker at mqtt://ip-address:1883.

Tested to set the color of the rgbled, but nothing happens:
mosquitto_pub -I esp32-Zji -t tinkerforge/request/rgb_led_v2_bricklet/Jng/set_rgb_value -m '{"r":0,"g":127,"b":130}'

Opened 2 terminals:
1. Running moqsquitto broker. Log entry:
1761511274: New client connected from 127.0.0.1:50612 as esp32-Zji41609 (p2, c1, k60).
1761511274: Client esp32-Zji41609 disconnected.

2. Running mosquitto_sub -v -t 'tinkerforge/#'. Log entries:
tinkerforge/request/rgb_led_v2_bricklet/Jng/set_rgb_value {"r":0, "g":127, "b":120}
tinkerforge/request/rgb_led_v2_bricklet/Jng/set_rgb_value {"r":0,"g":127,"b":130}

and some MQTT related:

tinkerforge/mqtt/config_modified {"modified":3}
tinkerforge/mqtt/config {"enable_mqtt":true,"broker_host":"NNN.NNN.NNN.NNN","broker_port":1883,"broker_username":"","broker_password":"","global_topic_prefix":"","client_name":"esp32-Zji","interval":1,"protocol":0,"cert_id":-1,"client_cert_id":-1,"client_key_id":-1,"path":"","read_only":false}
tinkerforge/mqtt/state {"connection_state":2,"connection_start":7780,"connection_end":0,"last_error":0}
tinkerforge/mqtt/auto_discovery_config_modified {"modified":3}
tinkerforge/mqtt/auto_discovery_config {"auto_discovery_mode":0,"auto_discovery_prefix":"homeassistant"}


Have also tried several topic prefix, but no state change.

Any idea what is missing?
 

Posted

The MQTT module for ESP32 bricks is not an implementation of the MQTT bindings (https://www.tinkerforge.com/en/doc/Software/API_Bindings_MQTT.html#api-bindings-mqtt) that allow you to control Bricklets via MQTT. You have to run the MQTT bindings on some PC, Raspberry Pi, etc. and can then use the unmodified ESP32 firmware to control attached Bricklets.

If you want to build a custom firmware, you have to implement / pass-through calls to the Bricklets yourself, as is described here: https://www.tinkerforge.com/en/doc/Tutorials/Tutorial_ESP32_Firmware/Tutorial.html This is not very convenient, but currently there is no complete implementation of the MQTT bindings that can run on the ESP32 brick directly.

Posted

OK. Thanks for clarity.

Tested in a nutshell

  • ESP32 Brick reinstalled the firmware (2.1.0) and connected RGB LED V2 Bricklet.
  • Set up a mosquitto broker and the Tinkerforge MQTT bindings on a Raspberry Pi 5 (Bookworm).
  • RPi: Started the mosquitto broker with
    mosquitto -v -c mosquitto.conf
  • RPi: Started the Tinkerforge MQTT bindings with: 
    sudo tinkerforge_mqtt --ipcon-host ESP32-BRICK-IP --broker-host RPI-BROKER-IP
  • PC: Tested successfully setting the RGB-LED-V2-Bricklet color to red, with a command like:
    mosquitto_pub.exe -h RPI-BROKER-IP -t tinkerforge/request/rgb_led_v2_bricklet/UID/set_rgb_value -m "{\"r\":100,\"g\":0,\"b\":0}"

Next want to test Home Assistant using the MQTT platform to set the color of the RGB LED V2 Bricklet connected to the ESP32 Brick.
 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...