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.6

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.6
File Size Uploaded Provenance
rpi2home_assistant-2.3.6.tar.gz 1.8 MB With provenance Details

Built distribution (wheel)

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

Total release size: 1.9 MB

Release files / rpi2home_assistant-2.3.6.tar.gz

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

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 18, 2026.

Transparency log

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

Download URL rpi2home_assistant-2.3.6-py3-none-any.whl
Size 31.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46d68098d03d8d6f6c2d5a370ec157f6748f014c1921da183adf6322ea487f0b
BLAKE2b-256 checksum
How to use checksums
30223d47c2c66c9251575954f192b8be814aada78e1d229dea1a560a2a83a408
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 18, 2026.

Transparency log

Security for rpi2home-assistant 2.3.6

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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for rpi2home_assistant-2.3.6.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 18, 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.

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