Git Product home page Git Product logo

tplink-smarthome-simulator's Introduction

tplink-smarthome-simulator

NPM Version Build Status codecov

Kasa Screenshot

TP-Link Smart Home Device Simulator

I created this so I could automate my tests for tplink-smarthome-api.

See more examples.

debug is used for output. To see all messages set the DEBUG environment variable. To see everything:

DEBUG=* node examples/multi-device.js

To see most:

DEBUG=*,-device:udp,*:error node examples/multi-device.js
'use strict';

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();

tplink-smarthome-simulator's People

Contributors

plasticrake avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.