{"id":16156545,"url":"https://github.com/nioc/synology-srm-nodejs-api","last_synced_at":"2025-03-18T20:30:40.060Z","repository":{"id":61267024,"uuid":"549246696","full_name":"nioc/synology-srm-nodejs-api","owner":"nioc","description":"Unofficial dependency-free Node.js wrapper for Synology SRM API","archived":false,"fork":false,"pushed_at":"2023-12-03T23:31:47.000Z","size":447,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-09T10:32:49.424Z","etag":null,"topics":["router","srm","synology"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/synology-srm-nodejs-api","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nioc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2022-10-10T22:46:31.000Z","updated_at":"2023-12-04T02:19:07.000Z","dependencies_parsed_at":"2024-09-25T00:10:01.097Z","dependency_job_id":null,"html_url":"https://github.com/nioc/synology-srm-nodejs-api","commit_stats":{"total_commits":4,"total_committers":2,"mean_commits":2.0,"dds":0.25,"last_synced_commit":"a3e5007dab5980a7cee2ac089405acce36f1e3c9"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nioc%2Fsynology-srm-nodejs-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nioc%2Fsynology-srm-nodejs-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nioc%2Fsynology-srm-nodejs-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nioc%2Fsynology-srm-nodejs-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nioc","download_url":"https://codeload.github.com/nioc/synology-srm-nodejs-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243950792,"owners_count":20373664,"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":["router","srm","synology"],"created_at":"2024-10-10T01:45:13.639Z","updated_at":"2025-03-18T20:30:39.775Z","avatar_url":"https://github.com/nioc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# synology-srm-nodejs-api\n\n[![license: AGPLv3](https://img.shields.io/badge/license-AGPLv3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/nioc/synology-srm-nodejs-api/commit.yml)](https://github.com/nioc/synology-srm-nodejs-api/actions/workflows/commit.yml)\n[![Coverage Status](https://coveralls.io/repos/github/nioc/synology-srm-nodejs-api/badge.svg?branch=master)](https://coveralls.io/github/nioc/synology-srm-nodejs-api?branch=master)\n[![GitHub release](https://img.shields.io/github/release/nioc/synology-srm-nodejs-api.svg)](https://github.com/nioc/synology-srm-nodejs-api/releases/latest)\n[![npms.io (final)](https://img.shields.io/npms-io/final-score/synology-srm-nodejs-api)](https://www.npmjs.com/package/synology-srm-nodejs-api)\n[![npm](https://img.shields.io/npm/dt/synology-srm-nodejs-api)](https://www.npmjs.com/package/synology-srm-nodejs-api)\n\nUnofficial dependency-free Node.js wrapper for Synology SRM API.\n\n## Key features\n-    authentication,\n-    get WAN status,\n-    get WAN connection (ip, status, interface name),\n-    get network utilization,\n-    get devices with status, IP, etc... ,\n-    get wifi devices with link quality, signal strength, max rate, band used, etc... ,\n-    get devices traffic usage (live, day, week, month),\n-    get mesh nodes with status, connected devices, etc... ,\n-    get and update policy rules,\n-    get access control groups with devices, online status, etc... ,\n-    get Quality Of Service rules by devices,\n-    get Smart WAN configuration (gateways list with status, load balancing / failover),\n-    set Smart WAN configuration and switch WAN gateway,\n-    get and set Wi-Fi configuration,\n-    enable or disable a Wi-Fi radio by its SSID,\n-    get wake-on-lan devices,\n-    add wake-on-lan on a device,\n-    wake-on-lan a device.\n\n## Installation\n\n``` bash\nnpm install synology-srm-nodejs-api\n```\n\n## Usage\n\n### Disclaimer\n\nThis library lets you **modify SRM's configuration**. Its use is entirely at **your own risk**.\nWe cannot be held responsible for any damage resulting from misuse or bugs.\n\n### SRM version\n\nThis library has been checked with SRM version `1.3.1-9346 Update 8`.\n\nPlease note that future SRM updates may break its functionality, in which case please create a [bug report](https://github.com/nioc/synology-srm-nodejs-api/issues/new).\n\n### Basic example\n```js\nconst { SrmClient } = require('synology-srm-nodejs-api')\n\n// you need to set your own information\nconst baseUrl = 'https://10.0.0.1:8001'\nconst login = 'admin-user'\nconst password = 'admin-password'\nlet sid = null\nconst outputInline = false\n\nfunction output (label, data) {\n  if (outputInline) {\n    console.log(`${label}: ${JSON.stringify(data)}`)\n    return\n  }\n  console.log(label + ':')\n  console.dir(data, { depth: null, colors: true })\n}\n\nasync function main () {\n  try {\n    // create client\n    const client = new SrmClient(baseUrl, sid, { timeout: 5000 })\n\n    // authenticate\n    if (sid === null) {\n      sid = await client.authenticate(login, password)\n      output('Session Id for further usage', sid)\n    }\n\n    // get WAN status\n    const wanStatus = await client.getWanStatus()\n    output('WAN is connected', wanStatus)\n\n    // get WAN connection\n    const wanConnection = await client.getWanConnectionStatus()\n    output('WAN connection', wanConnection)\n\n    // get devices traffic\n    const traffic = await client.getTraffic('live')\n    // [optionnal] add protocol label on each device/recording\n    traffic\n      .forEach(device =\u003e device.recs\n        .forEach(record =\u003e record.protocollist\n          .forEach(proto =\u003e {\n            proto.label = client.getProtocolLabel(proto.protocol)\n          })))\n    output('Devices traffic', traffic)\n\n    // get utilization by network\n    const networkUtilization = await client.getNetworkUtilization()\n    output('Utilization by network', networkUtilization)\n\n    // get known devices\n    const devices = await client.getDevices()\n    output('Devices', devices)\n\n    // get control groups\n    const groups = await client.getAccessControlGroups(false)\n    output('Control groups', groups)\n\n    client.computeAccessControlGroupStatus(groups, devices)\n    output('Control groups with online status and onlines devices count', groups)\n\n    // get policy rules\n    const rules = await client.getPolicyRoutes()\n    output('Policy rules', rules)\n\n    // update policy rules\n    /* Commented in this sample code because it updates the configuration\n    // change something in `rules` before request\n    await client.setPolicyRoutes(rules)\n    */\n\n    // get Wi-Fi devices\n    const wifiDevices = await client.getWifiDevices()\n    output('Wi-Fi devices', wifiDevices)\n\n    // get mesh nodes\n    const meshNodes = await client.getMeshNodes()\n    output('Mesh nodes', meshNodes)\n\n    // get smart WAN gateways\n    const smartWanGateways = await client.getSmartWanGateway()\n    output('Smart WAN gateways', smartWanGateways)\n\n    // get smart WAN configuration\n    const smartWanConfiguration = await client.getSmartWan()\n    output('Smart WAN configuration', smartWanConfiguration)\n\n    // update smart WAN configuration\n    /* Commented in this sample code because it updates the configuration\n    // change something in `smartWanConfiguration` before request\n    const updatedSmartWanConfiguration = await client.setSmartWan(smartWanConfiguration)\n    output('Updated smart WAN gateways', updatedSmartWanConfiguration)\n    */\n\n    // switch smart WAN interfaces\n    /* Commented in this sample code because it updates the configuration\n    const switchedSmartWanConfiguration = await client.switchSmartWan()\n    output('Updated smart WAN gateways (switch interfaces)', switchedSmartWanConfiguration)\n    */\n\n    // get wake on lan devices\n    const wolDevices = await client.getWakeOnLanDevices()\n    output('Wake on lan devices', wolDevices)\n\n    // add a wake on lan device\n    /* Commented in this sample code because it updates the configuration\n    const mac = '00:00:00:00:00:00'\n    const host = 'my-device'\n    const wolDevice = await client.addWakeOnLan(mac, host)\n    output('Added wake on lan device', wolDevice)\n    */\n\n    // wake on lan a device\n    /* Commented in this sample code because it updates the configuration\n    const mac = '00:00:00:00:00:00'\n    await client.wakeOnLan(mac)\n    */\n\n    // get Quality Of Service rules by devices\n    const qosRules = await client.getQos()\n    output('Quality Of Service rules by devices', qosRules)\n\n    // get Wi-Fi settings\n    const wifiSettings = await client.getWifiSettings()\n    output('Wi-Fi settings', wifiSettings)\n\n    // switch Wi-Fi radio for SSID `Guests-Network`\n    /* Commented in this sample code because it updates the configuration\n    await client.switchWifiRadio('Guests-Network')\n    */\n  } catch (error) {\n    output('Error during main process', error)\n  }\n}\n\nmain()\n```\n\n## Versioning\n\nsynology-srm-nodejs-api is maintained under the [semantic versioning](https://semver.org/) guidelines.\n\nSee the [releases](https://github.com/nioc/synology-srm-nodejs-api/releases) on this repository for changelog.\n\n## License\n\nThis project is licensed under the GNU Affero General Public License v3.0 - see the [LICENSE](LICENSE.md) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnioc%2Fsynology-srm-nodejs-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnioc%2Fsynology-srm-nodejs-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnioc%2Fsynology-srm-nodejs-api/lists"}