GithubHelp home page GithubHelp logo

Online Offline state ? about ewelink-api HOT 4 OPEN

skydiver avatar skydiver commented on June 16, 2024
Online Offline state ?

from ewelink-api.

Comments (4)

ttz642 avatar ttz642 commented on June 16, 2024 1

Is that for local connection or via the server?

For local send a ping, for via the cloud read the status of the device.

from ewelink-api.

ttz642 avatar ttz642 commented on June 16, 2024

You can scan your local network:

$ avahi-browse -d local _ewelink._tcp --resolve -tp | grep -P '^\+'
+;wlp2s0;IPv4;eWeLink_1000XXXXXX;_ewelink._tcp;local
+;wlp2s0;IPv4;eWeLink_1000XXXXXX;_ewelink._tcp;local
+;wlp2s0;IPv4;eWeLink_1000XXXXXX;_ewelink._tcp;local

wait a few seconds for every device to reply:

$ avahi-browse -d local _ewelink._tcp --resolve -tp | grep -P '^\+'
+;wlp2s0;IPv4;eWeLink_1000XXXXXX;_ewelink._tcp;local
+;wlp2s0;IPv4;eWeLink_1000XXXXXX;_ewelink._tcp;local
+;wlp2s0;IPv4;eWeLink_1000XXXXXX;_ewelink._tcp;local
+;wlp2s0;IPv4;eWeLink_1000XXXXXX;_ewelink._tcp;local
+;wlp2s0;IPv4;eWeLink_1000XXXXXX;_ewelink._tcp;local
+;wlp2s0;IPv4;eWeLink_1000XXXXXX;_ewelink._tcp;local
+;wlp2s0;IPv4;eWeLink_1000XXXXXX;_ewelink._tcp;local
+;wlp2s0;IPv4;eWeLink_1000XXXXXX;_ewelink._tcp;local

If you need the IP address of each device:

$ avahi-browse -d local _ewelink._tcp --resolve -tp | pcre2grep --om-separator='|'  -o1 -o2 -i  'local;eWeLink_(1000[0-9a-f]{6}).local;(192.168.1\..+);8081;'
1000XXXXXX|192.168.1.202
1000XXXXXX|192.168.1.220
1000XXXXXX|192.168.1.227
1000XXXXXX|192.168.1.237
1000XXXXXX|192.168.1.226
1000XXXXXX|192.168.1.233
1000XXXXXX|192.168.1.249
1000XXXXXX|192.168.1.238

from ewelink-api.

foulek57 avatar foulek57 commented on June 16, 2024

Hi,
It is for could connection, I want to check if the device a online, but from the socket directly (with socket.send())
Without an await, the getDevice do not work with the socket.

Want to do in this

`
const socket = await connection.openWebSocket(async data => {
// data is the message from eWeLink
console.log(data)

socket.send(payload);
});
`

But I do know what I need to send as payload

from ewelink-api.

ttz642 avatar ttz642 commented on June 16, 2024

Hi,
It is for could connection, I want to check if the device a online, but from the socket directly (with socket.send())
Without an await, the getDevice do not work with the socket.

Want to do in this

`
const socket = await connection.openWebSocket(async data => {
// data is the message from eWeLink
console.log(data)

socket.send(payload);
});
`

This opens a web socket to the eweLink cloud for listening for events, it does not connect directly to the device and so success only confirms you've connected to the cloud.

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.