{"id":20758009,"url":"https://github.com/qu4tro/homie-spec","last_synced_at":"2025-04-29T23:48:57.876Z","repository":{"id":39629507,"uuid":"233368364","full_name":"Qu4tro/homie-spec","owner":"Qu4tro","description":"homie-spec is a Python library that handles the v4 Homie Convention","archived":false,"fork":false,"pushed_at":"2022-06-22T01:39:05.000Z","size":122,"stargazers_count":4,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-29T23:48:52.425Z","etag":null,"topics":["homie","homie-convention","homie-spec","mqtt"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Qu4tro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-12T09:33:45.000Z","updated_at":"2022-05-07T09:31:52.000Z","dependencies_parsed_at":"2022-09-17T03:23:40.624Z","dependency_job_id":null,"html_url":"https://github.com/Qu4tro/homie-spec","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qu4tro%2Fhomie-spec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qu4tro%2Fhomie-spec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qu4tro%2Fhomie-spec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qu4tro%2Fhomie-spec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Qu4tro","download_url":"https://codeload.github.com/Qu4tro/homie-spec/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251602602,"owners_count":21615957,"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":["homie","homie-convention","homie-spec","mqtt"],"created_at":"2024-11-17T09:48:29.171Z","updated_at":"2025-04-29T23:48:57.848Z","avatar_url":"https://github.com/Qu4tro.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# homie-spec\n\n[![PyPI pyversions](https://img.shields.io/pypi/pyversions/homie-spec.svg?style=flat-square)](https://pypi.python.org/pypi/homie-spec/)\n[![GitHub license](https://img.shields.io/github/license/Qu4tro/homie-spec.svg?style=flat-square)](https://github.com/Qu4tro/homie-spec/blob/master/LICENSE)\n[![PyPI version shields.io](https://img.shields.io/pypi/v/homie-spec.svg?style=flat-square)](https://pypi.python.org/pypi/homie-spec/)\n\n[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg?style=flat-square)](https://GitHub.com/Qu4tro/homie-spec/graphs/commit-activity)\n[![Coverage](https://img.shields.io/codecov/c/github/Qu4tro/homie-spec?style=flat-square)](https://codecov.io/gh/Qu4tro/homie-spec)\n[![Build Status](https://img.shields.io/travis/Qu4tro/homie-spec/master?style=flat-square)](https://travis-ci.com/Qu4tro/homie-spec)\n\n**homie-spec** is a Python library that models the v4 [Homie Convention](https://homieiot.github.io/).\n\nThis package has no dependencies other than **Python \u003e=3.6**. Since it doesn't implement MQTT this also means it's fairly useless on it's own, as it has no ability to interact with any MQTT broker on it's own.\n\nThe goal of this package is to provide a data-driven library to easily create `devices`, `nodes` and `properties`. These can also be published to be used by anyone.\nAnother package (WIP), will bridge the MQTT protocol and `homie-spec`.\n\nRelevant external links:\n  - [Documentation](https://qu4tro.github.io/homie-spec/)\n  - [Specification](https://homieiot.github.io/specification/spec-core-v4_0_0/#)\n\n## Installation\n\nUse the package manager [pip](https://pip.pypa.io/en/stable/) to install `homie-spec`.\n\n```bash\npip install homie-spec\n```\n\n## Usage\n\n```python\n\nfrom homie_spec import Device, Node, Property\nfrom homie_spec.properties import Datatype\n\n\nlocaltime = Node(\n    name=\"Local time\",\n    typeOf=\"clock\",\n    properties={\n        \"color-repr\": Property(\n            name=\"Color representation\", datatype=Datatype.COLOR, get=lambda: \"233,102,23\"\n        ),\n        \"time\": Property(\n            name=\"HH:MM representation\", datatype=Datatype.STRING, get=lambda: \"20:20\"\n        ),\n    },\n)\n\ndesktop = Device(id=\"desktop\", name=\"Desktop Computer\", nodes={\"local-time\": localtime})\n\nfor msg in desktop.messages():\n    print(msg.attrs)\nprint(desktop.getter_message('local-time/time').attrs)\nprint(desktop.getter_message('local-time/color-repr').attrs)\n\n\"\"\"\n{'retained': True, 'qos': 1, 'topic': 'homie/desktop/$state',                          'payload': 'init'}\n{'retained': True, 'qos': 1, 'topic': 'homie/desktop/$name',                           'payload': 'Desktop Computer'}\n{'retained': True, 'qos': 1, 'topic': 'homie/desktop/$homie',                          'payload': '4.0.0'}\n{'retained': True, 'qos': 1, 'topic': 'homie/desktop/$implementation',                 'payload': 'homie-spec'}\n{'retained': True, 'qos': 1, 'topic': 'homie/desktop/$nodes',                          'payload': 'local-time'}\n{'retained': True, 'qos': 1, 'topic': 'homie/desktop/local-time/$name',                'payload': 'Local time'}\n{'retained': True, 'qos': 1, 'topic': 'homie/desktop/local-time/$type',                'payload': 'clock'}\n{'retained': True, 'qos': 1, 'topic': 'homie/desktop/local-time/$properties',          'payload': 'color-repr,time'}\n{'retained': True, 'qos': 1, 'topic': 'homie/desktop/local-time/color-repr/$name',     'payload': 'Color representation'}\n{'retained': True, 'qos': 1, 'topic': 'homie/desktop/local-time/color-repr/$datatype', 'payload': 'color'}\n{'retained': True, 'qos': 1, 'topic': 'homie/desktop/local-time/time/$name',           'payload': 'HH:MM representation'}\n{'retained': True, 'qos': 1, 'topic': 'homie/desktop/local-time/time/$datatype',       'payload': 'string'}\n{'retained': True, 'qos': 1, 'topic': 'homie/desktop/$state',                          'payload': 'ready'}\n{'retained': True, 'qos': 1, 'topic': 'homie/desktop/local-time/time',                 'payload': '20:20'}\n{'retained': True, 'qos': 1, 'topic': 'homie/desktop/local-time/color-repr',           'payload': '233,102,23'}\n\"\"\"\n```\n\n## Contributing\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n\n## License\n[MIT](https://choosealicense.com/licenses/mit/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqu4tro%2Fhomie-spec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqu4tro%2Fhomie-spec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqu4tro%2Fhomie-spec/lists"}