{"id":50821650,"url":"https://github.com/codejive/ewelink-mqtt-bridge","last_synced_at":"2026-06-13T14:30:59.088Z","repository":{"id":361930830,"uuid":"1256501651","full_name":"codejive/ewelink-mqtt-bridge","owner":"codejive","description":"eWeLink to MQTT Bridge","archived":false,"fork":false,"pushed_at":"2026-06-11T12:50:32.000Z","size":50,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-11T14:23:09.189Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codejive.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,"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-06-01T20:52:17.000Z","updated_at":"2026-06-03T13:32:21.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/codejive/ewelink-mqtt-bridge","commit_stats":null,"previous_names":["codejive/ewelink-mqtt-bridge"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/codejive/ewelink-mqtt-bridge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codejive%2Fewelink-mqtt-bridge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codejive%2Fewelink-mqtt-bridge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codejive%2Fewelink-mqtt-bridge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codejive%2Fewelink-mqtt-bridge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codejive","download_url":"https://codeload.github.com/codejive/ewelink-mqtt-bridge/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codejive%2Fewelink-mqtt-bridge/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34288662,"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-06-13T02:00:06.617Z","response_time":62,"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":[],"created_at":"2026-06-13T14:30:56.302Z","updated_at":"2026-06-13T14:30:59.084Z","avatar_url":"https://github.com/codejive.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# eWeLink to MQTT Bridge\r\n\r\n`ewelink-mqtt-bridge` connects to the eWeLink cloud websocket and republishes device updates to any MQTT broker.\r\n\r\nThis is useful when your eWeLink devices can't connect directly to your MQTT broker. For example because your broker is on a public server and uses SSL, which the eWeLink devices don't support.\r\n\r\n## How It Works\r\n\r\n1. Authenticate to eWeLink cloud using app credentials and account credentials.\r\n2. Open a persistent websocket to receive live device update events.\r\n3. Publish each update to MQTT topics using a predictable topic structure.\r\n\r\n## MQTT Topics\r\n\r\nDefault topic layout:\r\n\r\n- `ewelink/\u003cdeviceId\u003e/state/raw`\r\n- `ewelink/\u003cdeviceId\u003e/state/\u003ckey\u003e`\r\n- `ewelink/bridge/status`\r\n\r\nExamples:\r\n\r\n- `ewelink/1000abcdef/state/raw` -\u003e `{\"temperature\":22.5,\"humidity\":48}`\r\n- `ewelink/1000abcdef/state/temperature` -\u003e `22.5`\r\n- `ewelink/1000abcdef/state/humidity` -\u003e `48`\r\n- `ewelink/bridge/status` -\u003e `online` or `offline`\r\n\r\nTopic prefix is configurable via `TOPIC_PREFIX`.\r\n\r\nThe bridge publishes `ewelink/bridge/status=online` after connecting to the MQTT broker, and publishes `offline` during shutdown before closing MQTT cleanly. The MQTT last-will message is also set to `offline` so the status still flips if the process dies unexpectedly.\r\n\r\n## Environment Variables\r\n\r\nThe bridge is configured only through environment variables.\r\n\r\n| Variable | Required | Default | Description |\r\n| --- | --- | --- | --- |\r\n| `EWELINK_ACCOUNT` | Yes | - | eWeLink account identifier (email or phone number). |\r\n| `EWELINK_PASSWORD` | Yes | - | eWeLink account password used for cloud login. |\r\n| `EWELINK_APP_ID` | Yes | - | eWeLink developer app ID used for API authentication. |\r\n| `EWELINK_APP_SECRET` | Yes | - | eWeLink developer app secret used for API authentication. |\r\n| `EWELINK_REGION` | No | `us` | eWeLink region for your account. Valid values: `us`, `eu`, `cn`, `as`. |\r\n| `EWELINK_AREA_CODE` | No | `+1` | Area code used during login (required by eWeLink login API). |\r\n| `MQTT_URL` | No | `mqtt://127.0.0.1:1883` | MQTT broker URL. Examples: `mqtt://broker:1883`, `mqtts://broker:8883`. |\r\n| `MQTT_USER` | No | empty | Username for MQTT authentication. |\r\n| `MQTT_PASS` | No | empty | Password for MQTT authentication. |\r\n| `TOPIC_PREFIX` | No | `ewelink` | Prefix used for all published topics. |\r\n| `PUBLISH_RAW_STATE` | No | `true` | If `true`, publishes full update JSON to `\u003cprefix\u003e/\u003cdeviceId\u003e/state/raw`. |\r\n| `VERBOSE` | No | `false` | If `true`, logs every websocket message received from eWeLink, including non-update packets. |\r\n| `MQTT_RETAIN` | No | `true` | If `true`, publishes state messages with retain flag enabled. |\r\n| `MQTT_QOS` | No | `1` | MQTT QoS level for published messages. Allowed: `0`, `1`, `2`. |\r\n| `EXIT_ON_WEBSOCKET_CLOSE` | No | `true` | If `true`, process exits when eWeLink websocket closes (recommended in containers with restart policy). |\r\n\r\nBoolean variables (`PUBLISH_RAW_STATE`, `VERBOSE`, `MQTT_RETAIN`, `EXIT_ON_WEBSOCKET_CLOSE`) accept: `true/false`, `1/0`, `yes/no`, `on/off`.\r\n\r\n## Getting App Credentials\r\n\r\nThis bridge requires your own eWeLink app credentials:\r\n\r\n1. **Register an eWeLink Developer Account**\r\n   - Visit [eWeLink Developer Platform](https://dev.ewelink.io/)\r\n   - Create an account or log in\r\n\r\n2. **Create an Application**\r\n   - Navigate to the applications/credentials section\r\n   - Create a new application\r\n   - You'll receive an `APP_ID` and `APP_SECRET`\r\n\r\n3. **Configure the Bridge**\r\n   - Add `EWELINK_APP_ID` and `EWELINK_APP_SECRET` to your `.env` file or pass them as environment variables\r\n   - Set `EWELINK_ACCOUNT` to your eWeLink email or phone number\r\n\r\nIf you're unable to obtain credentials, check the [eWeLink API Next documentation](https://www.npmjs.com/package/ewelink-api-next) or the [eWeLink community forums](https://www.ewelink.cc/).\r\n\r\n## Quick Start (Node.js)\r\n\r\n1. Install dependencies:\r\n\r\n```bash\r\nnpm install\r\n```\r\n\r\n1. Run with required variables:\r\n\r\n```bash\r\nEWELINK_ACCOUNT=\"you@example.com\" \\\r\nEWELINK_PASSWORD=\"your-password\" \\\r\nEWELINK_REGION=\"eu\" \\\r\nEWELINK_AREA_CODE=\"+1\" \\\r\nEWELINK_APP_ID=\"your-app-id\" \\\r\nEWELINK_APP_SECRET=\"your-app-secret\" \\\r\nMQTT_URL=\"mqtt://127.0.0.1:1883\" \\\r\nnode bridge.js\r\n```\r\n\r\n## Docker\r\n\r\nBuild image:\r\n\r\n```bash\r\ndocker build -t ewelink-mqtt-bridge:local .\r\n```\r\n\r\nRun container:\r\n\r\n```bash\r\ndocker run -d \\\r\n  --name ewelink-mqtt-bridge \\\r\n  --restart unless-stopped \\\r\n  -e EWELINK_ACCOUNT=\"you@example.com\" \\\r\n  -e EWELINK_PASSWORD=\"your-password\" \\\r\n  -e EWELINK_REGION=\"eu\" \\\r\n  -e EWELINK_AREA_CODE=\"+1\" \\\r\n  -e EWELINK_APP_ID=\"your-app-id\" \\\r\n  -e EWELINK_APP_SECRET=\"your-app-secret\" \\\r\n  -e MQTT_URL=\"mqtt://broker:1883\" \\\r\n  -e MQTT_USER=\"mqtt-user\" \\\r\n  -e MQTT_PASS=\"mqtt-pass\" \\\r\n  ewelink-mqtt-bridge:local\r\n```\r\n\r\nUse host networking only if your platform/setup requires it.\r\n\r\n## Docker Compose\r\n\r\n1. Copy `.env.example` to `.env` and fill in your values.\r\n2. Update image in `docker-compose.yml` to your published image (or build locally and point to that tag).\r\n3. Start:\r\n\r\n```bash\r\ndocker compose up -d\r\n```\r\n\r\n## Publish to Docker Hub (Manual)\r\n\r\n```bash\r\ndocker login\r\ndocker tag ewelink-mqtt-bridge:local \u003cnamespace\u003e/ewelink-mqtt-bridge:latest\r\ndocker push \u003cnamespace\u003e/ewelink-mqtt-bridge:latest\r\n```\r\n\r\n`\u003cnamespace\u003e` can be a personal Docker Hub username or an organization name.\r\n\r\n## Publish via GitHub Actions\r\n\r\nWorkflow: `.github/workflows/docker-publish.yml`\r\n\r\nRequired repository secrets:\r\n\r\n- `DOCKERHUB_USERNAME`: Docker account used for login.\r\n- `DOCKERHUB_TOKEN`: Docker access token.\r\n- `DOCKERHUB_NAMESPACE`: Docker Hub namespace to publish to (user or organization).\r\n\r\nPublish behavior:\r\n\r\n- Push to default branch publishes `latest`.\r\n- Push tag `v*.*.*` publishes version tags.\r\n\r\n## Operational Notes\r\n\r\n- If websocket connectivity drops, the bridge can exit and rely on container restart policy.\r\n- MQTT retained messages are convenient for Home Assistant and similar consumers, but can be disabled with `MQTT_RETAIN=false`.\r\n- The bridge manages `ewelink/bridge/status` itself: `online` on MQTT connect, `offline` on shutdown, and `offline` via MQTT last-will if the process stops unexpectedly.\r\n- If your broker requires TLS, use an `mqtts://` URL and ensure trust/cert settings are provided by your runtime environment.\r\n\r\n## License\r\n\r\nThis project is licensed under the Apache License 2.0. See [LICENSE](LICENSE).\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodejive%2Fewelink-mqtt-bridge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodejive%2Fewelink-mqtt-bridge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodejive%2Fewelink-mqtt-bridge/lists"}