Giter Club home page Giter Club logo

ewelink-mqtt's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ewelink-mqtt's Issues

Sonoff status after command execute

I have Sonoff TH16 one of first versions and Basic R3. I got success with switch devices to ON and OFF over eWeLink-mqtt. And now I want to receive new switch status after command execute.

When I push On-Off button in Ewelink mobile app, I get:

[2023-01-08 15:33:02,923] INFO publishing item: ewelink/ewelink_status/1000xxxx/json: {"action": "update", "deviceid": "1000xxxxxx", "apikey": "xxxx", "userAgent": "app", "sequence": "1673181180165", "params": {"switch": "on"}}
[2023-01-08 15:33:02,923]DEBUG Received data {'action': 'update', 'deviceid': '1000xxxx', 'apikey': 'xxxx', 'userAgent': 'app', 'sequence': '1673181180165', 'params': {'switch': 'on'}}
[2023-01-08 15:33:02,924] INFO publishing item: ewelink/ewelink_status/1000xxxx/json: {'action': 'update', 'deviceid': '1000xxxx', 'apikey': 'xxxx', 'userAgent': 'app', 'sequence': '1673181180165', 'params': {'switch': 'on'}}
----> [2023-01-08 15:33:02,924]DEBUG Action Update: Publishing: {'switch': 'on'}
----> [2023-01-08 15:33:02,925] INFO publishing item: ewelink/ewelink_status/1000xxxx/switch: on
[2023-01-08 15:33:02,925] INFO publishing item: ewelink/ewelink_status/1000xxxx/last_update: Sun Jan 8 15:33:02 2023
[2023-01-08 15:33:02,926] INFO publishing item: ewelink/ewelink_status/1000xxxx/status: OK

When I send "on" or "off" command over MQTT

mosquitto_pub -r -u "homeuser" -P "xxxx" -h 127.0.0.1 -p 1883 -t "/ewelink_command/1000xxxx/switch" -m off

i get something like this:

[2023-01-08 15:38:43,110] INFO publishing item: ewelink/ewelink_status/1000xxxx/json: {"error": 0, "deviceid": "1000xxxx", "apikey": "xxxx", "sequence": "1673181522000", "uid": "xxxxxx"}
[2023-01-08 15:38:43,112]DEBUG command completed successfully
[2023-01-08 15:38:43,113] INFO publishing item: ewelink/ewelink_status/1000xxxx/status: OK
[2023-01-08 15:38:43,114]DEBUG Received data {'error': 0, 'deviceid': '1000xxxx', 'apikey': 'xxxx', 'sequence': '1673181522000', 'uid': 'xxxxxx'}
[2023-01-08 15:38:43,115] INFO publishing item: ewelink/ewelink_status/1000xxxx/json: {'error': 0, 'deviceid': '1000xxxx', 'apikey': 'xxxx', 'sequence': '1673181522000', 'uid': 'xxxxxx'}

In both cases commands executes successfully, but in the second case I don't get new switch status.

KeyError: 'familyList'

suddenly after more than a year of stable work

{'error': 407, 'msg': 'the path of request is not allowed with appid:4s1FXKC9FaGfoqXhmXSJneb3qcm1gOak', 'data': {}}

[2024-03-29 10:09:15,328]ERROR 'familyList'
Traceback (most recent call last):
File "/root/eWeLink-mqtt/./ewelink.py", line 297, in start_connection
homes = await self.get_homes()
File "/root/eWeLink-mqtt/custom_components/sonoff/core/ewelink/cloud.py", line 180, in get_homes
return {i["id"]: i["name"] for i in resp["data"]["familyList"]}
KeyError: 'familyList'

[D Main.EwelinkClient ] WS connection closed while sending json string

Hello,
i want change the bright of a B2 Bulb.
When i send
mosquitto_pub -t "/ewelink_command/1001088fc6/send_json" -m '{white:{br:100, ct:0}}'
the Websocket disconnected.

[D Main.EwelinkClient ] CLIENT: message received topic: /ewelink_command/1001088fc6/send_json
[I Main.EwelinkClient ] CLIENT: Received Command: send_json, device: 1001088fc6, Setting: {white:{br:100, ct:0}}
[D Main.Default ] deviceid: 1001088fc6, got command from queue: send_json, {white:{br:100, ct:0}}
[I Main.Default ] Default CLIENT: Received Command: send_json, device: 1001088fc6, Setting: {white:{br:100, ct:0}}
[D Main.Default ] send_json: for device 1001088fc6
[D Main.EwelinkClient ] sending: {
"action": "update",
"apikey": "0ea2ca0f-6b45-43ff-819a-710439769f54",
"deviceid": "1001088fc6",
"from": "app",
"params": "{white:{br:100, ct:0}}",
"sequence": "1619356129714",
"ts": 1619356129,
"userAgent": "app"
}
[D Main.EwelinkClient ] Sending command: {"action": "update", "userAgent": "app", "from": "app", "params": "{white:{br:100, ct:0}}", "apikey": "0ea2ca0f-6b45-43ff-819a-710439769f54", "deviceid": "1001088fc6", "ts": 1619356129, "sequence": "1619356129714"}
[D Main.EwelinkClient ] WS connection closed
[D Main.EwelinkClient ] Disconnecting
[D Main.Default ] deviceid: 10008ae241, process queue exited: task completed
[D Main.Default ] deviceid: 100097c066, process queue exited: task completed
[D Main.Default ] deviceid: 10009345e5, process queue exited: task completed
[D Main.Default ] deviceid: 1000920eae, process queue exited: task completed
[D Main.Default ] deviceid: 1000644d1f, process queue exited: task completed
[D Main.Default ] deviceid: 10003baa31, process queue exited: task completed
[D Main.Default ] deviceid: 100103f737, process queue exited: task completed
[D Main.Default ] deviceid: 10003baafc, process queue exited: task completed
[D Main.Default ] deviceid: 1001088fc6, process queue exited: task completed
[D Main.Default ] deviceid: 10011fcc31, process queue exited: task completed
[D Main.EwelinkClient ] exited keepalive loop
[I Main.EwelinkClient ] published: EWE-MQclient/status: Disconnected
[D Main.EwelinkClient ] Exited Receive Loop
[W Main ] Client Disconnected

The Json Output from ewelink is:
{
"__v": 0,
"_id": "608042abf4b0e20008d548c7",
"apikey": "0ea2ca0f-6b45-43ff-819a-710439769f54",
"brandLogoUrl": "https://eu-ota.coolkit.cc/logo/q62PevoglDNmwUJ9oPE7kRrpt1nL1CoA.png",
"brandName": "SONOFF",
"createdAt": "2021-04-21T15:20:11.588Z",
"devConfig": {},
"devGroups": [],
"deviceUrl": "",
"deviceid": "1001088fc6",
"devicekey": "54af3297-3bcc-4af6-9f69-4c049a6af309",
"extra": {
"id": "5f97e54a875e410cccbd4df1",
"extra": {
"apmac": "d0:27:02:11:1c:dd",
"brandId": "5c4c1aee3a7d24c7100be054",
"description": "20201027008",
"mac": "d0:27:02:11:1c:dc",
"manufacturer": "\u6df1\u5733\u677e\u8bfa\u6280\u672f\u6709\u9650\u516c\u53f8",
"model": "WTW-SNL-02",
"modelInfo": "5e7a146548af4f7140874c8e",
"staMac": "D0:27:02:11:1C:DC",
"ui": "\u53cc\u8272\u51b7\u6696\u706f
\u652f\u6301\u968f\u8c03\u53ca\u573a\u666f",
"uiid": 103
}
},
"family": {
"id": "5ea82fbd3afd5d0007e0991e",
"index": -7
},
"group": "",
"groups": [],
"ip": "95.91.104.154",
"location": "",
"name": "B2 Lampe",
"offlineTime": "2021-04-24T12:16:33.528Z",
"online": true,
"onlineTime": "2021-04-25T01:01:51.461Z",
"params": {
"OTA": "success",
"bindInfos": {
"alexa": [
"0ea3ca0f-6b45-42ff-819a-710439769f54_26ca1996a20e8bd63617ab272d4eeede1d2d8e32"
],
"gaction": [
"0ea2ca0d-6b45-42ff-819a-710439769f54_ewelink-google-home-v1"
]
},
"bright": {
"br": 100,
"ct": 255
},
"computer": {
"br": 20,
"ct": 255
},
"fwVersion": "1.3.5",
"ltype": "white",
"nightLight": {
"br": 5,
"ct": 0
},
"read": {
"br": 100,
"ct": 255
},
"selfApikey": "",
"sequence": "123456789",
"staMac": "D0:27:02:11:1C:DC",
"switch": "on",
"timers": [],
"version": 7,
"white": {
"br": 39,
"ct": 0
}
},
"productModel": "B02",
"relational": [],
"settings": {
"alarmNotify": 1,
"appDoorbellNotify": 1,
"opsHistory": 1,
"opsNotify": 0,
"wxAlarmNotify": 0,
"wxDoorbellNotify": 0,
"wxOpsNotify": 0
},
"shareUsersInfo": [],
"sharedTo": [],
"showBrand": true,
"type": "10",
"uiid": 103
},

Maybe i do something wrong. Im glad for a Hint.

Cannot start (custom_components?)

I've made a fresh clone of the repo than I've started the ewelink.py, but I'received the following error message:
Traceback (most recent call last):
File "ewelink.py", line 189, in
from custom_components.sonoff.core.ewelink.init import XRegistry, SIGNAL_ADD_ENTITIES
File "[...]/eWeLink-mqtt/custom_components/sonoff/init.py", line 28, in
from .core import devices as core_devices
File "[...]/eWeLink-mqtt/custom_components/sonoff/core/devices.py", line 20, in
from .ewelink import XDevice
File "[...]/eWeLink-mqtt/custom_components/sonoff/core/ewelink/init.py", line 7, in
from .base import SIGNAL_CONNECTED, SIGNAL_UPDATE, XDevice, XRegistryBase
File "[...]/eWeLink-mqtt/custom_components/sonoff/core/ewelink/base.py", line 35, in
class XRegistryBase:
File "[...]/eWeLink-mqtt/custom_components/sonoff/core/ewelink/base.py", line 36, in XRegistryBase
dispatcher: dict[str, list[Callable]] = None
TypeError: 'type' object is not subscriptable

Python 3.8.2, OSX

Please, help me!

Lan Mode connection

Hi Nick,
I just test it over LAN mode, the device (4chpro) is reachable via app and can be toggled. However the eWeLink-mqtt does not seems to work although seems that is connected. I see no reaction after submitting mosquitto_pub -t or changing the on off via app.

`
[2023-12-22 14:42:05,568] INFO Starting WS receive - waiting for messages
[2023-12-22 14:42:10,588]DEBUG Waiting...

`

Regards

[D Main.EwelinkClient ] received response status: 200

Hello, i get an error after run the App

[E Main ] Error: 'info'
Traceback (most recent call last):
File "./ewelink_server.py", line 250, in main
loop.run_until_complete(client.login())
File "/usr/lib/python3.6/asyncio/base_events.py", line 484, in run_until_complete
return future.result()
File "/root/PROJECT/new1/eWeLink-mqtt/ewelink_client.py", line 356, in login
self.logger.error('login error: %d, :%s' %(json_response['error'], json_response['info']))
KeyError: 'info'
[D Main ] Program Exited

I would glad for a hint.

Set receive interval

Hi,

thank you for your programming. Is it possible to set a receiving interval so that the software ask for new data each 10 seconds for example?
I've already tried the poll function, but it doesn't work. To get new data I always have to restart the service.

The device is a PowSwitch with the model PSF-X67
Thanks in advance for your help.

KeyError: 'familyList'

Hi there,
I get the following error while running the script,my device is a 4CHPROR3. I have py3.12.0 running on Raspberry 4.

I started the server as follow
pi@rasp:~/eWeLink-mqtt $ ./ewelink.py **** **** -b 192.111.111.17 -d 1001f96h99
The following error appears.

[2023-12-16 21:25:36,253] INFO MQTT library v1.0.2
[2023-12-16 21:25:36,254] INFO Connecting to MQTT broker: 192.
[2023-12-16 21:25:36,264] INFO MQTT broker connected
[2023-12-16 21:25:36,265] INFO Connecting, login: ***, password: *****, appid(v2):
[2023-12-16 21:25:36,266] INFO subscribing to: /ewelink_command/#
[2023-12-16 21:25:38,753]ERROR 'familyList'
Traceback (most recent call last):
File "/home/pi/eWeLink-mqtt/./ewelink.py", line 297, in start_connection
homes = await self.get_homes()
^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi/eWeLink-mqtt/custom_components/sonoff/core/ewelink/cloud.py", line 179, in get_homes
return {i["id"]: i["name"] for i in resp["data"]["familyList"]}
~~~~~~~~~~~~^^^^^^^^^^^^^^
KeyError: 'familyList'

Any idea what how can i fix it?
Thanks & Regards

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.