moat-kv-ha


Namemoat-kv-ha JSON
Version 0.5.3 PyPI version JSON
download
home_page
SummaryHome Assistant connector for MoaT-KV
upload_time2023-12-23 16:16:10
maintainer
docs_urlNone
author
requires_python>=3.8
license
keywords moat
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ==========
MoaT-KV-HA
==========

This is a link between Home Assistant and Moat-KV.

It will

* set up standard config for Home Assistant in MoaT-KV

* have command-line support to register (or not) devices

Principle of Operation
======================

Home Assistant talks via MQTT. MoaT-KV has a quite versatile MQTT adapter.
Thus we can store Home Assistant's entitiy configuration, plus their state,
plus the commands Home Assisant issues to get things to change their state,
in MoaT-KV.

MQTT can only transmit binary data. DistHASS thus creates a few codecs that
support binary data (translating them to on/off), integers/floats, and JSON.

Thus, bottom to top:

* Mosquitto on port 51883

  * basic installation, does not need persistence or retained messages
  * Serf would work, but it imposes `additional delays <https://github.com/hashicorp/serf/issues/581>`_

* MoaT-KV, using Mosquitto as a backbone

  * a special user with conversion rules for JSON etc.

* DistMQTT

  * retained messages are stored in MoaT-KV
  * transparent channels to forward MQTT messages unmodified, if required
  * anything else is broadcast as a MoaT-KV message
  * uses port 1883

* Home Assistant, or anything else MQTTish for that matter

  * must use MQTT 3.11

If you have devices that only can use MQTT 3.1, you can teach them to talk
directly to Mosquitto, via a transparent range.

Setup
=====

* Run ``moat kv ha init -i``

* Add a MoaT-KV user for Home Assistant and set its ``conv`` parameter to ``hassco``::

    moat kv auth user param NAME conv hassco

* Start Moat-MQTT with something like this configuration::

    kv:
        server:
            host: '127.0.0.1'
            port: 27586
            auth: "password name=NAME password=PASSWORD"
        topic: [mqtt, msg]
        transparent:
        - [home,ass,event]
        - [home,ass,state]
        retain: [home, ass]
    listeners:
        default:
            max-connections: 500
            type: tcp
        local-tcp:
            bind: 127.0.0.1:1883
        remote-tcp:
            bind: 10.107.3.18:1883
    timeout-disconnect-delay: 2
    plugins: ['auth_anonymous']
    auth:
        allow-anonymous: true
    
  If you have devices that use MQTT directly, modify the
  ``transparent`` list to include your current MQTT prefixes.

* Modify Home Assistant's MQTT integration to do autodiscovery.
  If you've set it up via the GUI, the file you need is
  ``.storage/core.config_entries``. Find the entry with ``"domain":
  "mqtt"`` and modify its ``data`` entry to read::

                "data": {
                    "broker": "127.0.0.1",
                    "discovery": true,
                    "discovery_prefix": "home/ass/dyn",
                    "port": 1883,
                },

* Run ``moat kv ha conv``.

  This teaches MoaT-KV to auto-convert the Home Assistant data so that
  everything in MoaT-KV sees binary states as booleans, temperatures are
  floats, the configuration's JSON is a real data structure, and so on.

  Without this conversion, it's all strings. We don't want that.

* Restart Home Assistant.

* Run ``moat kv ha add light foo bar``.

  A new light should show up in the Home Assistant GUI.
  
  You can try to turn it on, but it will go off by itself a second or two
  later because there's no device yet.

* Run ``moat kv ha state light foo bar True``.

  This command changes the state manually.

  In Home Assistant, the light's indicator turns on.

* Adding an actual device that monitors the light's MoaT-KV command entry / its
  [MoaT-KV-]MQTT command topic, actually affects the hardware, and changes the
  state, is your job.


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "moat-kv-ha",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "MoaT",
    "author": "",
    "author_email": "Matthias Urlichs <matthias@urlichs.de>",
    "download_url": "https://files.pythonhosted.org/packages/2b/43/3cfe5b67136c319150fbb15af54cdd4c9133d0a6d0ab1740ec0ec6c37474/moat-kv-ha-0.5.3.tar.gz",
    "platform": null,
    "description": "==========\nMoaT-KV-HA\n==========\n\nThis is a link between Home Assistant and Moat-KV.\n\nIt will\n\n* set up standard config for Home Assistant in MoaT-KV\n\n* have command-line support to register (or not) devices\n\nPrinciple of Operation\n======================\n\nHome Assistant talks via MQTT. MoaT-KV has a quite versatile MQTT adapter.\nThus we can store Home Assistant's entitiy configuration, plus their state,\nplus the commands Home Assisant issues to get things to change their state,\nin MoaT-KV.\n\nMQTT can only transmit binary data. DistHASS thus creates a few codecs that\nsupport binary data (translating them to on/off), integers/floats, and JSON.\n\nThus, bottom to top:\n\n* Mosquitto on port 51883\n\n  * basic installation, does not need persistence or retained messages\n  * Serf would work, but it imposes `additional delays <https://github.com/hashicorp/serf/issues/581>`_\n\n* MoaT-KV, using Mosquitto as a backbone\n\n  * a special user with conversion rules for JSON etc.\n\n* DistMQTT\n\n  * retained messages are stored in MoaT-KV\n  * transparent channels to forward MQTT messages unmodified, if required\n  * anything else is broadcast as a MoaT-KV message\n  * uses port 1883\n\n* Home Assistant, or anything else MQTTish for that matter\n\n  * must use MQTT 3.11\n\nIf you have devices that only can use MQTT 3.1, you can teach them to talk\ndirectly to Mosquitto, via a transparent range.\n\nSetup\n=====\n\n* Run ``moat kv ha init -i``\n\n* Add a MoaT-KV user for Home Assistant and set its ``conv`` parameter to ``hassco``::\n\n    moat kv auth user param NAME conv hassco\n\n* Start Moat-MQTT with something like this configuration::\n\n    kv:\n        server:\n            host: '127.0.0.1'\n            port: 27586\n            auth: \"password name=NAME password=PASSWORD\"\n        topic: [mqtt, msg]\n        transparent:\n        - [home,ass,event]\n        - [home,ass,state]\n        retain: [home, ass]\n    listeners:\n        default:\n            max-connections: 500\n            type: tcp\n        local-tcp:\n            bind: 127.0.0.1:1883\n        remote-tcp:\n            bind: 10.107.3.18:1883\n    timeout-disconnect-delay: 2\n    plugins: ['auth_anonymous']\n    auth:\n        allow-anonymous: true\n    \n  If you have devices that use MQTT directly, modify the\n  ``transparent`` list to include your current MQTT prefixes.\n\n* Modify Home Assistant's MQTT integration to do autodiscovery.\n  If you've set it up via the GUI, the file you need is\n  ``.storage/core.config_entries``. Find the entry with ``\"domain\":\n  \"mqtt\"`` and modify its ``data`` entry to read::\n\n                \"data\": {\n                    \"broker\": \"127.0.0.1\",\n                    \"discovery\": true,\n                    \"discovery_prefix\": \"home/ass/dyn\",\n                    \"port\": 1883,\n                },\n\n* Run ``moat kv ha conv``.\n\n  This teaches MoaT-KV to auto-convert the Home Assistant data so that\n  everything in MoaT-KV sees binary states as booleans, temperatures are\n  floats, the configuration's JSON is a real data structure, and so on.\n\n  Without this conversion, it's all strings. We don't want that.\n\n* Restart Home Assistant.\n\n* Run ``moat kv ha add light foo bar``.\n\n  A new light should show up in the Home Assistant GUI.\n  \n  You can try to turn it on, but it will go off by itself a second or two\n  later because there's no device yet.\n\n* Run ``moat kv ha state light foo bar True``.\n\n  This command changes the state manually.\n\n  In Home Assistant, the light's indicator turns on.\n\n* Adding an actual device that monitors the light's MoaT-KV command entry / its\n  [MoaT-KV-]MQTT command topic, actually affects the hardware, and changes the\n  state, is your job.\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Home Assistant connector for MoaT-KV",
    "version": "0.5.3",
    "project_urls": {
        "homepage": "https://m-o-a-t.org",
        "repository": "https://github.com/M-o-a-T/moat-kv-ha"
    },
    "split_keywords": [
        "moat"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "00475cddb4a33b59a744aa4cc58c44e6cab9b10e14b2cb2ee0292b2a71baae5c",
                "md5": "2f2e44984bfae20f2108b222d94195ff",
                "sha256": "81d204191fd845a03573c82eae4bd2eddd683abc5a85824391c983a3b51b626b"
            },
            "downloads": -1,
            "filename": "moat_kv_ha-0.5.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2f2e44984bfae20f2108b222d94195ff",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 7848,
            "upload_time": "2023-12-23T16:16:08",
            "upload_time_iso_8601": "2023-12-23T16:16:08.211543Z",
            "url": "https://files.pythonhosted.org/packages/00/47/5cddb4a33b59a744aa4cc58c44e6cab9b10e14b2cb2ee0292b2a71baae5c/moat_kv_ha-0.5.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2b433cfe5b67136c319150fbb15af54cdd4c9133d0a6d0ab1740ec0ec6c37474",
                "md5": "19fe9adcec42cbe2328ece6731e4b688",
                "sha256": "6fa550211ea0ddafc6ad00cac829f78945c1025c9ee09593d5ee532cd4b52b40"
            },
            "downloads": -1,
            "filename": "moat-kv-ha-0.5.3.tar.gz",
            "has_sig": false,
            "md5_digest": "19fe9adcec42cbe2328ece6731e4b688",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 10677,
            "upload_time": "2023-12-23T16:16:10",
            "upload_time_iso_8601": "2023-12-23T16:16:10.199928Z",
            "url": "https://files.pythonhosted.org/packages/2b/43/3cfe5b67136c319150fbb15af54cdd4c9133d0a6d0ab1740ec0ec6c37474/moat-kv-ha-0.5.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-23 16:16:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "M-o-a-T",
    "github_project": "moat-kv-ha",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "moat-kv-ha"
}
        
Elapsed time: 0.19448s