Skip to main content

build PyPI - Python Version

HomeAssistant MQTT filesystem publisher

Publish file content as an MQTT topic compatible with HomeAssistant.

It can be useful, e.g., to publish system metrics from /sys.

Quick start

  1. Install the Python package: pip install hamqtt-fs-publisher. If you want to have support for YAML configuration format install with ruamel or pyyaml extras depending on the YAML library of choice (recommended ruamel, e.g., pip install hamqtt-fs-publisher[ruamel]).
  2. Create a configuration (example in examples/config.example.yaml). It can be in either YAML or JSON format. There is a pre-generated JSON schema in hamqtt_fs_publisher/configuration.schema.json, which can be used, e.g., with VS Code (the current repository is pre-configured for config.json and config.yaml). Remember to set proper authorization details for the MQTT broker. If you are using the standard Mosquitto broker add-on in Home Assistant, please refer to the official documentation.
  3. Run hamqtt_fs_publisher --config <config_file_name>.

Note: The configuration file path could be either a relative/absolute path, or a file under /etc/hamqtt_fs_publisher or ~/.config/hamqtt_fs_publisher.

Systemd service

If you want to run this script as a systemd service you could copy the example service file from examples/hamqtt_fs_publisher@.service to either /etc/systemd/system/ or ~/.config/systemd/user/ (if you want to run it in user mode). Then copy the configuration file to one of the standard configuration directories (i.e., /etc/hamqtt_fs_publisher or ~/.config/hamqtt_fs_publisher.)

To enable and start the unit in system mode run:

$ systemd daemon-reload
$ systemd enable --now hamqtt_fs_publisher@<config_file_name>

Supported features

  • Auto-discovery in HomeAssistant.
  • Configuration with a simple YAML/JSON file.
  • Possibility to create read-only sensor device entities with values taken from a file and published to the MQTT broker periodically with set intervals.

TODO

  • Add a logger to connect/disconnect events.
  • Add an option to read a value on a button push in GUI (not only periodically).
  • Add a switch endpoint (i.e., a file writer).
  • Add a generic writer endpoint.

Metadata

Release files for hamqtt-fs-publisher 0.1.3

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

Source distribution (sdist)

Source distribution for hamqtt-fs-publisher 0.1.3
File Size Uploaded Provenance Actions
hamqtt_fs_publisher-0.1.3.tar.gz 8.7 kB Without provenance Details for hamqtt_fs_publisher-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hamqtt-fs-publisher 0.1.3
File Interpreter ABI Platform Actions
hamqtt_fs_publisher-0.1.3-py3-none-any.whl Python 3 none any Details for hamqtt_fs_publisher-0.1.3-py3-none-any.whl

Total release size: 18.0 kB

Release files / hamqtt_fs_publisher-0.1.3.tar.gz

Download URL hamqtt_fs_publisher-0.1.3.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e10727526e1960c232cda59dd2556c323489ba4fd11a7de9b5a0a5104dda1fe4
BLAKE2b-256 checksum
How to use checksums
31d11cb7597be616b0c36f20e32284a7d039165bb93d2055dc2af3c33d9232f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.10.6 Linux/5.15.0-1042-azure

Release files / hamqtt_fs_publisher-0.1.3-py3-none-any.whl

Download URL hamqtt_fs_publisher-0.1.3-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d64e66d08944e1e8ae35185f6320bbf07280b2955dfc704beeebf92a736faa65
BLAKE2b-256 checksum
How to use checksums
f2aae1c6405b0386ed0e6cddfe71876c6086752253fc50bc191197e399a2b281
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.10.6 Linux/5.15.0-1042-azure

Security for hamqtt-fs-publisher 0.1.3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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