{"id":15581718,"url":"https://github.com/unixorn/ha-mqtt-discoverable","last_synced_at":"2026-03-11T08:20:01.290Z","repository":{"id":63167662,"uuid":"557560688","full_name":"unixorn/ha-mqtt-discoverable","owner":"unixorn","description":"Python module to create MQTT entities that are automatically discovered by Home Assistant","archived":false,"fork":false,"pushed_at":"2025-05-13T06:39:59.000Z","size":786,"stargazers_count":125,"open_issues_count":21,"forks_count":31,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-13T07:38:57.246Z","etag":null,"topics":["hacktoberfest","hass","home-assistant","mqtt","mqtt-client","mqtt-discovery","mqtt-smarthome"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unixorn.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":"Contributing.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"Code_Of_Conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"unixorn","patreon":"unixorn","open_collective":null,"ko_fi":"unixorn","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":"https://www.redbubble.com/people/unixorn/shop?asc=u"}},"created_at":"2022-10-25T22:49:13.000Z","updated_at":"2025-05-13T06:39:28.000Z","dependencies_parsed_at":"2023-09-27T23:04:28.343Z","dependency_job_id":"224387f6-40d3-4d20-af61-af4d0898c87b","html_url":"https://github.com/unixorn/ha-mqtt-discoverable","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unixorn%2Fha-mqtt-discoverable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unixorn%2Fha-mqtt-discoverable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unixorn%2Fha-mqtt-discoverable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unixorn%2Fha-mqtt-discoverable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unixorn","download_url":"https://codeload.github.com/unixorn/ha-mqtt-discoverable/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254478160,"owners_count":22077675,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","hass","home-assistant","mqtt","mqtt-client","mqtt-discovery","mqtt-smarthome"],"created_at":"2024-10-02T19:53:41.603Z","updated_at":"2026-03-11T08:19:56.268Z","avatar_url":"https://github.com/unixorn.png","language":"Python","funding_links":["https://github.com/sponsors/unixorn","https://patreon.com/unixorn","https://ko-fi.com/unixorn","https://www.redbubble.com/people/unixorn/shop?asc=u"],"categories":["Python"],"sub_categories":[],"readme":"# ha-mqtt-discoverable\n\n[![License](https://img.shields.io/github/license/unixorn/ha-mqtt-discoverable.svg)](https://opensource.org/license/apache-2-0/)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![GitHub last commit (branch)](https://img.shields.io/github/last-commit/unixorn/ha-mqtt-discoverable/main.svg)](https://github.com/unixorn/ha-mqtt-discoverable)\n[![Downloads](https://static.pepy.tech/badge/ha-mqtt-discoverable)](https://pepy.tech/project/ha-mqtt-discoverable)\n\nA Python 3 module that takes advantage of Home Assistant's [MQTT discovery protocol](https://www.home-assistant.io/integrations/mqtt/#mqtt-discovery) to create sensors without having to define anything on the HA side.\n\nUsing MQTT discoverable devices lets us add new sensors and devices to HA without having to restart HA. The [ha-mqtt-discoverable-cli](https://github.com/unixorn/ha-mqtt-discoverable-cli/) module includes scripts to make it easy to create discoverable devices from the command line if you don't want to bother writing Python.\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n## Table of Contents\n\n- [Installing](#installing)\n  - [Python](#python)\n- [Supported entities](#supported-entities)\n  - [Binary sensor](#binary-sensor)\n  - [Button](#button)\n  - [Camera](#camera)\n  - [Covers](#covers)\n  - [Device](#device)\n  - [Device trigger](#device-trigger)\n  - [Image](#image)\n  - [Light](#light)\n  - [Number](#number)\n  - [Select](#select)\n  - [Sensor](#sensor)\n  - [Switch](#switch)\n  - [Text](#text)\n- [FAQ](#faq)\n  - [Using an existing MQTT client](#using-an-existing-mqtt-client)\n  - [I'm having problems on 32-bit ARM](#im-having-problems-on-32-bit-arm)\n- [Contributing](#contributing)\n- [Users of ha-mqtt-discoverable](#users-of-ha-mqtt-discoverable)\n- [Contributors](#contributors)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## Installing\n\n### Python\n\nha-mqtt-discoverable runs on Python 3.10 or later.\n\n`pip install ha-mqtt-discoverable` if you want to use it in your own python scripts. `pip install ha-mqtt-discoverable-cli` to install the `hmd` utility scripts.\n\n\u003c!-- Please keep the entities in alphabetical order --\u003e\n## Supported entities\n\nThe following Home Assistant entities are currently implemented:\n\n- Binary sensor\n- Button\n- Camera\n- Cover\n- Device\n- Device trigger\n- Image\n- Light\n- Number\n- Select\n- Sensor\n- Switch\n- Text\n\nEach entity can be associated to a device. See below for details.\n\n### Binary sensor\n\nThe following example creates a binary sensor and sets its state:\n\n```py\nfrom ha_mqtt_discoverable import Settings\nfrom ha_mqtt_discoverable.sensors import BinarySensor, BinarySensorInfo\n\n\n# Configure the required parameters for the MQTT broker\nmqtt_settings = Settings.MQTT(host=\"localhost\")\n\n# Information about the sensor\nsensor_info = BinarySensorInfo(name=\"MySensor\", device_class=\"motion\")\n\nsettings = Settings(mqtt=mqtt_settings, entity=sensor_info)\n\n# Instantiate the sensor\nmysensor = BinarySensor(settings)\n\n# Change the state of the sensor, publishing an MQTT message that gets picked up by HA\nmysensor.on()\nmysensor.off()\n\n# Or, change the state using a boolean\nmysensor.update_state(True)\nmysensor.update_state(False)\n\n# You can also set custom attributes on the sensor via a Python dict\nmysensor.set_attributes({\"my attribute\": \"awesome\"})\n```\n\n### Button\n\nThe button publishes no state, it simply receives a command from HA.\n\nYou must call `write_config` on a Button after creating it to make it discoverable.\n\n```py\nfrom ha_mqtt_discoverable import Settings\nfrom ha_mqtt_discoverable.sensors import Button, ButtonInfo\nfrom paho.mqtt.client import Client, MQTTMessage\n\n# Configure the required parameters for the MQTT broker\nmqtt_settings = Settings.MQTT(host=\"localhost\")\n\n# Information about the button\nbutton_info = ButtonInfo(name=\"test\")\n\nsettings = Settings(mqtt=mqtt_settings, entity=button_info)\n\n# To receive button commands from HA, define a callback function:\ndef my_callback(client: Client, user_data, message: MQTTMessage):\n    perform_my_custom_action()\n\n# Define an optional object to be passed back to the callback\nuser_data = \"Some custom data\"\n\n# Instantiate the button\nmy_button = Button(settings, my_callback, user_data)\n\n# Publish the button's discoverability message to let HA automatically notice it\nmy_button.write_config()\n```\n\n### Camera\n\nThe following example creates a camera entity with a topic to a camera.\n\n```py\nfrom ha_mqtt_discoverable import Settings\nfrom ha_mqtt_discoverable.sensors import Camera, CameraInfo\nfrom paho.mqtt.client import Client, MQTTMessage\n\n# Configure the required parameters for the MQTT broker\nmqtt_settings = Settings.MQTT(host=\"localhost\")\n\n# Information about the cover\ncamera_info = CameraInfo(name=\"test\", topic=\"zanzito/shared_locations/my-device\")\n\nsettings = Settings(mqtt=mqtt_settings, entity=camera_info)\n\n# To receive state commands from HA, define a callback function:\ndef my_callback(client: Client, user_data, message: MQTTMessage):\n    payload = message.payload.decode()\n    perform_my_custom_action()\n\n# Define an optional object to be passed back to the callback\nuser_data = \"Some custom data\"\n\n# Instantiate the cover\nmy_camera = Camera(settings, my_callback, user_data)\n\n# Set the initial state of the cover, which also makes it discoverable\nmy_camera.set_topic(\"zanzito/shared_locations/my-device\")  # not needed if already defined\n```\n\n### Covers\n\nA cover has five possible states `open`, `closed`, `opening`, `closing` and `stopped`. Most other entities use the states as command payload, but covers differentiate on this. The HA user can either open, close or stop it in the covers current position.\n\nCovers do not currently support tilt.\n\nA `callback` function is needed in order to parse the commands sent from HA, as the following\nexample shows:\n\n```py\nfrom ha_mqtt_discoverable import Settings\nfrom ha_mqtt_discoverable.sensors import Cover, CoverInfo\nfrom paho.mqtt.client import Client, MQTTMessage\n\n# Configure the required parameters for the MQTT broker\nmqtt_settings = Settings.MQTT(host=\"localhost\")\n\n# Information about the cover\ncover_info = CoverInfo(name=\"test\")\n\nsettings = Settings(mqtt=mqtt_settings, entity=cover_info)\n\n# To receive state commands from HA, define a callback function:\ndef my_callback(client: Client, user_data, message: MQTTMessage):\n    payload = message.payload.decode()\n    if payload == \"OPEN\":\n        # let HA know that the cover is opening\n        my_cover.opening()\n        # call function to open cover\n        open_my_custom_cover()\n        # Let HA know that the cover was opened\n        my_cover.open()\n    if payload == \"CLOSE\":\n        # let HA know that the cover is closing\n        my_cover.closing()\n        # call function to close the cover\n        close_my_custom_cover()\n        # Let HA know that the cover was closed\n        my_cover.closed()\n    if payload == \"STOP\":\n        # call function to stop the cover\n        stop_my_custom_cover()\n        # Let HA know that the cover was stopped\n        my_cover.stopped()\n\n# Define an optional object to be passed back to the callback\nuser_data = \"Some custom data\"\n\n# Instantiate the cover\nmy_cover = Cover(settings, my_callback, user_data)\n\n# Set the initial state of the cover, which also makes it discoverable\nmy_cover.closed()\n```\n\n### Device\n\nFrom the [Home Assistant documentation](https://developers.home-assistant.io/docs/device_registry_index):\n\u003e A device is a special entity in Home Assistant that is represented by one or more entities.\nA device is automatically created when an entity defines its `device` property.\nA device will be matched up with an existing device via supplied identifiers or connections, like serial numbers or MAC addresses.\n\nThe following example create a device, by associating multiple sensors to the same `DeviceInfo` instance.\n\n```py\nfrom ha_mqtt_discoverable import Settings, DeviceInfo\nfrom ha_mqtt_discoverable.sensors import BinarySensor, BinarySensorInfo\n\n# Configure the required parameters for the MQTT broker\nmqtt_settings = Settings.MQTT(host=\"localhost\")\n\n# Define the device. At least one of `identifiers` or `connections` must be supplied\ndevice_info = DeviceInfo(name=\"My device\", identifiers=\"device_id\")\n\n# Associate the sensor with the device via the `device` parameter\n# `unique_id` must also be set, otherwise Home Assistant will not display the device in the UI\nmotion_sensor_info = BinarySensorInfo(name=\"My motion sensor\", device_class=\"motion\", unique_id=\"my_motion_sensor\", device=device_info)\n\nmotion_settings = Settings(mqtt=mqtt_settings, entity=motion_sensor_info)\n\n# Instantiate the sensor\nmotion_sensor = BinarySensor(motion_settings)\n\n# Change the state of the sensor, publishing an MQTT message that gets picked up by HA\nmotion_sensor.on()\n\n# An additional sensor can be added to the same device, by re-using the DeviceInfo instance previously defined\ndoor_sensor_info = BinarySensorInfo(name=\"My door sensor\", device_class=\"door\", unique_id=\"my_door_sensor\", device=device_info)\ndoor_settings = Settings(mqtt=mqtt_settings, entity=door_sensor_info)\n\n# Instantiate the sensor\ndoor_sensor = BinarySensor(door_settings)\n\n# Change the state of the sensor, publishing an MQTT message that gets picked up by HA\ndoor_sensor.on()\n\n# The two sensors should be visible inside Home Assistant under the device `My device`\n```\n\n### Device trigger\n\nThe following example creates a device trigger and generates a trigger event:\n\n```py\nfrom ha_mqtt_discoverable import Settings\nfrom ha_mqtt_discoverable.sensors import DeviceInfo, DeviceTriggerInfo, DeviceTrigger\n\n# Configure the required parameters for the MQTT broker\nmqtt_settings = Settings.MQTT(host=\"localhost\")\n\n# Define the device. At least one of `identifiers` or `connections` must be supplied\ndevice_info = DeviceInfo(name=\"My device\", identifiers=\"device_id\")\n\n# Associate the sensor with the device via the `device` parameter\ntrigger_info = DeviceTriggerInfo(name=\"MyTrigger\", type=\"button_press\", subtype=\"button_1\", unique_id=\"my_device_trigger\", device=device_info)\n\nsettings = Settings(mqtt=mqtt_settings, entity=trigger_info)\n\n# Instantiate the device trigger\nmytrigger = DeviceTrigger(settings)\n\n# Generate a device trigger event, publishing an MQTT message that gets picked up by HA\n# Optionally include a payload as part of the event\nmytrigger.trigger(\"My custom payload\")\n```\n\n### Image\n\nThe following example creates an entity to an image url.\n\n```py\nfrom ha_mqtt_discoverable import Settings\nfrom ha_mqtt_discoverable.sensors import Image, ImageInfo\n\n# Configure the required parameters for the MQTT broker\nmqtt_settings = Settings.MQTT(host=\"localhost\")\n\n# Information about the image\nimage_info = ImageInfo(name=\"test\", url_topic=\"topic_to_publish_url_to\")\n\nsettings = Settings(mqtt=mqtt_settings, entity=image_info)\n\n# Instantiate the image\nmy_image = Image(settings)\n\n# Publish an image URL to url_topic\nmy_image.set_url(\"http://camera.local/latest.jpg\")\n```\n\n### Light\n\nThe light is different from other current sensor as it needs its payload encoded/decoded as json.\nIt is possible to set brightness, effects and the color of the light. Similar to a _switch_ it can\nalso receive 'commands' from HA that request a state change.\nIt is possible to act upon reception of this 'command', by defining a `callback` function, as the following example shows:\n\n```py\nimport json\nfrom ha_mqtt_discoverable import Settings\nfrom ha_mqtt_discoverable.sensors import Light, LightInfo\nfrom paho.mqtt.client import Client, MQTTMessage\n\n# Configure the required parameters for the MQTT broker\nmqtt_settings = Settings.MQTT(host=\"localhost\")\n\n# Information about the light\nlight_info = LightInfo(\n    name=\"test_light\",\n    brightness=True,\n    color_mode=True,\n    supported_color_modes=[\"rgb\"],\n    effect=True,\n    effect_list=[\"blink\", \"my_custom_effect\"])\n\nsettings = Settings(mqtt=mqtt_settings, entity=light_info)\n\n# To receive state commands from HA, define a callback function:\ndef my_callback(client: Client, user_data, message: MQTTMessage):\n\n    # Make sure received payload is JSON\n    try:\n        payload = json.loads(message.payload.decode())\n    except ValueError:\n        print(\"Ony JSON schema is supported for light entities!\")\n        return\n\n    # Parse received dictionary\n    if \"color\" in payload:\n        set_color_of_my_light()\n        my_light.color(\"rgb\", payload[\"color\"])\n    elif \"brightness\" in payload:\n        set_brightness_of_my_light()\n        my_light.brightness(payload[\"brightness\"])\n    elif \"effect\" in payload:\n        set_effect_of_my_light()\n        my_light.effect(payload[\"effect\"])\n    elif \"state\" in payload:\n        if payload[\"state\"] == light_info.payload_on:\n            turn_on_my_light()\n            my_light.on()\n        else:\n            turn_off_my_light()\n            my_light.off()\n    else:\n        print(\"Unknown payload\")\n\n# Define an optional object to be passed back to the callback\nuser_data = \"Some custom data\"\n\n# Instantiate the light\nmy_light = Light(settings, my_callback, user_data)\n\n# Set the initial state of the light, which also makes it discoverable\nmy_light.off()\n```\n\n### Number\n\nThe number entity is similar to the text entity, but for a numeric value instead of a string.\nIt is possible to act upon receiving changes in HA by defining a `callback` function, as the following example shows:\n\n```py\nimport logging\nfrom ha_mqtt_discoverable import Settings\nfrom ha_mqtt_discoverable.sensors import Number, NumberInfo\nfrom paho.mqtt.client import Client, MQTTMessage\n\n# Configure the required parameters for the MQTT broker\nmqtt_settings = Settings.MQTT(host=\"localhost\")\n\n# Information about the `number` entity.\nnumber_info = NumberInfo(name=\"test\", min=0, max=50, mode=\"slider\", step=5)\n\nsettings = Settings(mqtt=mqtt_settings, entity=number_info)\n\n# To receive number updates from HA, define a callback function:\ndef my_callback(client: Client, user_data, message: MQTTMessage):\n    number = int(message.payload.decode())\n    logging.info(f\"Received {number} from HA\")\n    do_some_custom_thing(number)\n    # Send an MQTT message to confirm to HA that the number was changed\n    my_number.set_value(number)\n\n# Define an optional object to be passed back to the callback\nuser_data = \"Some custom data\"\n\n# Instantiate the number\nmy_number = Number(settings, my_callback, user_data)\n\n# Set the initial number displayed in HA UI, publishing an MQTT message that gets picked up by HA\nmy_number.set_value(42.0)\n```\n\n### Select\n\nThe selection entity is a list of selectable options in homeassistant.\nIt is possible to act upon reception of this 'command', by defining a `callback` function, as the following example shows:\n\n```py\nfrom ha_mqtt_discoverable import Settings\nfrom ha_mqtt_discoverable.sensors import Select, SelectInfo\nfrom paho.mqtt.client import Client, MQTTMessage\n\n# Configure the required parameters for the MQTT broker\nmqtt_settings = Settings.MQTT(host=\"localhost\")\n\n# Information about the switch\nselect_info = SelectInfo(name=\"test\", options=[\"option1\", \"option2\", \"option3\"])\n\nsettings = Settings(mqtt=mqtt_settings, entity=select_info)\n\n# To receive state commands from HA, define a callback function:\ndef my_callback(client: Client, user_data, message: MQTTMessage):\n    payload = message.payload.decode()\n    do_something()\n\n# Define an optional object to be passed back to the callback\nuser_data = \"Some custom data\"\n\n# Instantiate the selection\nmy_selection = Select(settings, my_callback, user_data)\n\n# Set the initial state of the selection, which also makes it discoverable\nopt = [\"option3\", \"option4\", \"option5\"]\nmy_selection.set_options(opt)\n```\n\n### Sensor\n\nThe following example creates a sensor and sets its state:\n\n```py\nfrom ha_mqtt_discoverable import Settings\nfrom ha_mqtt_discoverable.sensors import Sensor, SensorInfo\n\n\n# Configure the required parameters for the MQTT broker\nmqtt_settings = Settings.MQTT(host=\"localhost\")\n\n# Information about the sensor\nsensor_info = SensorInfo(\n    name=\"MyTemperatureSensor\",\n    device_class=\"temperature\",\n    unit_of_measurement=\"°C\",\n)\n\nsettings = Settings(mqtt=mqtt_settings, entity=sensor_info)\n\n# Instantiate the sensor\nmysensor = Sensor(settings)\n\n# Change the state of the sensor, publishing an MQTT message that gets picked up by HA\nmysensor.set_state(20.5)\n```\n\n### Switch\n\nThe switch is similar to a _binary sensor_, but in addition to publishing state changes toward HA it can also receive 'commands' from HA that request a state change.\nIt is possible to act upon reception of this 'command', by defining a `callback` function, as the following example shows:\n\n```py\nfrom ha_mqtt_discoverable import Settings\nfrom ha_mqtt_discoverable.sensors import Switch, SwitchInfo\nfrom paho.mqtt.client import Client, MQTTMessage\n\n# Configure the required parameters for the MQTT broker\nmqtt_settings = Settings.MQTT(host=\"localhost\")\n\n# Information about the switch\nswitch_info = SwitchInfo(name=\"test\")\n\nsettings = Settings(mqtt=mqtt_settings, entity=switch_info)\n\n# To receive state commands from HA, define a callback function:\ndef my_callback(client: Client, user_data, message: MQTTMessage):\n    payload = message.payload.decode()\n    if payload == \"ON\":\n        turn_my_custom_thing_on()\n        # Let HA know that the switch was successfully activated\n        my_switch.on()\n    elif payload == \"OFF\":\n        turn_my_custom_thing_off()\n        # Let HA know that the switch was successfully deactivated\n        my_switch.off()\n\n# Define an optional object to be passed back to the callback\nuser_data = \"Some custom data\"\n\n# Instantiate the switch\nmy_switch = Switch(settings, my_callback, user_data)\n\n# Set the initial state of the switch, which also makes it discoverable\nmy_switch.off()\n```\n\n### Text\n\nThe text is an `helper entity`, showing an input field in the HA UI that the user can interact with.\nIt is possible to act upon reception of the inputted text by defining a `callback` function, as the following example shows:\n\n```py\nimport logging\nfrom ha_mqtt_discoverable import Settings\nfrom ha_mqtt_discoverable.sensors import Text, TextInfo\nfrom paho.mqtt.client import Client, MQTTMessage\n\n# Configure the required parameters for the MQTT broker\nmqtt_settings = Settings.MQTT(host=\"localhost\")\n\n# Information about the `text` entity\ntext_info = TextInfo(name=\"test\")\n\nsettings = Settings(mqtt=mqtt_settings, entity=text_info)\n\n# To receive text updates from HA, define a callback function:\ndef my_callback(client: Client, user_data, message: MQTTMessage):\n    text = message.payload.decode()\n    logging.info(f\"Received {text} from HA\")\n    do_some_custom_thing(text)\n    # Send an MQTT message to confirm to HA that the text was changed\n    my_text.set_text(text)\n\n# Define an optional object to be passed back to the callback\nuser_data = \"Some custom data\"\n\n# Instantiate the text\nmy_text = Text(settings, my_callback, user_data)\n\n# Set the initial text displayed in HA UI, publishing an MQTT message that gets picked up by HA\nmy_text.set_text(\"Some awesome text\")\n```\n\n## FAQ\n\n### Using an existing MQTT client\n\nIf you want to use an existing MQTT client for the connection, you can pass it to the `Settings` object:\n\n```py\nfrom ha_mqtt_discoverable import Settings\nfrom paho.mqtt.client import Client\n\n# Creating the MQTT client\nclient = Client()\n# Doing other stuff with the client, like connecting to the broker\n# ...\n\n# Providing the client to the Settings object\n# In this case, no other MQTT settings are needed\nmqtt_settings = Settings.MQTT(client=client)\n\n# Continue with the rest of the code as usual\n```\n\n### I'm having problems on 32-bit ARM\n\nPydantic 2 has issues on 32-bit ARM. More details are on [ha-mqtt-discoverable/pull/191](https://github.com/unixorn/ha-mqtt-discoverable/pull/191). TL;DR: If you're on an ARM32 machine you're going to have to pin to the 0.13.1 version.\n\n## Contributing\n\nPlease run `ruff` on your code before submitting. There are `git` hooks already configured to run `ruff` and other checks before every commit, please run `pre-commit install` to enable them.\n\n## Users of ha-mqtt-discoverable\n\nIf you use this module for your own project, please add a link here.\n\n- [ha-mqtt-discoverable-cli](https://github.com/unixorn/ha-mqtt-discoverable-cli) - Command line tools that allow using this module from shell scripts\n\n- [plejd-mqtt-ha](https://github.com/ha-enthus1ast/plejd-mqtt-ha) - A containerized Python application that bridges Plejd devices to Home Assistant\n\n- [homeassistant-zodiac-tri-expert](https://github.com/andreondra/homeassistant-zodiac-tri-expert) - A Zodiac Tri Expert salt water generator integration\n\n- [homeassistant-addon-viessmann-gridbox](https://github.com/unl0ck/homeassistant-addon-viessmann-gridbox) - Get your Viessmann Gridbox Data Home Assistant integration\n\n## Contributors\n\n[![Contributors](https://contributors-img.web.app/image?repo=unixorn/ha-mqtt-discoverable)](https://github.com/unixorn/ha-mqtt-discoverable/graphs/contributors)\n\nMade with [contributors-img](https://contributors-img.web.app).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funixorn%2Fha-mqtt-discoverable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funixorn%2Fha-mqtt-discoverable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funixorn%2Fha-mqtt-discoverable/lists"}