mqtt-homeassistant-utils


Namemqtt-homeassistant-utils JSON
Version 0.0.9 PyPI version JSON
download
home_page
SummaryA helper project to work with the mqtt integraton in home assistant
upload_time2024-02-17 07:57:21
maintainer
docs_urlNone
authorSebastian Wienecke
requires_python>=3.10
licenseMIT License Copyright (c) 2023 Xembalo Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords mqtt home assistant hass homeassistant auto discovery
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # MQTT Home Assistant Utils

A helper project designed to facilitate working with the MQTT integration in Home Assistant.

## Overview

This repository contains Python code for generating Home Assistant (HA) MQTT discovery payloads. These payloads are used to configure sensors and binary sensors in Home Assistant via MQTT.

## File Structure

- `mqtt_homeassistant_utils.py`: Python script containing the data classes and enums for generating HA MQTT discovery payloads.

## Usage

To use the provided code, you can create instances of the defined data classes, configure their properties, and publish the MQTT discovery messages. Here's a basic example:

```python
# Import necessary classes
from mqtt_homeassistant_utils import HASensor, HADeviceClassSensor
import paho.mqtt.client as mqtt

# Create a sensor instance
sensor = HASensor(
    component="sensor",
    node_id="node1",
    unique_id="temperature_sensor",
    name="Temperature Sensor",
    state_topic="sensor/temperature",
    device_class=HADeviceClassSensor.TEMPERATURE,
    unit_of_measurement="°C"
)

# Configure MQTT client
mqtt_client = mqtt.Client()
mqtt_client.connect("mqtt_broker_address", 1883)

# Publish the MQTT discovery payload
sensor.publish(mqtt_client, qos=1)
```

Make sure to customize the configurations according to your specific setup.

## Initial Development

This project was initially developed for personal use in my own Home Assistant projects. While it's tailored to my specific needs, I welcome feedback and contributions. If you have specific entries you'd like to see added, feel free to open a request!

## Enums

The code includes two enum classes:

* `HADeviceClassSensor`: Enum for sensor device classes.
* `HADeviceClassBinarySensor`: Enum for binary sensor device classes.

## Contributing

Feel free to contribute to this project by opening issues or submitting pull requests. Your feedback and contributions are welcome!

## License

This project is licensed under the MIT License.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "mqtt-homeassistant-utils",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "mqtt,home assistant,hass,homeassistant,auto discovery",
    "author": "Sebastian Wienecke",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/30/4c/8eabf8fce4f509013c3c1c8b42390fd9acb416a058da7f7ae6f5a05a49c2/mqtt_homeassistant_utils-0.0.9.tar.gz",
    "platform": null,
    "description": "# MQTT Home Assistant Utils\n\nA helper project designed to facilitate working with the MQTT integration in Home Assistant.\n\n## Overview\n\nThis repository contains Python code for generating Home Assistant (HA) MQTT discovery payloads. These payloads are used to configure sensors and binary sensors in Home Assistant via MQTT.\n\n## File Structure\n\n- `mqtt_homeassistant_utils.py`: Python script containing the data classes and enums for generating HA MQTT discovery payloads.\n\n## Usage\n\nTo use the provided code, you can create instances of the defined data classes, configure their properties, and publish the MQTT discovery messages. Here's a basic example:\n\n```python\n# Import necessary classes\nfrom mqtt_homeassistant_utils import HASensor, HADeviceClassSensor\nimport paho.mqtt.client as mqtt\n\n# Create a sensor instance\nsensor = HASensor(\n    component=\"sensor\",\n    node_id=\"node1\",\n    unique_id=\"temperature_sensor\",\n    name=\"Temperature Sensor\",\n    state_topic=\"sensor/temperature\",\n    device_class=HADeviceClassSensor.TEMPERATURE,\n    unit_of_measurement=\"\u00b0C\"\n)\n\n# Configure MQTT client\nmqtt_client = mqtt.Client()\nmqtt_client.connect(\"mqtt_broker_address\", 1883)\n\n# Publish the MQTT discovery payload\nsensor.publish(mqtt_client, qos=1)\n```\n\nMake sure to customize the configurations according to your specific setup.\n\n## Initial Development\n\nThis project was initially developed for personal use in my own Home Assistant projects. While it's tailored to my specific needs, I welcome feedback and contributions. If you have specific entries you'd like to see added, feel free to open a request!\n\n## Enums\n\nThe code includes two enum classes:\n\n* `HADeviceClassSensor`: Enum for sensor device classes.\n* `HADeviceClassBinarySensor`: Enum for binary sensor device classes.\n\n## Contributing\n\nFeel free to contribute to this project by opening issues or submitting pull requests. Your feedback and contributions are welcome!\n\n## License\n\nThis project is licensed under the MIT License.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Xembalo  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "A helper project to work with the mqtt integraton in home assistant",
    "version": "0.0.9",
    "project_urls": {
        "Homepage": "https://github.com/Xembalo/mqtt-homeassistant-utils",
        "Issues": "https://github.com/Xembalo/mqtt-homeassistant-utils/issues",
        "Repository": "https://github.com/Xembalo/mqtt-homeassistant-utils.git"
    },
    "split_keywords": [
        "mqtt",
        "home assistant",
        "hass",
        "homeassistant",
        "auto discovery"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b9c6c58b8fbfd4dd4ef7159e1650bbc2f45f5f9e391019ec442db9145bd39d18",
                "md5": "18b9a0019464504d633d166183ebd84d",
                "sha256": "3e3513c954efb5a76bb24802c674673c3cc2866e2af318b56a5abca89cc0f2b2"
            },
            "downloads": -1,
            "filename": "mqtt_homeassistant_utils-0.0.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "18b9a0019464504d633d166183ebd84d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 9003,
            "upload_time": "2024-02-17T07:57:18",
            "upload_time_iso_8601": "2024-02-17T07:57:18.931207Z",
            "url": "https://files.pythonhosted.org/packages/b9/c6/c58b8fbfd4dd4ef7159e1650bbc2f45f5f9e391019ec442db9145bd39d18/mqtt_homeassistant_utils-0.0.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "304c8eabf8fce4f509013c3c1c8b42390fd9acb416a058da7f7ae6f5a05a49c2",
                "md5": "e0f630e7ea2f35f57106645ac61dc593",
                "sha256": "820b7c024b3ae23257c5b42bc31fc7390ba21bfbed071dd923ab134e0819a694"
            },
            "downloads": -1,
            "filename": "mqtt_homeassistant_utils-0.0.9.tar.gz",
            "has_sig": false,
            "md5_digest": "e0f630e7ea2f35f57106645ac61dc593",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 9441,
            "upload_time": "2024-02-17T07:57:21",
            "upload_time_iso_8601": "2024-02-17T07:57:21.963290Z",
            "url": "https://files.pythonhosted.org/packages/30/4c/8eabf8fce4f509013c3c1c8b42390fd9acb416a058da7f7ae6f5a05a49c2/mqtt_homeassistant_utils-0.0.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-17 07:57:21",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Xembalo",
    "github_project": "mqtt-homeassistant-utils",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "mqtt-homeassistant-utils"
}
        
Elapsed time: 0.21792s