Code Monkey home page Code Monkey logo

Comments (4)

skydiver avatar skydiver commented on May 29, 2024

Hey @rtomasik

I don't have a rf bridge device.

Hope someone else can answer that question.

from ewelink-api.

foulek57 avatar foulek57 commented on May 29, 2024

Hi all,

Here my code :

var express = require('express'); 
var hostname = 'localhost'; 
var portServer = 6005;
var app = express(); 
const ewelink = require('ewelink-api');
var request = require('request');

 const socket = await connection.openWebSocket
      (
        async data => 
        {
 app.get('/sync', function(req, res) 
          {
            ( async () => 
                {
                  var device_id = DEVICEID;
                  var apikey = APIKEY;
                  var channel = RFCHL;

                    const timeStamp = new Date() / 1000;
                    const sequence = Math.floor(timeStamp * 1000);
                    var payload = {};
                    payload.action = 'update';
                    payload.userAgent = 'app';
                    payload.apikey = '' + apikey;
                    payload.deviceid = '' + device_id;
                    payload.sequence = '' + sequence;
                  payload.params = {};
                  payload.params.cmd = 'transmit';
                  payload.params.rfChl = channel;
                    var string = JSON.stringify(payload);
                    socket.send(string);
                }
 )();
          });   
)();

var server = app.listen(portServer, hostname, function()
    {
      var date = new Date();
      console.log("Serveur correctement lancé sur http://"+ hostname +":"+ portServer + " Le " + date); 
    });

I send trought the socket the payload.
I also run a server to send http request

@skydiver any way to add this to your script ?

from ewelink-api.

rtomasik avatar rtomasik commented on May 29, 2024

@foulek57 thank you, i will test it.

@skydiver How to use LAN mode? Everywhere there are examples with logging in through ewelink account.

from ewelink-api.

sickao3 avatar sickao3 commented on May 29, 2024

@rtomasik I have a pull request where I solved the RF Bridge connection

https://github.com/sickao3/ewelink-api

from ewelink-api.

Related Issues (20)

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.