{"id":15877820,"url":"https://github.com/hardwario/bch-gateway","last_synced_at":"2025-12-14T00:56:56.447Z","repository":{"id":43150496,"uuid":"87154918","full_name":"hardwario/bch-gateway","owner":"hardwario","description":"HARDWARIO Gateway (Python Application «bcg»)","archived":false,"fork":false,"pushed_at":"2024-07-25T12:43:26.000Z","size":123,"stargazers_count":9,"open_issues_count":2,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-15T00:08:55.379Z","etag":null,"topics":["gateway","hardwario","mqtt","python","service","tower"],"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/hardwario.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":"2017-04-04T06:27:57.000Z","updated_at":"2024-07-25T12:43:32.000Z","dependencies_parsed_at":"2022-08-30T07:31:08.876Z","dependency_job_id":null,"html_url":"https://github.com/hardwario/bch-gateway","commit_stats":null,"previous_names":["bigclownlabs/bch-usb-gateway"],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hardwario%2Fbch-gateway","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hardwario%2Fbch-gateway/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hardwario%2Fbch-gateway/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hardwario%2Fbch-gateway/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hardwario","download_url":"https://codeload.github.com/hardwario/bch-gateway/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246363581,"owners_count":20765312,"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":["gateway","hardwario","mqtt","python","service","tower"],"created_at":"2024-10-06T02:04:01.518Z","updated_at":"2025-12-14T00:56:56.379Z","avatar_url":"https://github.com/hardwario.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://www.hardwario.com/\"\u003e\u003cimg src=\"https://www.hardwario.com/ci/assets/hw-logo.svg\" width=\"200\" alt=\"HARDWARIO Logo\" align=\"right\"\u003e\u003c/a\u003e\r\n\r\n# Hub Service for HARDWARIO USB Gateway\r\n\r\n[![Travis](https://img.shields.io/travis/bigclownlabs/bch-gateway/master.svg)](https://travis-ci.org/bigclownlabs/bch-gateway)\r\n[![Release](https://img.shields.io/github/release/bigclownlabs/bch-gateway.svg)](https://github.com/bigclownlabs/bch-gateway/releases)\r\n[![License](https://img.shields.io/github/license/bigclownlabs/bch-gateway.svg)](https://github.com/bigclownlabs/bch-gateway/blob/master/LICENSE)\r\n[![PyPI](https://img.shields.io/pypi/v/bcg.svg)](https://pypi.org/project/bcg/)\r\n[![Twitter](https://img.shields.io/twitter/follow/hardwario_en.svg?style=social\u0026label=Follow)](https://twitter.com/hardwario_en)\r\n\r\nThis repository contains CLI service for HARDWARIO USB Gateway.\r\n\r\n## Introduction\r\n\r\nThe service connects to a serial port where HARDWARIO USB Gateway is connected.\r\nIt converts messages from serial port to MQTT broker and vice versa.\r\nRun with `--help` parameter to see the available options.\r\nIt works with Python 2.7+ and Python 3.5+ environments and it has been tested under Linux, macOS and Windows.\r\n\r\n## Setup\r\n\r\n    pip3 install -U bcg\r\n\r\nInstall as a system-wide local Python package.\r\n\r\n    git clone https://github.com/bigclownlabs/bch-gateway.git\r\n    cd bch-gateway\r\n    sudo pip3 install -e .\r\n\r\n\u003e Note: Parameter `-e` instructs to install files as symlinks, so changes to the source files will be immediately available to other users of the package on the host.\r\n\r\n\r\n## MQTT\r\n\r\n* Get info about all connected gateway\r\n  ```\r\n  mosquitto_pub -t 'gateway/all/info/get' -n\r\n  ```\r\n\r\n    response:\r\n    ```\r\n    gateway/{name}/info {\"id\": \"836d19839c3b\", \"firmware\": \"bcf-gateway-....\"}\r\n    ```\r\n\r\n* List of paired nodes\r\n  ```\r\n  mosquitto_pub -t 'gateway/{name}/nodes/get' -n\r\n  ```\r\n\r\n    response:\r\n    ```\r\n    gateway/{name}/nodes [\"{id-node-0}\", \"{id-node-id1}\", \"{id-node-id2}\"]\r\n    ```\r\n\r\n* Pairing mode\r\n\r\n  * Start\r\n    ```\r\n    mosquitto_pub -t 'gateway/{name}/pairing-mode/start' -n\r\n    ```\r\n      LED on gateway start blink\r\n\r\n      response:\r\n      ```\r\n      gateway/{name}/pairing-mode \"start\"\r\n      ```\r\n\r\n      Gateway is waiting to pair node. To pare node, long press the button on Core Module.\r\n\r\n      response when the node is successfully added:\r\n      ```\r\n      gateway/{name}/attach \"{id-node-0}\"\r\n      gateway/{name}/attach \"{id-node-1}\"\r\n      ...\r\n      ```\r\n\r\n      Error response if there is not enough space:\r\n      ```\r\n      gateway/{name}/attach-failure \"{id-node-1}\"\r\n      ```\r\n\r\n  * Stop\r\n    ```\r\n    mosquitto_pub -t 'gateway/{name}/pairing-mode/stop' -n\r\n    ```\r\n      LED on gateway turns off\r\n\r\n      response:\r\n      ```\r\n      gateway/{name}/pairing-mode \"stop\"\r\n      ```\r\n\r\n* Purge all nodes\r\n  ```\r\n  mosquitto_pub -t 'gateway/{name}/nodes/purge' -n\r\n  ```\r\n\r\n    response:\r\n    ```\r\n    gateway/{name}/nodes []\r\n    ```\r\n\r\n* Manual Add/Pair node\r\n  ```\r\n  mosquitto_pub -t 'gateway/{name}/nodes/add' -m '\"{id-node}\"'\r\n  ```\r\n\r\n    response:\r\n    ```\r\n    gateway/{name}/attach \"{id-node}\"\r\n    ```\r\n\r\n    Error response if there is not enough space:\r\n    ```\r\n    gateway/{name}/attach-failure \"{id-node-1}\"\r\n    ```\r\n\r\n* Manual Remove/Unpair node\r\n  ```\r\n  mosquitto_pub -t 'gateway/{name}/nodes/remove' -m '\"{id-node}\"'\r\n  ```\r\n\r\n    response:\r\n    ```\r\n    gateway/{name}/detach \"{id-node}\"\r\n    ```\r\n\r\n* Set node alias\r\n  ```\r\n  mosquitto_pub -t 'gateway/usb-dongle/alias/set' -m '{\"id\": \"id-node\", \"alias\": \"new-alias\"}'\r\n  ```\r\n\r\n    respose:\r\n    ```\r\n    gateway/usb-dongle/alias/set/ok {\"id\": \"id-node\", \"alias\": \"new-alias\"}\r\n    ```\r\n\r\n\r\n* Remove node alias\r\n  ```\r\n  mosquitto_pub -t 'gateway/usb-dongle/alias/remove' -m '\"{id-node}\"'\r\n  ```\r\n  ```\r\n  mosquitto_pub -t 'gateway/usb-dongle/alias/set' -m '{\"id\": \"id-node\", \"alias\": null}'\r\n  ```\r\n\r\n* Scan Start\r\n\r\n  * Start\r\n    ```\r\n    mosquitto_pub -t 'gateway/{name}/scan/start' -n\r\n    ```\r\n\r\n      response:\r\n      ```\r\n      gateway/{name}/scan \"start\"\r\n      ```\r\n\r\n      response for unknown node\r\n      ```\r\n      gateway/{name}/found \"{id-node-0}\"\r\n      gateway/{name}/found \"{id-node-1}\"\r\n      gateway/{name}/found \"{id-node-2}\"\r\n      ...\r\n      ```\r\n\r\n  * Stop\r\n    ```\r\n    mosquitto_pub -t 'gateway/{name}/scan/stop' -n\r\n    ```\r\n\r\n      response:\r\n      ```\r\n      gateway/{name}/scan \"stop\"\r\n      ```\r\n\r\n* Automatic pairing of all visible nodes\r\n\r\n  !!! This is experimental features do not all work\r\n\r\n  * Start\r\n\r\n    ```\r\n    mosquitto_pub -t 'gateway/{name}/automatic-pairing/start' -n\r\n    ```\r\n\r\n      LED on gateway start blink\r\n\r\n      response:\r\n      ```\r\n      gateway/{name}/automatic-pairing \"start\"\r\n      ```\r\n\r\n      response when the node is successfully added:\r\n      ```\r\n      gateway/{name}/attach \"{id-node-0}\"\r\n      gateway/{name}/attach \"{id-node-1}\"\r\n      ...\r\n      ```\r\n\r\n  * Stop\r\n      ```\r\n      mosquitto_pub -t 'gateway/{name}/automatic-pairing/stop' -n\r\n      ```\r\n\r\n        LED on gateway turns off\r\n\r\n        response:\r\n        ```\r\n        gateway/{name}/automatic-pairing \"stop\"\r\n        ```\r\n\r\n## Configuration file\r\n\r\nConfiguration file is in yaml format\r\n\r\n* device: string\r\n\r\n  example: /dev/ttyUSB0\r\n\r\n* name: string\r\n\r\n  support variables:\r\n  * {ip} - ip address\r\n  * {id} - the id of the connected usb-dongle or core-module\r\n\r\n  default: null - automatic detect name from gateway firmware\r\n\r\n  example: \"{ip}-ttyUSB0\"\r\n\r\n* mqtt: object\r\n\r\n  * host: string\r\n\r\n    default: 127.0.0.1\r\n\r\n  * port: int\r\n\r\n    defualt: 1883\r\n\r\n  * username: string\r\n  * password: string\r\n  * cafile: string\r\n  * certfile: string\r\n  * keyfile: string\r\n\r\n* retain_node_messages: bool\r\n\r\n  default: False\r\n\r\n* qos_node_messages: int\r\n\r\n  default: 1\r\n    \r\n* base_topic_prefix: string\r\n\r\n  example: home-\r\n\r\n* automatic_remove_kit_from_names: bool\r\n\r\n  default: True\r\n\r\n* automatic_rename_kit_nodes: bool\r\n\r\n  default: True\r\n  \r\n* automatic_rename_generic_nodes: bool\r\n\r\n  default: True\r\n  \r\n* automatic_rename_nodes: bool\r\n\r\n  default: True\r\n  \r\n* rename: object\r\n\r\n## Node-Red buttons\r\n\r\nIf you use Node-Red, you can import text below to create buttons in your flow. You can list, pair and delete nodes with a click of the mouse.\r\n\r\n* For bcf-gateway-usb-dongle\r\n\r\n  ```\r\n  [{\"id\":\"83c6c60c.209d78\",\"type\":\"mqtt in\",\"z\":\"97027127.a55f7\",\"name\":\"\",\"topic\":\"#\",\"qos\":\"2\",\"broker\":\"de273190.7f6f2\",\"x\":610,\"y\":80,\"wires\":[[\"454a64bc.50f77c\"]]},{\"id\":\"454a64bc.50f77c\",\"type\":\"debug\",\"z\":\"97027127.a55f7\",\"name\":\"\",\"active\":true,\"console\":\"false\",\"complete\":\"false\",\"x\":790,\"y\":80,\"wires\":[]},{\"id\":\"9e87ab30.a50be8\",\"type\":\"inject\",\"z\":\"97027127.a55f7\",\"name\":\"All gateway info\",\"topic\":\"gateway/all/info/get\",\"payload\":\"\",\"payloadType\":\"str\",\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"x\":639,\"y\":172,\"wires\":[[\"504dd396.bb5b4c\"]]},{\"id\":\"504dd396.bb5b4c\",\"type\":\"mqtt out\",\"z\":\"97027127.a55f7\",\"name\":\"\",\"topic\":\"\",\"qos\":\"\",\"retain\":\"\",\"broker\":\"de273190.7f6f2\",\"x\":824,\"y\":173,\"wires\":[]},{\"id\":\"f447966d.ed0cb8\",\"type\":\"inject\",\"z\":\"97027127.a55f7\",\"name\":\"Pairing mode start\",\"topic\":\"gateway/usb-dongle/pairing-mode/start\",\"payload\":\"\",\"payloadType\":\"str\",\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"x\":660,\"y\":280,\"wires\":[[\"ae043e16.df77c\"]]},{\"id\":\"ae043e16.df77c\",\"type\":\"mqtt out\",\"z\":\"97027127.a55f7\",\"name\":\"\",\"topic\":\"\",\"qos\":\"\",\"retain\":\"\",\"broker\":\"de273190.7f6f2\",\"x\":825,\"y\":281,\"wires\":[]},{\"id\":\"80092576.c83998\",\"type\":\"inject\",\"z\":\"97027127.a55f7\",\"name\":\"Pairing mode stop\",\"topic\":\"gateway/usb-dongle/pairing-mode/stop\",\"payload\":\"\",\"payloadType\":\"str\",\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"x\":660,\"y\":320,\"wires\":[[\"86c93689.7d0e58\"]]},{\"id\":\"86c93689.7d0e58\",\"type\":\"mqtt out\",\"z\":\"97027127.a55f7\",\"name\":\"\",\"topic\":\"\",\"qos\":\"\",\"retain\":\"\",\"broker\":\"de273190.7f6f2\",\"x\":825,\"y\":321,\"wires\":[]},{\"id\":\"8f7b14c7.898c38\",\"type\":\"inject\",\"z\":\"97027127.a55f7\",\"name\":\"List of paired nodes\",\"topic\":\"gateway/usb-dongle/nodes/get\",\"payload\":\"\",\"payloadType\":\"str\",\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"x\":650,\"y\":220,\"wires\":[[\"75f5e8db.ed19a8\"]]},{\"id\":\"75f5e8db.ed19a8\",\"type\":\"mqtt out\",\"z\":\"97027127.a55f7\",\"name\":\"\",\"topic\":\"\",\"qos\":\"\",\"retain\":\"\",\"broker\":\"de273190.7f6f2\",\"x\":825,\"y\":221,\"wires\":[]},{\"id\":\"ed3cfe08.3321b\",\"type\":\"inject\",\"z\":\"97027127.a55f7\",\"name\":\"purge all nodes\",\"topic\":\"gateway/usb-dongle/nodes/purge\",\"payload\":\"\",\"payloadType\":\"str\",\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"x\":640,\"y\":380,\"wires\":[[\"2acde0de.0d9de\"]]},{\"id\":\"2acde0de.0d9de\",\"type\":\"mqtt out\",\"z\":\"97027127.a55f7\",\"name\":\"\",\"topic\":\"\",\"qos\":\"\",\"retain\":\"\",\"broker\":\"de273190.7f6f2\",\"x\":825,\"y\":381,\"wires\":[]},{\"id\":\"de273190.7f6f2\",\"type\":\"mqtt-broker\",\"z\":\"\",\"broker\":\"localhost\",\"port\":\"1883\",\"clientid\":\"\",\"usetls\":false,\"compatmode\":true,\"keepalive\":\"60\",\"cleansession\":true,\"willTopic\":\"\",\"willQos\":\"0\",\"willPayload\":\"\",\"birthTopic\":\"\",\"birthQos\":\"0\",\"birthPayload\":\"\"}]\r\n  ```\r\n\r\n* For bcf-gateway-core-module\r\n  ```\r\n  [{\"id\":\"47ab49a8.0a88f8\",\"type\":\"mqtt in\",\"z\":\"97027127.a55f7\",\"name\":\"\",\"topic\":\"#\",\"qos\":\"2\",\"broker\":\"deefb40d.51f818\",\"x\":370,\"y\":100,\"wires\":[[\"7208a9c6.a8d3e8\"]]},{\"id\":\"7208a9c6.a8d3e8\",\"type\":\"debug\",\"z\":\"97027127.a55f7\",\"name\":\"\",\"active\":true,\"console\":\"false\",\"complete\":\"false\",\"x\":550,\"y\":100,\"wires\":[]},{\"id\":\"3e634a0c.8e15e6\",\"type\":\"inject\",\"z\":\"97027127.a55f7\",\"name\":\"All gateway info\",\"topic\":\"gateway/all/info/get\",\"payload\":\"\",\"payloadType\":\"str\",\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"x\":399,\"y\":192,\"wires\":[[\"84e9ef97.a81d5\"]]},{\"id\":\"84e9ef97.a81d5\",\"type\":\"mqtt out\",\"z\":\"97027127.a55f7\",\"name\":\"\",\"topic\":\"\",\"qos\":\"\",\"retain\":\"\",\"broker\":\"deefb40d.51f818\",\"x\":584,\"y\":193,\"wires\":[]},{\"id\":\"6d1a6395.7b49ac\",\"type\":\"inject\",\"z\":\"97027127.a55f7\",\"name\":\"Pairing mode start\",\"topic\":\"gateway/core-module/pairing-mode/start\",\"payload\":\"\",\"payloadType\":\"str\",\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"x\":400,\"y\":320,\"wires\":[[\"6bb142ef.da565c\"]]},{\"id\":\"6bb142ef.da565c\",\"type\":\"mqtt out\",\"z\":\"97027127.a55f7\",\"name\":\"\",\"topic\":\"\",\"qos\":\"\",\"retain\":\"\",\"broker\":\"deefb40d.51f818\",\"x\":585,\"y\":321,\"wires\":[]},{\"id\":\"191cf80e.901568\",\"type\":\"inject\",\"z\":\"97027127.a55f7\",\"name\":\"Pairing mode stop\",\"topic\":\"gateway/core-module/pairing-mode/stop\",\"payload\":\"\",\"payloadType\":\"str\",\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"x\":400,\"y\":360,\"wires\":[[\"11669b55.138775\"]]},{\"id\":\"11669b55.138775\",\"type\":\"mqtt out\",\"z\":\"97027127.a55f7\",\"name\":\"\",\"topic\":\"\",\"qos\":\"\",\"retain\":\"\",\"broker\":\"deefb40d.51f818\",\"x\":585,\"y\":361,\"wires\":[]},{\"id\":\"de1bca38.1214f8\",\"type\":\"inject\",\"z\":\"97027127.a55f7\",\"name\":\"List of paired nodes\",\"topic\":\"gateway/core-module/nodes/get\",\"payload\":\"\",\"payloadType\":\"str\",\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"x\":410,\"y\":240,\"wires\":[[\"7cb77d25.465514\"]]},{\"id\":\"7cb77d25.465514\",\"type\":\"mqtt out\",\"z\":\"97027127.a55f7\",\"name\":\"\",\"topic\":\"\",\"qos\":\"\",\"retain\":\"\",\"broker\":\"deefb40d.51f818\",\"x\":585,\"y\":241,\"wires\":[]},{\"id\":\"ec929b66.dddbb8\",\"type\":\"inject\",\"z\":\"97027127.a55f7\",\"name\":\"purge all nodes\",\"topic\":\"gateway/core-module/nodes/purge\",\"payload\":\"\",\"payloadType\":\"str\",\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"x\":400,\"y\":420,\"wires\":[[\"afe70282.f5ead\"]]},{\"id\":\"afe70282.f5ead\",\"type\":\"mqtt out\",\"z\":\"97027127.a55f7\",\"name\":\"\",\"topic\":\"\",\"qos\":\"\",\"retain\":\"\",\"broker\":\"deefb40d.51f818\",\"x\":585,\"y\":421,\"wires\":[]},{\"id\":\"deefb40d.51f818\",\"type\":\"mqtt-broker\",\"z\":\"\",\"broker\":\"localhost\",\"port\":\"1883\",\"clientid\":\"\",\"usetls\":false,\"compatmode\":true,\"keepalive\":\"60\",\"cleansession\":true,\"willTopic\":\"\",\"willQos\":\"0\",\"willPayload\":\"\",\"birthTopic\":\"\",\"birthQos\":\"0\",\"birthPayload\":\"\"}]\r\n  ```\r\n\r\n## License\r\n\r\nThis project is licensed under the [MIT License](https://opensource.org/licenses/MIT/) - see the [LICENSE](LICENSE) file for details.\r\n\r\n---\r\n\r\nMade with \u0026#x2764;\u0026nbsp; by [**HARDWARIO a.s.**](https://www.hardwario.com/) in the heart of Europe.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhardwario%2Fbch-gateway","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhardwario%2Fbch-gateway","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhardwario%2Fbch-gateway/lists"}