Skip to main content

rpi2home-assistant

GitHub Actions Workflow Status PyPI - Version

This project provides a Python daemon to transform a Raspberry PI into a bridge between GPIO inputs/outputs and Home Assistant, through MQTT.

In particular this software allows to:

  • sample low-voltage inputs from Raspberry GPIO pins directly (with no isolation/protection/HAT), publish them on MQTT and get them exposed to Home Assistant as binary sensors;
  • sample a wide range of electrical signals (voltages) from 3V-48V AC or DC, using a dedicated Raspberry HAT, publish them on MQTT and get them exposed to Home Assistant as binary sensors;
  • expose Raspberry GPIO output pins in Home Assistant as switches or as buttons to e.g. activate relays, using a dedicated Raspberry HAT / relay board or just drive low-voltage electrical devices;

All these features are implemented in an Home Assistant-friendly fashion. For example, this utility requires no configuration on Home Assistant-side thanks to MQTT discovery messages that are automatically published and let Home Assistant automatically discover the devices. In other words you will just need to prepare 1 configuration file (the rpi2home-assistant config file) and that's it. All properties of the exposed devices (names, icons, descriptions, etc) can be provided/customized in the rpi2home-assistant config file.

An example of a panel of sensors/actuators created using rpi2home-assistant in Home Assistant 2024.5 (sensor/switch/button names have been blurred for privacy reasons; binary sensor status is shown in Italian language):

Home Assistant screenshot

Prerequisites

See prerequisites.md.

Documentation

Installation

See install.md.

Configuration file

The configuration file of rpi2home-assistant is of course /etc/rpi2home-assistant.yaml. During the installation the default config file with dummy options is installed. It is useful to showcase the syntax. See config.yaml for the full documentation of the configuration options.

Permissions

This python code needs to run as root due to ensure access to the Raspberry I2C and GPIO peripherals.

Logs

After starting the application you can verify from the logs whether it's running successfully:

journalctl -u rpi2home-assistant --since="5min ago"

Development

See development.md.

Useful links

Very similar project, more flexible and much bigger, targeting specific sensor boards:

TODO

  • Eventually get rid of GPIOZERO + PIGPIOD which consume CPU and also force use of e.g. the queue.Queue due to the multithreading issues; replace these 2 parts with direct Raspberry PI GPIO access?

Metadata

Release files for rpi2home-assistant 2.3.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rpi2home-assistant 2.3.7
File Size Uploaded Provenance Actions
rpi2home_assistant-2.3.7.tar.gz 1.8 MB With provenance Details for rpi2home_assistant-2.3.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rpi2home-assistant 2.3.7
File Interpreter ABI Platform Actions
rpi2home_assistant-2.3.7-py3-none-any.whl Python 3 none any Details for rpi2home_assistant-2.3.7-py3-none-any.whl

Total release size: 1.9 MB

Release files / rpi2home_assistant-2.3.7.tar.gz

Download URL rpi2home_assistant-2.3.7.tar.gz
Size 1.8 MB
Tags Source
SHA-256 checksum
How to use checksums
d817ea9a336c796b9c3086ad83ff32e1486ac15b8d4fd932a1ad20c141dc1a0e
BLAKE2b-256 checksum
How to use checksums
ff8aee91b34200ce9da0fa89f766879e2204bc6a7e0007f7c7b470bd72bd4c96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Release files / rpi2home_assistant-2.3.7-py3-none-any.whl

Download URL rpi2home_assistant-2.3.7-py3-none-any.whl
Size 31.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
94f5a0ac8c79ad78642fd8408f906f03ddff19de15b3a41e2794c37a6ca8d4cb
BLAKE2b-256 checksum
How to use checksums
c254aa424a53304602b8125e8253bed179460f1c8e7d10629031787c4313b478
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Security for rpi2home-assistant 2.3.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for rpi2home_assistant-2.3.7.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page