{"id":40986287,"url":"https://github.com/openenergymonitor/emonpi-ha-bridge","last_synced_at":"2026-01-22T07:31:57.791Z","repository":{"id":140902168,"uuid":"90397315","full_name":"openenergymonitor/emonpi-ha-bridge","owner":"openenergymonitor","description":"Install guide for ha-bridge (home automation) on emonPi and use Google Home / Amazon Echo to control MQTT devices via voice","archived":false,"fork":false,"pushed_at":"2018-02-15T23:56:25.000Z","size":234,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-01-24T19:09:26.366Z","etag":null,"topics":["amazon-echo","emonpi","google-home","ha-bridge","mqtt","philips-hue"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openenergymonitor.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,"governance":null}},"created_at":"2017-05-05T16:46:08.000Z","updated_at":"2018-05-12T13:06:45.000Z","dependencies_parsed_at":"2023-09-22T15:33:06.741Z","dependency_job_id":null,"html_url":"https://github.com/openenergymonitor/emonpi-ha-bridge","commit_stats":{"total_commits":5,"total_committers":2,"mean_commits":2.5,"dds":"0.19999999999999996","last_synced_commit":"c6c5fbb1f494f4bc3b1ea7f024b660c11d074028"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/openenergymonitor/emonpi-ha-bridge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openenergymonitor%2Femonpi-ha-bridge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openenergymonitor%2Femonpi-ha-bridge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openenergymonitor%2Femonpi-ha-bridge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openenergymonitor%2Femonpi-ha-bridge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openenergymonitor","download_url":"https://codeload.github.com/openenergymonitor/emonpi-ha-bridge/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openenergymonitor%2Femonpi-ha-bridge/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28658107,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["amazon-echo","emonpi","google-home","ha-bridge","mqtt","philips-hue"],"created_at":"2026-01-22T07:31:57.711Z","updated_at":"2026-01-22T07:31:57.784Z","avatar_url":"https://github.com/openenergymonitor.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"Here are install instructions to run [ha-bridge](https://github.com/bwssytems/ha-bridge) on an emonPi (Raspberry Pi running [emonSD](https://github.com/openenergymonitor/emonpi/wiki/emonSD-pre-built-SD-card-Download-\u0026-Change-Log) based on Raspbian Jessie).\n\nHome automation (HA) bridge emulates a Philips Hue light system and can control other systems such as a Vera, Harmony Hub, Nest, MiLight bulbs or any other system that has an http/https/tcp/udp interface.\n\nUsing ha-bridge Google Home or Amazon Echo can be used to control MQTT devices via voice. E.g [WiFi MQTT Relay](https://guide.openenergymonitor.org/integrations/mqtt-relay/), [LightWave RF plugs](https://guide.openenergymonitor.org/integrations/lightwaverf) or Sonoff plugs (with MQTT FW).\n\nThe install instructions below are mostly coped from [ha-bridge repo readme](https://github.com/bwssytems/ha-bridge) with a few changes to work on the emonPi with it's read-only root file-system.\n\n# Video Demo\n\n[Google Home Controlling MQTT Video Demo](https://www.youtube.com/watch?v=r_v4GXVp0OI)\n\n# Install ha-bridge on emonPi\n\n*Tested on [emonSD-07Nov16](https://github.com/openenergymonitor/emonpi/wiki/emonSD-pre-built-SD-card-Download-\u0026-Change-Log#emonsd-07nov16)*\n\nThe emonPi runs a read-only file-system. The only folder which is mounted as RW is `/home/pi/data/`, we need to move ha-bridge config to this folder to allow ha-bridge to be able to save it's db and config when emonPi is in RO mode:\n\n```\nrpi-rw\ncd home/pi/data\nmkdir habridge\nwget https://github.com/bwssytems/ha-bridge/releases/download/v4.5.0/ha-bridge-4.5.0.jar\n```\n\nReplace the above URL with latest version\n\n## Run for the first time\n\nSince ha-bridge by default runs on port 80 we need to stop apache (serving emoncms) temporarily to allow us to run ha-bridge for the first time:\n\n`sudo service apache2 stop`\n\nTest run the ha-bridge\n\n`sudo java -jar ha-bridge-4.5.0.jar`\n\nNote you can also select which port to start the ha-bridge by using the command line option:\n### -Dserver.port=`\u003cport number\u003e`\neg:\n```\njava -jar -Dserver.port=8081 ha-bridge-W.X.Y.jar\n```\n\n## Make ha-bridge run alongside Apache\n\nBrowse to the GUI web page and edit the port (under Bridge Control) to run on a different port, lets go for 8081 (since OpenHAB is running on 8080). Save the config\n\n[http://emonpi/#!/system](http://emonpi/#!/system)\n\nNow return to SSH terminal and stop java process (CTRL + C) then open port 8081\n\n`sudo ufw allow 8081/tcp`\n\nNow start ha-bridge java process and browser to port 8081\n\n[http://emonpi:8081](http://emonpi:8081)\n\nYou should now be able to see ha-bridge web page..great! Now stop ha-bridge again (CTRL+C)\n\n\n\n\n\n# Enable the required Apache modules:\n\n`a2enmod proxy proxy_http headers`\n\nWe now need to make ha-bridge run nicely alongside Apache (which is already using port 80). Edit apache config to create a reverse proxy to allow ha-bridge to run alongside apache on port 80. All `/api` calls will be passed to ha-config\n\n`sudo nano /etc/apache2/sites-enabled/000-default.conf`\n\nAt the following lines below `\u003cVirtualHost *:80\u003e`\n\n```\nProxyPass         /api  http://localhost:8081/api nocanon\n        ProxyPassReverse  /api  http://localhost:8081/api\n        ProxyRequests     Off\n        AllowEncodedSlashes NoDecode\n\n        # Local reverse proxy authorization override\n        # Most unix distribution deny proxy by default (ie /etc/apache2/mods-enabled/proxy.conf in Ubuntu)\n        \u003cProxy http://localhost:8081/api*\u003e\n                  Order deny,allow\n                  Allow from all\n        \u003c/Proxy\u003e\n```\n\nSave and exit nano then start Apache:\n\n`sudo service apache2 start`\n\nNow the ha-bridge API should be able to run alongside Apache on port 80. Google Home requires ha-bridge to be on port 80.\n\n\n## Run ha-bridge as a sysem service\n\nStart here to create the habridge.service unit file:\n```\ncd /etc/systemd/system\nsudo nano habridge.service\n```\nCopy the text below into the editor nano, note the custom emonPi RW location for the config file.\n\n```\n[Unit]\nDescription=HA Bridge\nWants=network.target\nAfter=network.target\n\n[Service]\nType=simple\nWorkingDirectory=/home/pi/data/habridge\nExecStart=/usr/bin/java -jar -Dconfig.file=/home/pi/data/habridge/data/habridge.config /home/pi/data/habridge/ha-bridge-4.5.0.jar\n\n[Install]\nWantedBy=multi-user.target\n```\nSave the file in the editor by hitting CTL-X and then saying Y to update and save.\n\nReload the system control config:\n```\nsudo systemctl daemon-reload\n```\nTo start the bridge:\n```\nsudo systemctl start habridge.service\n```\nTo start the service at boot, use the `enable` command:\n```\nsudo systemctl enable habridge.service\n```\nTo look at the log, the output goes into the system log at `/var/log/syslog':\n```\ntail -f /var/log/syslog\n```\n\n## Connect ha-bridge to emonPi MQTT server\n\nLoad the ha-bridge web interface (http://emonpi:8081) and navigate to `Bridge Control` in the MQTT section enter:\n\n```\nclient ID: habridge\nIP: localhost\nuser: emonpi\npasssword: emonpimqtt2016\n```\n\nThen Save changes.\n\nThese are the [default emonpi passwords](https://guide.openenergymonitor.org/technical/credentials/).\n\n\n## Add MQTT devices to ha-bridge\n\nOnce ha-bridge has resrtarted and you refresh the web page, you should see a `MQTT Messages` tab appear in the top bar. You can also check the log via the web interface to check that MQTT has connected succesfully.\n\nThe `MQTT messages` tab will allow us to easily create MQTT tems in ha-bride.\n\nAdding MQTT devices should be self explanatory.\n\n![ha-bridge-device-config.png](ha-bridge-device-config.png)\n\n## Connect Google Home to ha-bridge\n\nUsing the Google Home app choose `Home Control` from the menu the choose to add a Philips Hue device. The Google Home should now connect to the ha-bridge (that emulates Philips Hue) and the devices added to ha-bridge should now appear.\n\n![google-home-app.png](google-home-app.png)\n\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenenergymonitor%2Femonpi-ha-bridge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenenergymonitor%2Femonpi-ha-bridge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenenergymonitor%2Femonpi-ha-bridge/lists"}