{"id":18445722,"url":"https://github.com/voronenko/openhab-remote-xiaomi","last_synced_at":"2025-10-19T14:47:45.671Z","repository":{"id":145345673,"uuid":"164224339","full_name":"Voronenko/openhab-remote-xiaomi","owner":"Voronenko","description":"Notes on setup openhab  supporting receiving multicasts from remote xiaomi gateway endpoints","archived":false,"fork":false,"pushed_at":"2019-12-08T16:12:52.000Z","size":51,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T01:15:33.728Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Voronenko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"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}},"created_at":"2019-01-05T14:56:32.000Z","updated_at":"2019-12-08T16:12:54.000Z","dependencies_parsed_at":"2024-04-19T08:15:48.735Z","dependency_job_id":null,"html_url":"https://github.com/Voronenko/openhab-remote-xiaomi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voronenko%2Fopenhab-remote-xiaomi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voronenko%2Fopenhab-remote-xiaomi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voronenko%2Fopenhab-remote-xiaomi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voronenko%2Fopenhab-remote-xiaomi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Voronenko","download_url":"https://codeload.github.com/Voronenko/openhab-remote-xiaomi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248986315,"owners_count":21194025,"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":[],"created_at":"2024-11-06T07:06:59.731Z","updated_at":"2025-10-19T14:47:45.581Z","avatar_url":"https://github.com/Voronenko.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# openhab-remote-xiaomi\nNotes on setup openhab  supporting receiving multicasts from remote xiaomi gateway endpoints\n\n## Network setup\n\nXiaomi smarthome gateways after recent firmware update no longer provides REST interface for updates.\nInstead, it provides updates purely in local network using multicast to group 224.0.0.50 and port 9898.\n\nThis requires us to \n\na) Connect to remote site using L2 layer, using vpn that supports that scenario (for example openvpn)\n\nb) As OpenHab does not support multicast listening on multiple interfaces, and 224.0.0.50 can't be routed\nusing igmpproxy, pimd or smcroute - the only choice is configuring Bridge Networking on opehab server,\ncombining local ethernet (eth0) together with VPN interface (tap0)\n\n## Openhab Server - Bridge Networking \n\nNote, in some systems, like Raspbian necessary package might not be installed. Check additionally.\n\n```sh\n\nsudo apt-get install -y bridge-utils\n\n```\n\n`/etc/network/interfaces`\n\n```conf\n\n# Include files from /etc/network/interfaces.d:\nsource-directory /etc/network/interfaces.d\n\n# The primary network interface - supress ip\nauto eth0\niface eth0 inet manual\n\nauto br0\n\niface br0 inet static\n\naddress 192.168.2.222\n    netmask 255.255.255.0\n    broadcast 192.168.2.0\n    gateway 192.168.2.1\n    dns-nameservers 8.8.8.8 \n    bridge_ports eth0\n    bridge_stp off\n    bridge_fd 0\n    bridge_maxwait 0\n\n```\n\n## Openhab Server - Openvpn Client\n\n`/etc/openvpn/client.conf`\n\n```conf\n\nclient\n\ndev tap\n;dev tun\n\n;proto tcp\nproto udp\n\nremote your.openvpn.server 1194\n\nresolv-retry infinite\n\nnobind\n\n# Downgrade privileges after initialization (non-Windows only)\n;user nobody\n;group nogroup\n\n# Try to preserve some state across restarts.\npersist-key\npersist-tun\n\n# SSL/TLS parms.\nca /etc/openvpn/client/ca.crt\ncert /etc/openvpn/client/client.crt\nkey /etc/openvpn/client/client.key\n\n# Set log file verbosity.\nverb 3\n\n# Silence repeating messages\n;mute 20\n\nscript-security 2\n\nup /etc/openvpn/up.sh\ndown /etc/openvpn/down.sh\n\n```\n\nup.sh\n```sh\n\n#!/bin/sh\n\n# tap0 | 1500 | 1573 | 192.168.1.246 | 255.255.255.0 | init\necho \"$1 | $2 | $3 | $4 | $5 | $6\"\n\n\nif ip link show tap0 | grep \"master br0\" ; then\n    echo \"Tap0 is already part of the bridge, skipping\"\nelse\n    echo \"Adding Tap0 to bridge\"\n    ifconfig $1 0.0.0.0 promisc up\n    ip link set tap0 master br0\nfi\n\n```\n\ndown.sh\n```\n\n#!/bin/sh\n\nif ip link show tap0 | grep \"master br0\" ; then\n    echo \"Unbinding interface from bridge\"\n    ip link set tap0 nomaster || true\nelse\n    echo \"Tap0 is not part of the bridge\"\nfi\n\n```\n\n## Openhab Server - Validating setup\n\n```sh\nsudo tcpdump -i br0 dst host 224.0.0.50 and port 9898\nlistening on br0, link-type EN10MB (Ethernet), capture size 262144 bytes\n16:06:24.485583 IP 192.168.2.214.4321 \u003e 224.0.0.50.9898: UDP, length 136\n16:06:27.723873 IP 192.168.1.10.4321 \u003e 224.0.0.50.9898: UDP, length 135\n```\n\n## Openhab Server - Persisting configuration changes\n\nI am running home automation on simple Raspberry PI 3. It has one drawback - for 24/7 work termals are not good even with passive cooling. SD card potentially might die quite soon, hardware - depends on plate cooling quality. \n\nThus I prefer to configure openhab via file configuration,\nwith set of deployment batches, that provision openhab server with updates. All configuration changes are stored in a private git repository.\n\nAdditionally, ansible plays are used for initial box configuration (zsh shell, docker daemon, prometheus exporters, openvpn configuration and so on)\n\nThis allows me\n\n## Remote site - OpenVPN server\n\nIdeally, you might have router that already supports L2 OpenVPN. Routers supporting custom firmwares (Padawan, Openwrt, Tomato - for sure), Microtics and so on.\n\nIf for any reason you don't have such router, this means you would need to place one more box on remote site (possible - the same raspberry pi) and install OpenVPN there.\n\n## Tips and tricks\n\nDesign patterns\n\nhttps://community.openhab.org/tags/designpattern\n\nVS Code extension\n\nhttps://github.com/openhab/openhab-vscode\n\nOpenVPN configs generator by SparkLabs\n\nhttps://github.com/thesparklabs/openvpn-configuration-generator\n\nDelayed writes for log files\n\nhttps://github.com/azlux/log2ram\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoronenko%2Fopenhab-remote-xiaomi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoronenko%2Fopenhab-remote-xiaomi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoronenko%2Fopenhab-remote-xiaomi/lists"}