{"id":51770921,"url":"https://github.com/orangecoding/tibber-ha-mqtt","last_synced_at":"2026-07-20T00:39:05.127Z","repository":{"id":371023049,"uuid":"1217860369","full_name":"orangecoding/tibber-ha-mqtt","owner":"orangecoding","description":"A robust bridge that subscribes to your Tibber Pulse real-time energy feed and publishes measurements as MQTT sensors to Home Assistant, with automatic device discovery.","archived":false,"fork":false,"pushed_at":"2026-07-12T07:34:45.000Z","size":1584,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-07-20T00:39:04.083Z","etag":null,"topics":["home-assistant","homeassistant","mqtt","tibber","tibberpulse"],"latest_commit_sha":null,"homepage":"https://www.orange-coding.net","language":"JavaScript","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/orangecoding.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-22T09:38:58.000Z","updated_at":"2026-07-12T07:34:52.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/orangecoding/tibber-ha-mqtt","commit_stats":null,"previous_names":["orangecoding/tibber-ha-mqtt"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/orangecoding/tibber-ha-mqtt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orangecoding%2Ftibber-ha-mqtt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orangecoding%2Ftibber-ha-mqtt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orangecoding%2Ftibber-ha-mqtt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orangecoding%2Ftibber-ha-mqtt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orangecoding","download_url":"https://codeload.github.com/orangecoding/tibber-ha-mqtt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orangecoding%2Ftibber-ha-mqtt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35669275,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-19T02:00:06.923Z","response_time":112,"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":["home-assistant","homeassistant","mqtt","tibber","tibberpulse"],"created_at":"2026-07-20T00:39:04.403Z","updated_at":"2026-07-20T00:39:05.089Z","avatar_url":"https://github.com/orangecoding.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ch1 align=\"center\"\u003etibber-ha-mqtt\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n\n\u003ca href=\"https://orange-coding.net/\"\u003e\n\u003cpicture\u003e\n  \u003cimg alt=\"Logo\" src=\"https://github.com/orangecoding/tibber-ha-mqtt/blob/master/media/logo.png\" width=\"200\"\u003e\n\u003c/picture\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n  \u003cp align=\"center\"\u003e\u003cstrong\u003eA robust bridge that subscribes to your Tibber Pulse real-time energy feed and publishes measurements as MQTT sensors to Home Assistant, with automatic device discovery.\u003c/strong\u003e\u003c/p\u003e\n\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://github.com/orangecoding/tibber-ha-mqtt/actions/workflows/test.yml/badge.svg\" alt=\"Tests\" /\u003e\n  \u003cimg src=\"https://github.com/orangecoding/tibber-ha-mqtt/actions/workflows/docker.yml/badge.svg\" alt=\"Docker\" /\u003e\n\u003c/p\u003e\n\n## Prerequisites\n\n- Node.js 22 or later\n- Yarn\n- A [Tibber Pulse](https://tibber.com/en/store/produkt/pulse) device connected to your meter\n- An MQTT broker reachable from this machine (e.g. Mosquitto)\n- Home Assistant with the [MQTT integration](https://www.home-assistant.io/integrations/mqtt/) enabled\n\n## Getting your Tibber API token\n\n1. Open a browser and go to **[developer.tibber.com/settings/access-token](https://developer.tibber.com/settings/access-token)**\n2. Log in with your Tibber account\n3. Click **\"Create new token\"** and give it a name (e.g. `tibber-ha-mqtt`)\n4. Copy the token -- you will paste it into `.env` as `TIBBER_TOKEN`\n\n\u003e Your token grants full read access to your Tibber account. Keep it secret and never commit it to git.\n\n## Setup\n\n```bash\n# 1. Clone the repo\ngit clone https://github.com/your-user/tibber-ha-mqtt.git\ncd tibber-ha-mqtt\n\n# 2. Install dependencies\nyarn inst\n\n# 3. Create your config file\ncp .env.example .env\n\n# 4. Fill in your token and MQTT broker URL\n#    Open .env in your editor and set TIBBER_TOKEN and MQTT_URL\n```\n\n## Configuration\n\nAll configuration lives in `.env`. Copy `.env.example` for a fully annotated template.\n\n| Variable                 | Required | Default   | Description                                                       |\n| ------------------------ | -------- | --------- | ----------------------------------------------------------------- |\n| `TIBBER_TOKEN`           | Yes      | --        | Your Tibber personal access token                                 |\n| `TIBBER_HOME_ID`         | Yes      | --        | Your Tibber home ID (find it at developer.tibber.com/explorer)    |\n| `MQTT_URL`               | Yes      | --        | MQTT broker URL (`mqtt://host:port`)                              |\n| `MQTT_USERNAME`          | No       | --        | MQTT username if your broker requires auth                        |\n| `MQTT_PASSWORD`          | No       | --        | MQTT password if your broker requires auth                        |\n| `NTFY_URL`               | No       | --        | ntfy topic URL for failure alerts                                 |\n| `STALE_DATA_TIMEOUT_MS`  | No       | `300000`  | Reconnect if no data received for this long (ms)                  |\n| `ALERT_COOLDOWN_MS`      | No       | `1800000` | Minimum gap between same-type alerts (ms)                         |\n| `RECONNECT_MAX_DELAY_MS` | No       | `300000`  | Maximum backoff delay between reconnect attempts (ms)             |\n| `LOG_LEVEL`              | No       | `info`    | Log verbosity: `trace`, `debug`, `info`, `warn`, `error`, `fatal` |\n\n### Enabling and disabling sensors\n\nEach `SENSOR_*` line in `.env` controls one Home Assistant sensor. Comment a line out to disable it:\n\n```dotenv\nSENSOR_POWER=true           # enabled\nSENSOR_CURRENT_L1=false     # disabled\n# SENSOR_VOLTAGE_L1=true    # also disabled (commented out)\n```\n\n### Removing sensors from Home Assistant\n\nEvery time the bridge starts it actively manages all known sensor topics on the broker:\n\n- **Enabled sensors** get their discovery payload published (retained), so HA creates or updates those entities.\n- **Disabled sensors** get an empty retained message published, which removes the old retained payload from the broker and tells HA to delete those entities.\n\nThis means disabling a sensor in `.env` and restarting the bridge is enough -- HA will drop that entity automatically within a few seconds.\n\n**Full reset** -- if you want to remove every Tibber entity from HA and start completely fresh, run:\n\n```bash\nyarn reset\n```\n\nThis publishes an empty retained message to every discovery topic (enabled and disabled alike). After it completes, restart the bridge normally and only the sensors enabled in `.env` will be re-created.\n\n## Running\n\n```bash\nyarn start\n```\n\n## Running with Docker\n\nThe image is published to the GitHub Container Registry and runs on both `amd64` and `arm64` (e.g. Raspberry Pi).\n\n### 1. Create your `.env` file\n\nThe container reads all configuration from an env file. Start from the template:\n\n```bash\ncp .env.example .env\n# Then open .env and fill in at minimum:\n#   TIBBER_TOKEN=...\n#   TIBBER_HOME_ID=...\n#   MQTT_URL=mqtt://192.168.1.x:1883\n```\n\nSee the [Configuration](#configuration) section for all available variables.\n\n### 2. Run with Docker Compose (recommended)\n\nPlace your `.env` file in the same directory as `docker-compose.yml`, then run:\n\n```bash\ndocker compose up -d\n```\n\nDocker Compose automatically picks up the `.env` from that directory (via the `env_file: .env` line in the compose file) and passes all variables into the container. The container restarts automatically if it crashes.\n\nTo follow logs:\n\n```bash\ndocker compose logs -f\n```\n\n### 3. Run with Docker CLI\n\nIf you prefer to run the container directly without Compose:\n\n```bash\ndocker run -d \\\n  --name tibber-ha-mqtt \\\n  --env-file /path/to/your/.env \\\n  --restart unless-stopped \\\n  ghcr.io/orangecoding/tibber-ha-mqtt:latest\n```\n\nReplace `/path/to/your/.env` with the absolute path to your env file. The `--env-file` flag must point to the file on the **host** machine -- it is not copied into the image.\n\n## Sensors\n\nAll sensors are published under the **Tibber Energy Source** device in Home Assistant.\n\nSensors marked with `*` are meter-dependent -- they may have no value if your electricity meter does not report that measurement.\n\n**Instantaneous power**\n\n| `.env` key                         | Sensor name               | Unit | Description                                   |\n| ---------------------------------- | ------------------------- | ---- | --------------------------------------------- |\n| `SENSOR_POWER`                     | Power                     | W    | Grid consumption right now                    |\n| `SENSOR_POWER_PRODUCTION`          | Power Production          | W    | Grid export right now (e.g. solar) `*`        |\n| `SENSOR_POWER_REACTIVE`            | Power Reactive            | kvar | Reactive power drawn from grid right now `*`  |\n| `SENSOR_POWER_PRODUCTION_REACTIVE` | Power Production Reactive | kvar | Reactive power exported to grid right now `*` |\n| `SENSOR_POWER_FACTOR`              | Power Factor              | --   | Ratio of real to apparent power, 0.0-1.0 `*`  |\n\n**Daily min / average / max** (reset at midnight)\n\n| `.env` key                    | Sensor name          | Unit | Description                                      |\n| ----------------------------- | -------------------- | ---- | ------------------------------------------------ |\n| `SENSOR_AVERAGE_POWER`        | Average Power        | W    | Average grid consumption since midnight          |\n| `SENSOR_MIN_POWER`            | Min Power            | W    | Lowest instantaneous consumption since midnight  |\n| `SENSOR_MAX_POWER`            | Max Power            | W    | Highest instantaneous consumption since midnight |\n| `SENSOR_MIN_POWER_PRODUCTION` | Min Power Production | W    | Lowest instantaneous export since midnight `*`   |\n| `SENSOR_MAX_POWER_PRODUCTION` | Max Power Production | W    | Highest instantaneous export since midnight `*`  |\n\n**Accumulated energy** (reset at midnight / top of each hour)\n\n| `.env` key                                 | Sensor name                       | Unit | Description                               |\n| ------------------------------------------ | --------------------------------- | ---- | ----------------------------------------- |\n| `SENSOR_ACCUMULATED_CONSUMPTION`           | Accumulated Consumption           | kWh  | Total drawn from grid since midnight      |\n| `SENSOR_ACCUMULATED_PRODUCTION`            | Accumulated Production            | kWh  | Total exported to grid since midnight     |\n| `SENSOR_ACCUMULATED_CONSUMPTION_LAST_HOUR` | Accumulated Consumption Last Hour | kWh  | Drawn from grid since the last full hour  |\n| `SENSOR_ACCUMULATED_PRODUCTION_LAST_HOUR`  | Accumulated Production Last Hour  | kWh  | Exported to grid since the last full hour |\n\n**Cost** (requires an active Tibber power deal; otherwise no value)\n\n| `.env` key                  | Sensor name        | Description                                                      |\n| --------------------------- | ------------------ | ---------------------------------------------------------------- |\n| `SENSOR_ACCUMULATED_COST`   | Accumulated Cost   | Electricity cost since midnight, VAT included (account currency) |\n| `SENSOR_ACCUMULATED_REWARD` | Accumulated Reward | Production reward earned since midnight (account currency)       |\n\n**Per-phase measurements** `*`\n\n| `.env` key          | Sensor name | Unit | Description        |\n| ------------------- | ----------- | ---- | ------------------ |\n| `SENSOR_CURRENT_L1` | Current L1  | A    | Current on phase 1 |\n| `SENSOR_CURRENT_L2` | Current L2  | A    | Current on phase 2 |\n| `SENSOR_CURRENT_L3` | Current L3  | A    | Current on phase 3 |\n| `SENSOR_VOLTAGE_L1` | Voltage L1  | V    | Voltage on phase 1 |\n| `SENSOR_VOLTAGE_L2` | Voltage L2  | V    | Voltage on phase 2 |\n| `SENSOR_VOLTAGE_L3` | Voltage L3  | V    | Voltage on phase 3 |\n\n**Device and meter state**\n\n| `.env` key                      | Sensor name            | Unit | Description                                                |\n| ------------------------------- | ---------------------- | ---- | ---------------------------------------------------------- |\n| `SENSOR_SIGNAL_STRENGTH`        | Signal Strength        | dBm  | Tibber Pulse signal strength `*`                           |\n| `SENSOR_LAST_METER_CONSUMPTION` | Last Meter Consumption | kWh  | Electricity meter all-time import total (never resets) `*` |\n| `SENSOR_LAST_METER_PRODUCTION`  | Last Meter Production  | kWh  | Electricity meter all-time export total (never resets) `*` |\n\n## Failure alerting\n\nSet `NTFY_URL` in `.env` to receive push notifications when the bridge loses connectivity:\n\n```dotenv\nNTFY_URL=https://ntfy.sh/my-private-topic-12345\n```\n\nThree alert categories are tracked independently with a 30-minute cooldown each:\n\n- **tibber-disconnect** -- Tibber WebSocket connection lost after multiple retries\n- **mqtt-disconnect** -- MQTT broker unreachable\n- **stale-data** -- No measurements received within the timeout window\n\nTo receive alerts on your phone, install the [ntfy app](https://ntfy.sh/) and subscribe to the same topic.\n\n## Running as a systemd service\n\nCreate `/etc/systemd/system/tibber-ha-mqtt.service`:\n\n```ini\n[Unit]\nDescription=Tibber MQTT Bridge\nAfter=network-online.target\nWants=network-online.target\n\n[Service]\nType=simple\nUser=YOUR_USERNAME\nWorkingDirectory=/path/to/tibber-ha-mqtt\nExecStart=/usr/bin/node src/index.js\nRestart=always\nRestartSec=10\nEnvironmentFile=/path/to/tibber-ha-mqtt/.env\nStandardOutput=journal\nStandardError=journal\n\n[Install]\nWantedBy=multi-user.target\n```\n\nThen enable and start it:\n\n```bash\nsudo systemctl daemon-reload\nsudo systemctl enable tibber-ha-mqtt\nsudo systemctl start tibber-ha-mqtt\n\n# Check logs\nsudo journalctl -u tibber-ha-mqtt -f\n```\n\n## Running with Docker\n\n```bash\ndocker run -d \\\n  --name tibber-ha-mqtt \\\n  --restart unless-stopped \\\n  --env-file .env \\\n  node:22-alpine \\\n  sh -c \"yarn inst \u0026\u0026 yarn start\"\n```\n\n## Development\n\n```bash\n# Run tests\nyarn test\n\n# Lint\nyarn lint\n\n# Format\nyarn format\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forangecoding%2Ftibber-ha-mqtt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forangecoding%2Ftibber-ha-mqtt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forangecoding%2Ftibber-ha-mqtt/lists"}