Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/plasticrake/tplink-smarthome-simulator
TP-Link Smarthome Device Simulator
https://github.com/plasticrake/tplink-smarthome-simulator
hs100 hs105 hs110 hs200 lb100 lb120 lb130 mock smarthome testing tplink
Last synced: 7 days ago
JSON representation
TP-Link Smarthome Device Simulator
- Host: GitHub
- URL: https://github.com/plasticrake/tplink-smarthome-simulator
- Owner: plasticrake
- License: mit
- Created: 2017-09-17T00:27:12.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2023-11-09T04:16:30.000Z (12 months ago)
- Last Synced: 2024-10-23T14:07:04.085Z (15 days ago)
- Topics: hs100, hs105, hs110, hs200, lb100, lb120, lb130, mock, smarthome, testing, tplink
- Language: JavaScript
- Size: 1.03 MB
- Stars: 67
- Watchers: 8
- Forks: 18
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# tplink-smarthome-simulator
[![NPM Version](https://img.shields.io/npm/v/tplink-smarthome-simulator.svg)](https://www.npmjs.com/package/tplink-smarthome-simulator)
[![Build Status](https://github.com/plasticrake/tplink-smarthome-simulator/workflows/CI/badge.svg?branch=main)](https://github.com/plasticrake/tplink-smarthome-simulator/actions?query=workflow%3ACI+branch%3Amain)
[![Coverage Status](https://coveralls.io/repos/github/plasticrake/tplink-smarthome-simulator/badge.svg?branch=main)](https://coveralls.io/github/plasticrake/tplink-smarthome-simulator?branch=main)
[![GitHub Sponsors](https://img.shields.io/github/sponsors/plasticrake)](https://github.com/sponsors/plasticrake)TP-Link Smart Home Device Simulator
I created this so I could automate my tests for [tplink-smarthome-api](https://github.com/plasticrake/tplink-smarthome-api/).
See more [examples](https://github.com/plasticrake/tplink-smarthome-simulator/tree/main/examples). [@simlu](https://github.com/simlu) has used this in creating [kasa-smart-hub](https://github.com/blackflux/kasa-smart-hub).
[`debug`](https://github.com/visionmedia/debug) is used for output. To see all messages set the DEBUG environment variable.
To see everything:```console
DEBUG=tplink-simulator:* node examples/multi-device.js
```To see most:
```console
DEBUG=tplink-simulator:*,-device:udp,*:error node examples/multi-device.js
``````javascript
const Device = require('..').Device;
const UdpServer = require('..').UdpServer;let devices = [];
// If you setup virtual interfaces or aliases you can have unique ips to work with Kasa app.
// On a mac you can run `sudo ifconfig en0 alias 10.0.0.200`
devices.push(
new Device({
port: 9999,
address: '10.0.0.200',
model: 'hs100',
data: { alias: 'Mock HS100', mac: '50:c7:bf:8f:58:18', deviceId: 'A100' },
}),
);
devices.push(
new Device({
port: 9999,
address: '10.0.0.201',
model: 'hs105',
data: { alias: 'Mock HS105', mac: '50:c7:bf:d8:bf:d4', deviceId: 'A105' },
}),
);
devices.push(
new Device({
port: 9999,
address: '10.0.0.202',
model: 'hs110',
data: { alias: 'Mock HS110', mac: '50:c7:bf:0d:91:8c', deviceId: 'A110' },
}),
);
devices.push(
new Device({
port: 9999,
address: '10.0.0.203',
model: 'hs200',
data: { alias: 'Mock HS200', mac: '50:c7:bf:46:b4:24', deviceId: 'A200' },
}),
);
devices.push(
new Device({
port: 9999,
address: '10.0.0.204',
model: 'lb100',
data: { alias: 'Mock LB100', mac: '50:c7:bf:49:ca:42', deviceId: 'BB100' },
}),
);
devices.push(
new Device({
port: 9999,
address: '10.0.0.205',
model: 'lb120',
data: { alias: 'Mock LB120', mac: '50:c7:bf:90:9b:da', deviceId: 'BB120' },
}),
);
devices.push(
new Device({
port: 9999,
address: '10.0.0.206',
model: 'lb130',
data: { alias: 'Mock LB130', mac: '50:c7:bf:b1:04:d3', deviceId: 'BB130' },
}),
);devices.forEach((d) => {
d.start();
});UdpServer.start();
```