Skip to main content

MQTT Client for RP2040 based boards which integrates into Home Assistant

Project description

mqtt-home

A simple micro-python mqtt client which enables simple plug-and-play functionality and interoperability with Home Assistant.

"availability_topic": "home/wateringsystem/back/status",
"state_topic": "home/wateringsystem/back/output/solenoid3",
"command_topic": "home/wateringsystem/back/output/solenoid3/set",

The overall standard of MQTT topics that will be used going forward is: <area>/<entity>/<location>/<property>/<object>/<modifier> but there's no set requirement on structure.

topic_prefix is: <area>/<entity>/<location>

This simplifies it down to: <topic_prefix>/<property>/<object>/<modifier>

Software Setup

From a fresh Raspberry Pi Pico

Following the official Raspberry Pi Docs

  1. Hold down the bootsel button while plugging in pi pico for the first time
  2. Open Thonny with the pico plugged in
  3. Choose the micropython language selector in the bottom right hand corner of the UI
  4. Choose the latest version of Micropython and install it onto the raspberry pi

From an existing Raspberry Pi Pico with micropython installed

  1. In the top bar of Thonny, under Tools, there should be an option to Manage Packages, select that option
  2. Then search for umqtt in the package manager, there should be one called micropython-umqtt.simple and install it onto the Pi Pico.
    1. You could potentially use mpremote mpremote mip install micropython-umqtt.simple (untested) in the Thonny console when the Pi Pico is connected
  3. Clone the mqtt-home repository to a local area
  4. Create an appropriate config.json file based off the test-config.json
  5. Upload config.json, main.py, boot.py and main to the Pi Pico
  6. Manually run boot.py and main.py in Thonny to ensure that the SSID and password are correct, in addition to the Home Assistant connection.
  7. Once confirmed connected, disconnect the Pi Pico and plug it in from cold to ensure that the start up works as expected.
  8. Once the status LED is shining, that is an indication that main.py is running and the Pi Pico should be up and running!

Virtual Environment Setup

  • Using a virtual environment, install the python dependencies listed in requirements.txt by running python -m pip install -r requirements.txt

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rp2040home-0.1.9.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

RP2040Home-0.1.9-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file rp2040home-0.1.9.tar.gz.

File metadata

  • Download URL: rp2040home-0.1.9.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.4

File hashes

Hashes for rp2040home-0.1.9.tar.gz
Algorithm Hash digest
SHA256 9c2f8f97e82d2493e64b4ad1efb189d89987661acf1315ba11c8a68277792461
MD5 66634196b844d58cd92eef9ba3dc8a3e
BLAKE2b-256 b2be34e6c3a5ad39f542c916d32fd0167d6e29781443ec0c686d3afc9e50f2dc

See more details on using hashes here.

File details

Details for the file RP2040Home-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: RP2040Home-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.4

File hashes

Hashes for RP2040Home-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 dd3785f3c1eb6727fbdf4535891c3c1fa8de70bb86f3eef2343ad4fcb79628a5
MD5 46a69b872fd1353ec7b01e30e7f1f427
BLAKE2b-256 5aac933453ec668fd98b87515c95dad87ee12628b707b6399b19bdf13b6bf64e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page