Giter Club home page Giter Club logo

node-somfy-synergy's Introduction

node-somfy-synergy

A JavaScript interface for the Somfy Synergy API (myLink).

This package was tested using a Somfy myLink (Rev 2.0). To find out if your Somfy myLink is Rev 2.0, check out "What is different with the newer myLink (Rev 2.0)?" on the Somfy myLink FAQ.

Setup

You will need to use the Somfy myLink mobile app in order to configure your System ID, to obtain your Somfy myLink's IP address, and to obtain the Target IDs for each remotely controlled device.

  • Go to "Integration" and set a System ID by tapping "Change System ID" (which can be any string).
  • Tap "Get Integration report" to view the System ID, IP address, and Target IDs.

Example

The SomfySynergy class is instantiated with the System ID and IP address of your Somfy myLink.

The SomfySynergy class allows you to send the "down", "stop", and "up" commands to each target device.

const synergy = new SomfySynergy('mySystem', '192.168.1.123');

// Open the first set of shades.
const target1 = synergy.target('AB123C45.1');
target1.up();

// Close the second set of shades.
const target2 = synergy.target('AB123C45.2');
target2.down();

// Stop (or go to the favorite position for) the third set of shades.
const target3 = synergy.target('AB123C45.2');
target3.stop();

Each command is asynchronous (i.e. returns a promise):

synergy
  .target('AB123C45.1')
  .up()
  .then(success => {
    if (success) {
      console.log('Opened the first set of shades!');
    } else {
      console.error('Failed to open the first set of shades.');
    }
  });

Composite Targeting

The SomfySynergy.Platform class exposes an interface similar to SomfySynergy. Unlike SomfySynergy, this class will efficiently batch requests into "composite targets".

For example, suppose you have three Somfy myLink targets:

  • Target A: Left Window Shade
  • Target B: Right Window Shade
  • Target C: Both Window Shades

In other words, Target C is a channel programmed to control both Target A and Target B. You could then instantiate SomfySynergy.Platform with:

const platform = new SomfySynergy.Platform(
  new SomfySynergy(...),
  {
    '<Target A>': [],
    '<Target B>': [],
    '<Target C>': ['<Target A>', '<Target B>'],
  }
);

Unlike with SomfySynergy, sending the same command to multiple targets that are part of the same composite target will lead to de-duplication:

platform.target('<Target A>').up();
platform.target('<Target B>').up();
// Equivalent to...
platform.target('<Target C>').up();

This is useful for implementing more synchronized control of targets, whereas Somfy myLink typically incurs a short delay in between each method.

License

node-somfy-synergy is MIT licensed.

node-somfy-synergy's People

Contributors

dependabot[bot] avatar dgreif avatar wisq avatar yungsters avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

node-somfy-synergy's Issues

Auth problems

When I use the system id in the auth parameter, it says it's invalid.

Any ideas? I am on firmware version 5.17

Synergy API Documentation

Hello! Do you know if there's public documentation available for the Somfy Synergy API? I can't seem to find anything on somfysystems.com.

I'm interested in knowing whether you can get information from the MyLink as opposed to sending it passive commands.

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.