Skip to content

ScholliYT/Datacake_MQTT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Datacake MQTT

This repository shows an implementation to connect an ESP32 to the Datacake MQTT Broker using a secured MQTTS connection.

ESP32 demo gif

The button publishes to a mqtt topic which the led is listening to.

Setup

Hardware

  • Connect a pushbutton to ESP32 Pin 34 with a pull-down resitor
  • Connect a RGB LED to pins R=33, G=32, B=35

Datacake Cloud

Create a new device and add one Field with identifier BUTTONVALUE and type Boolean.

Software

The project was made with PlatfromIO, but you can still use it with the Arduino IDE. If you want to use the Arduino IDE make sure you have the PubSubClient library installed.

  • make a copy of src/secrets_template.h to secrets.h
  • Fill in your WiFi credentials
  • Get your Access Token and place it into MQTT_USER and MQTT_PASS
  • Get your MQTT Topics as described in the Datacake docs and place them into MQTT_SUB_TOPIC and MQTT_PUB_TOPIC
    • make sure you append /BUTTONVALUE to the end of these topics