Giter Club home page Giter Club logo

ewpe-smart-mqtt's People

Contributors

dependabot[bot] avatar grunci avatar stas-demydiuk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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

ewpe-smart-mqtt's Issues

Rpi 4 docker fatal error

Hi.

I have rpi 4 with openmediavault (Debian Buster) and portainer installed, I tried to run ewpe-smart-mqtt from docker but it won't. In the log I see:

Fatal error in , line 0

unreachable code

#FailureMessage Object: 0xbeb385ac#22

The container details are:

Image demydiuk/ewpe-smart-mqtt:latest@sha256:e092d90ea677205de80295a14a706dbcb12260b6259c936725747a419d45ba95
CMD npm start
ENTRYPOINT docker-entrypoint.sh
ENV DEVICE_POLL_INTERVAL 5000 MQTT_BASE_TOPIC ewpe-smart MQTT_SERVER mqtt://127.0.0.1 NETWORK 192.168.1.255 NODE_VERSION 16.8.0 PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin YARN_VERSION 1.22.5
DEVICE_POLL_INTERVAL 5000
MQTT_BASE_TOPIC ewpe-smart
MQTT_SERVER mqtt://127.0.0.1
NETWORK 192.168.1.255
NODE_VERSION 16.8.0
PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
YARN_VERSION 1.22.5
Labels org.opencontainers.image.created 2021-09-04T11:11:09.308Z org.opencontainers.image.description MQTT bridge for EWPE Smart powered devices org.opencontainers.image.licenses MIT org.opencontainers.image.revision 32d6b52 org.opencontainers.image.source https://github.com/stas-demydiuk/ewpe-smart-mqtt org.opencontainers.image.title ewpe-smart-mqtt org.opencontainers.image.url https://github.com/stas-demydiuk/ewpe-smart-mqtt org.opencontainers.image.version master
org.opencontainers.image.created 2021-09-04T11:11:09.308Z
org.opencontainers.image.description MQTT bridge for EWPE Smart powered devices
org.opencontainers.image.licenses MIT
org.opencontainers.image.revision 32d6b52
org.opencontainers.image.source https://github.com/stas-demydiuk/ewpe-smart-mqtt
org.opencontainers.image.title ewpe-smart-mqtt
org.opencontainers.image.url https://github.com/stas-demydiuk/ewpe-smart-mqtt
org.opencontainers.image.version master

What Is the problem?

Thanks

Running on nodejs 10+

This module does not work on newer versions of nodejs. On my Raspberry PI system I installed the oldest supported nodejs (10.x) and then I get this error:

2020-08-09 21:00:52.052 (Airco) MQTT message: ewpe-smart/f4911ed2d0b2/status {'Pow': 1, 'Mod': 1, 'TemUn': 0, 'SetTem': 26, 'TemRec': 0, 'WdSpd': 0, 'Air': 0, 'Blo': 0, 'Health': 1, 'SwhSlp': 0, 'Lig': 1, 'SwingLfRig': 3, 'SwUpDn': 11, 'Quiet': 0, 'Tur': 0, 'SvSt': 0, 'TemSen': -40}
2020-08-09 21:00:57.762 (Airco) ewpe-smart/f4911ed2d0b2
2020-08-09 21:00:57.763 (Airco) {"Pow": 1, "Mod": 1, "TemUn": 0, "SetTem": 26, "TemRec": 0, "WdSpd": 0, "Air": 0, "Blo": 0, "Health": 1, "SwhSlp": 0, "Lig": 1, "SwingLfRig": 3, "SwUpDn": 11, "Quiet": 0, "Tur": 0, "SvSt": 0, "TemSen": -40}
2020-08-09 21:00:57.763 Error: (Airco) 'onMessage' failed 'AttributeError':''NoneType' object has no attribute 'nValue''.
2020-08-09 21:00:57.763 Error: (Airco) ----> Line 138 in '/home/pi/domoticz/plugins/ewpe-smart-mqtt/plugin.py', function onMessage
2020-08-09 21:00:57.763 Error: (Airco) ----> Line 106 in '/home/pi/domoticz/plugins/ewpe-smart-mqtt/plugin.py', function onMessage
2020-08-09 21:00:57.763 Error: (Airco) ----> Line 168 in '/home/pi/domoticz/plugins/ewpe-smart-mqtt/mqtt.py', function onMessage
2020-08-09 21:00:57.763 Error: (Airco) ----> Line 84 in '/home/pi/domoticz/plugins/ewpe-smart-mqtt/plugin.py', function onMQTTPublish
2020-08-09 21:00:57.763 Error: (Airco) ----> Line 179 in '/home/pi/domoticz/plugins/ewpe-smart-mqtt/device.py', function handle_message
2020-08-09 21:00:57.763 Error: (Airco) ----> Line 132 in '/home/pi/domoticz/plugins/ewpe-smart-mqtt/device.py', function _update_state
2020-08-09 21:00:57.763 Error: (Airco) ----> Line 120 in '/home/pi/domoticz/plugins/ewpe-smart-mqtt/device.py', function _update_device
2020-08-09 21:00:57.814 (Airco) MQTT message: ewpe-smart/f4911ed2d0b2/status {'Pow': 1, 'Mod': 1, 'TemUn': 0, 'SetTem': 26, 'TemRec': 0, 'WdSpd': 0, 'Air': 0, 'Blo': 0, 'Health': 1, 'SwhSlp': 0, 'Lig': 1, 'SwingLfRig': 3, 'SwUpDn': 11, 'Quiet': 0, 'Tur': 0, 'SvSt': 0, 'TemSen': -40}
2020-08-09 21:00:57.814 (Airco) ewpe-smart/f4911ed2d0b2
2020-08-09 21:00:57.815 (Airco) {"Pow": 1, "Mod": 1, "TemUn": 0, "SetTem": 26, "TemRec": 0, "WdSpd": 0, "Air": 0, "Blo": 0, "Health": 1, "SwhSlp": 0, "Lig": 1, "SwingLfRig": 3, "SwUpDn": 11, "Quiet": 0, "Tur": 0, "SvSt": 0, "TemSen": -40}
2020-08-09 21:00:57.815 Error: (Airco) 'onMessage' failed 'AttributeError':''NoneType' object has no attribute 'nValue''.
2020-08-09 21:00:57.815 Error: (Airco) ----> Line 138 in '/home/pi/domoticz/plugins/ewpe-smart-mqtt/plugin.py', function onMessage
2020-08-09 21:00:57.815 Error: (Airco) ----> Line 106 in '/home/pi/domoticz/plugins/ewpe-smart-mqtt/plugin.py', function onMessage
2020-08-09 21:00:57.815 Error: (Airco) ----> Line 168 in '/home/pi/domoticz/plugins/ewpe-smart-mqtt/mqtt.py', function onMessage
2020-08-09 21:00:57.815 Error: (Airco) ----> Line 84 in '/home/pi/domoticz/plugins/ewpe-smart-mqtt/plugin.py', function onMQTTPublish
2020-08-09 21:00:57.815 Error: (Airco) ----> Line 179 in '/home/pi/domoticz/plugins/ewpe-smart-mqtt/device.py', function handle_message
2020-08-09 21:00:57.815 Error: (Airco) ----> Line 132 in '/home/pi/domoticz/plugins/ewpe-smart-mqtt/device.py', function _update_state
2020-08-09 21:00:57.815 Error: (Airco) ----> Line 120 in '/home/pi/domoticz/plugins/ewpe-smart-mqtt/device.py', function _update_device

The bridge does not find any devices

This is all I am getting after running the bridge

2019-02-17T16:47:24.672Z [info]: "Server is listening on 0.0.0.0:56912"

Not sure how to debug what the problem is. Any advice?

Issue with binding

After npm start, it's stops at binding. I did look at the older issues and saw the one about the binding, however, it looks like this is a bit different. I use the GREE+ app to control the (Tosot) airco from my Android phone.

After setting the loglevel to debug, I learned the mac address does not seem to bee present;

2021-08-01T18:09:00.604Z [debug]: Sending request to 192.168.1.73:7000: {mac:,t:bind,uid:0}

Npm Start failing with BAD DECRYPT error

I am running ewpe-smart-mqtt on Raspbian Stretch 4.19.66. I am using node v12.10.0 all other OS components were upgraded. On npm start i get (after detecting my Hunter/Cooper airco's) a decryption error:
npm start

[email protected] start /home/pi/nodejs/ewpe-smart-mqtt
node index.js

2019-10-06T21:45:36.232Z [info]: "Server is listening on 0.0.0.0:47709"
2019-10-06T21:45:36.270Z [info]: "New device found: 1e775dd7 (f4911e775dd7), binding..."
2019-10-06T21:45:36.292Z [info]: "New device bound: 1e775dd7 (192.168.178.48:7000)"
2019-10-06T21:45:36.295Z [info]: "MQTT message received: ewpe-smart/f4911e775dd7 {"cid":"f4911e775dd7","bc":"000000000000000000000000000000","brand":"gree","catalog":"gree","mac":"f4911e775dd7","mid":"10001","model":"gree","name":"1e775dd7","series":"gree","vender":"1","ver":"V1.2.1","lock":0,"address":"192.168.178.48","port":7000,"key":"7Ab0De3Gh6Jk9Mn2"}"
2019-10-06T21:45:36.327Z [info]: "New device found: 1e775d28 (f4911e775d28), binding..."
2019-10-06T21:45:36.341Z [info]: "New device found: 1e775d28 (f4911e775d28), binding..."
2019-10-06T21:45:36.364Z [info]: "New device bound: 1e775d28 (192.168.178.47:7000)"
2019-10-06T21:45:36.365Z [info]: "New device bound: 1e775d28 (192.168.178.47:7000)"
2019-10-06T21:45:36.367Z [info]: "MQTT message received: ewpe-smart/f4911e775d28 {"cid":"f4911e775d28","bc":"000000000000000000000000000000","brand":"gree","catalog":"gree","mac":"f4911e775d28","mid":"10001","model":"gree","name":"1e775d28","series":"gree","vender":"1","ver":"V1.2.1","lock":0,"address":"192.168.178.47","port":7000,"key":"7Ef0Hi3Kl6No9Qr2"}"
2019-10-06T21:45:36.368Z [info]: "MQTT message received: ewpe-smart/f4911e775d28 {"cid":"f4911e775d28","bc":"000000000000000000000000000000","brand":"gree","catalog":"gree","mac":"f4911e775d28","mid":"10001","model":"gree","name":"1e775d28","series":"gree","vender":"1","ver":"V1.2.1","lock":0,"address":"192.168.178.47","port":7000,"key":"7Ef0Hi3Kl6No9Qr2"}"
internal/crypto/cipher.js:177
const ret = this[kHandle].final();
^

Error: error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt
at Decipheriv.final (internal/crypto/cipher.js:177:29)
at decrypt (/home/pi/nodejs/ewpe-smart-mqtt/app/encryptor.js:15:48)
at Connection.handleResponse (/home/pi/nodejs/ewpe-smart-mqtt/app/connection.js:106:26)
at Socket.emit (events.js:209:13)
at UDP.onMessage [as onmessage] (dgram.js:853:8) {
library: 'digital envelope routines',
function: 'EVP_DecryptFinal_ex',
reason: 'bad decrypt',
code: 'ERR_OSSL_EVP_BAD_DECRYPT'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: node index.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.

I also tried npm install eccrypto but that did not help.

Missing [email protected]

On Raspberry PI 3B+ with raspbian buster (after apt get update).
Manually install node.js:

curl -sL https://deb.nodesource.com/setup_13.x | bash -
apt-get install -y nodejs

After calling in repository directory: npm install i get:

npm WARN [email protected] No repository field

Unable to get devices list

I have eclipse-mosquitto and ewpe-smart-mqtt setup in their own Docker containers on my Synology NAS.

Using PuTTY and 'docker exec -it <container id> sh' I am able to use the mosquitto_pub and mosquitto_sub commands. Any time I run either of the commands on 'ewpe-smart/devices/list', it doesn't return anything.

npm ERR! via docker

Hi,

I use docker for start ewpe-smart-mqtt and all working fine, but after each run in log have "npm errors":

npm ERR! path /opt/ewpe-smart-mqtt
npm ERR! command failed
npm ERR! signal SIGTERM
npm ERR! command sh -c node index.js

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-11-14T08_35_41_582Z-debug-0.log

Additional inforamtion:

/opt/ewpe-smart-mqtt # npm --version
9.1.1

/opt/ewpe-smart-mqtt # node --version
v18.4.0

/opt/ewpe-smart-mqtt # cat /root/.npm/_logs/2022-11-14T08_35_41_582Z-debug-0.log
0 verbose cli /usr/local/bin/node /usr/local/bin/npm
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnode Completed in 3ms
4 timing config:load:defaults Completed in 7ms
5 timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 5ms
6 timing config:load:builtin Completed in 9ms
7 timing config:load:cli Completed in 6ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:/opt/ewpe-smart-mqtt/.npmrc Completed in 9ms
10 timing config:load:project Completed in 27ms
11 timing config:load:file:/root/.npmrc Completed in 0ms
12 timing config:load:user Completed in 2ms
13 timing config:load:file:/usr/local/etc/npmrc Completed in 0ms
14 timing config:load:global Completed in 1ms
15 timing config:load:setEnvs Completed in 4ms
16 timing config:load Completed in 59ms
17 timing npm:load:configload Completed in 60ms
18 timing npm:load:mkdirpcache Completed in 1ms
19 timing npm:load:mkdirplogs Completed in 0ms
20 verbose title npm start
21 verbose argv "start"
22 timing npm:load:setTitle Completed in 5ms
23 timing config:load:flatten Completed in 13ms
24 timing npm:load:display Completed in 17ms
25 verbose logfile logs-max:10 dir:/root/.npm/_logs/2022-11-13T19_04_08_122Z-
26 verbose logfile /root/.npm/_logs/2022-11-13T19_04_08_122Z-debug-0.log
27 timing npm:load:logFile Completed in 18ms
28 timing npm:load:timers Completed in 0ms
29 timing npm:load:configScope Completed in 0ms
30 timing npm:load Completed in 108ms
31 silly logfile start cleaning logs, removing 1 files
32 timing config:load:flatten Completed in 1ms
33 silly logfile done cleaning log files
34 timing command:run-script Completed in 1343437ms
35 timing command:start Completed in 1343451ms
36 verbose stack Error: command failed
36 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:53:27)
36 verbose stack     at ChildProcess.emit (node:events:537:28)
36 verbose stack     at maybeClose (node:internal/child_process:1091:16)
36 verbose stack     at ChildProcess._handle.onexit (node:internal/child_process:302:5)
37 verbose pkgid [email protected]
38 verbose cwd /opt/ewpe-smart-mqtt
39 verbose Linux 5.10.103-v7l+
40 verbose node v18.4.0
41 verbose npm  v9.1.1
42 error path /opt/ewpe-smart-mqtt
43 error command failed
44 error signal SIGTERM
45 error command sh -c node index.js
46 verbose exit 1
47 timing npm Completed in 1343614ms
48 verbose code 1
49 error A complete log of this run can be found in:
49 error     /root/.npm/_logs/2022-11-13T19_04_08_122Z-debug-0.log

Please help with this issue.

Code failing when two Airco's are present

When a have only 1 airco (type Hunter Cooper) online the code works ok.
But when the second (I have two in my home) is also online, the code fails (i put some prints in to see the keys used):

pi@raspberrypi:~/nodejs/ewpe-smart-mqtt $ npm start

[email protected] start /home/pi/nodejs/ewpe-smart-mqtt
node index.js

2019-11-15T19:57:03.257Z [info]: "Server is listening on 0.0.0.0:48159"
decrypt key: a3K8Bx%2r8Y7#xDh
2019-11-15T19:57:03.313Z [info]: "New device found: 1e775dd7 (f4911e775dd7), binding..."
2019-11-15T19:57:03.315Z [info]: "Going to call encrypt with key: a3K8Bx%2r8Y7#xDh"
encrypt key: a3K8Bx%2r8Y7#xDh
decrypt key: a3K8Bx%2r8Y7#xDh
2019-11-15T19:57:03.348Z [info]: "New device found: 1e775d28 (f4911e775d28), binding..."
2019-11-15T19:57:03.349Z [info]: "Going to call encrypt with key: a3K8Bx%2r8Y7#xDh"
encrypt key: a3K8Bx%2r8Y7#xDh
decrypt key: a3K8Bx%2r8Y7#xDh
2019-11-15T19:57:03.353Z [info]: "New device found: 1e775d28 (f4911e775d28), binding..."
2019-11-15T19:57:03.354Z [info]: "Going to call encrypt with key: a3K8Bx%2r8Y7#xDh"
encrypt key: a3K8Bx%2r8Y7#xDh
2019-11-15T19:57:03.356Z [info]: "Going to call decrypt with key: a3K8Bx%2r8Y7#xDh"
decrypt key: a3K8Bx%2r8Y7#xDh
decrypt key: a3K8Bx%2r8Y7#xDh
2019-11-15T19:57:03.365Z [info]: "Going to call decrypt with key: a3K8Bx%2r8Y7#xDh"
decrypt key: a3K8Bx%2r8Y7#xDh
2019-11-15T19:57:03.367Z [info]: "key: 7Ab0De3Gh6Jk9Mn2 registered for deviceId: f4911e775dd7"
2019-11-15T19:57:03.369Z [info]: "New device bound: 1e775dd7 (192.168.178.48:7000)"
2019-11-15T19:57:03.374Z [info]: "MQTT message received: ewpe-smart/f4911e775dd7 {"cid":"f4911e775dd7","bc":"000000000000000000000000000000","brand":"gree","catalog":"gree","mac":"f4911e775dd7","mid":"10001","model":"gree","name":"1e775dd7","series":"gree","vender":"1","ver":"V1.2.1","lock":0,"address":"192.168.178.48","port":7000,"key":"7Ab0De3Gh6Jk9Mn2"}"
decrypt key: a3K8Bx%2r8Y7#xDh
2019-11-15T19:57:03.398Z [info]: "Going to call decrypt with key: a3K8Bx%2r8Y7#xDh"
decrypt key: a3K8Bx%2r8Y7#xDh
2019-11-15T19:57:03.400Z [info]: "Going to call decrypt with key: a3K8Bx%2r8Y7#xDh"
decrypt key: a3K8Bx%2r8Y7#xDh
2019-11-15T19:57:03.402Z [info]: "key: 7Ef0Hi3Kl6No9Qr2 registered for deviceId: f4911e775d28"
2019-11-15T19:57:03.403Z [info]: "New device bound: 1e775d28 (192.168.178.47:7000)"
2019-11-15T19:57:03.403Z [info]: "key: 7Ef0Hi3Kl6No9Qr2 registered for deviceId: f4911e775d28"
2019-11-15T19:57:03.404Z [info]: "New device bound: 1e775d28 (192.168.178.47:7000)"
2019-11-15T19:57:03.407Z [info]: "MQTT message received: ewpe-smart/f4911e775d28 {"cid":"f4911e775d28","bc":"000000000000000000000000000000","brand":"gree","catalog":"gree","mac":"f4911e775d28","mid":"10001","model":"gree","name":"1e775d28","series":"gree","vender":"1","ver":"V1.2.1","lock":0,"address":"192.168.178.47","port":7000,"key":"7Ef0Hi3Kl6No9Qr2"}"
decrypt key: 7Ef0Hi3Kl6No9Qr2

internal/crypto/cipher.js:183
const ret = this[kHandle].final();
^

Error: error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt
at Decipheriv.final (internal/crypto/cipher.js:183:29)
at decrypt (/home/pi/nodejs/ewpe-smart-mqtt/app/encryptor.js:17:48)
at Connection.handleResponse (/home/pi/nodejs/ewpe-smart-mqtt/app/connection.js:108:26)
at Socket.emit (events.js:210:5)
at UDP.onMessage [as onmessage] (dgram.js:853:8) {
library: 'digital envelope routines',
function: 'EVP_DecryptFinal_ex',
reason: 'bad decrypt',
code: 'ERR_OSSL_EVP_BAD_DECRYPT'

Could it be that the code tries to decrypt with the key of the other airco?

hi, can someone help me?

i'm trying to get this script running on raspberry with mqtt on synology..

i'm getting an error in the log:

2020-01-10T18:02:49.012Z [error]: "Can not decrypt message from f4911e198128 (192.168.1.51:7000) with key a3K8Bx%2r8Y7#xDh"
2020-01-10T18:02:49.065Z [info]: "MQTT message received: ewpe-smart/f4911e198128/status {"Pow":0,"Mod":4,"TemUn":0,"SetTem":19,"TemRec":0,"WdSpd":0,"Air":0,"Blo":0,"Health":0,"SwhSlp":0,"Lig":1,"SwingLfRig":0,"SwUpDn":1,"Quiet":0,"Tur":0,"SvSt":0}"

Also no new devices are added to domoticz :(
Hope someone can help me a bit!

Thanks!

MaxListenersExceededWarning after network reboots

I am running a modifier version with statusKeys modified for a dehumidifier. It is running as a service on the same machine as the MQTT Broker. I currently have a forced reboot on my router once a week. When this happens the node gets stuck and give the following errors:

Apr 22 04:01:09 raspberrypi node[20234]: (node:20234) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Socket]. Use emitter.setMaxListeners() to increase limit
Apr 22 04:01:09 raspberrypi node[20234]: (Use `node --trace-warnings ...` to show where the warning was created)

I have not been able to catch any warnings with --trace-warnings but will keep an eye out.
For now I have upped the maxListeners to 15.

Domoticz switches stop responding after system reboot

After system reboots and Docker container with "ewpe-smart-mqtt" stands automatically, the switches created in the Domoticz previously stops responding. The problem may be fixed by click UPDATE button on the "EwpeSmart Air Conditioners via MQTT" hardware item in the Domoticz (each time after system reboots).

JSON parse issue

My npm service crashes with this error when trying to use the /set function to control my ac.
SyntaxError: Unexpected token P in JSON at position 1
The error occurs at index.js file at line 72.

What i tried to do:
mosquitto_pub -h localhost -p 21883 -t ewpe-smart/MyAcCidHere/set -m {"Pow":1, "SetTem":24}

The port is changed from 1883, and everything else works just fine, just cant control the ac.

A little help would be greatly appreciated :)

Edit: I am currently on xenomes /fix branch which helped me to start the service without crashing.
@stas-demydiuk
@Xenomes

FIX: What ended up working for this was adding single parentheses around mosquitto message (Json payload) ie:
'{"Pow": 1}'

Bluetooth

Hello! Every time when app is opening it asks to turn on bluetooth! Pls fix it!!!
Screenshot_20221014-231118_Ewpe Smart

npm start problem

Hi,

I've got an issue:

2019-01-23T17:40:14.022Z [info]: "Server is listening on 0.0.0.0:34207"

2019-01-23T17:40:14.253Z [info]: "New device found: xxxxxx (xxxxxxxxxxxx), binding..."

 "Sending request to 192.168.1.105:7000: {\"mac\":\"xxxxxxxxxxxx\",\"t\":\"bind\",\"uid\":0}"
/home/(...)/ewpe-smart-mqtt/app/connection.js:74
this.socket.off('message', messageHandler);
                            ^

TypeError: this.socket.off is not a function
    at Socket.messageHandler (/home/(...)/ewpe-smart-mqtt/app/connection.js:74:29)
    at emitTwo (events.js:131:20)
    at Socket.emit (events.js:214:7)
    at UDP.onMessage [as onmessage] (dgram.js:659:8)

What could be the problem?

Running on raspbian. MQTT is mosquitto.
The AC is newest Gree Lomo Economic with ewpe control via Wi-Fi

bad decrypt

Hi Stanislav and all!

First of all - thanks for this great little tool. Allowed me to integrate the ac into my home automation (openhab) easily!

Sadly the tool stopped working for no obvious reason. Here's the console output (debug lvl):

> [email protected] start
> node index.js

2021-06-12T13:25:03.685Z [info]: Trying to connect to MQTT server mqtt://127.0.0.1 ...
2021-06-12T13:25:03.845Z [info]: Successfully connected to MQTT server
2021-06-12T13:25:03.884Z [info]: Socket server is listening on 0.0.0.0:41576
2021-06-12T13:25:03.885Z [info]: Scanning network 192.168.178.255 for available devices...
2021-06-12T13:25:03.993Z [debug]: handling response - decrypt msg={t:pack,i:1,uid:0,cid:f4911ec3237f,tcid:,pack:LP24Ek0OaYogxs3iQLjL4HUg+iGf2/n36lQtj/OTxG+Ma9lM2RqI/KytvJ32IsGSZXrOr+MakVzzXHbghPeyijnWMzaLQaaw1aFXlE9k71L0cMm8bsr/y4FkxumpRg1tKs/34xhBuMSxXfNfvEgS5yEpZpsQlqiaQjru60IoDlJzMQoS41XpnORSG7+GfavhnKYbt0iIDsdp8/ftXlA9HmXPWH2Ry6YJO+q1jue/ChO80gq9HxK8Loa8WXVjgZcP4Vf5MjKxa60Xt5J1oI+lsxUuXTHkgunLg76WWGy+euo=} / key=a3K8Bx%2r8Y7#xDh
2021-06-12T13:25:04.002Z [debug]: handling response - decrypt success for msg={t:pack,i:1,uid:0,cid:f4911ec3237f,tcid:,pack:LP24Ek0OaYogxs3iQLjL4HUg+iGf2/n36lQtj/OTxG+Ma9lM2RqI/KytvJ32IsGSZXrOr+MakVzzXHbghPeyijnWMzaLQaaw1aFXlE9k71L0cMm8bsr/y4FkxumpRg1tKs/34xhBuMSxXfNfvEgS5yEpZpsQlqiaQjru60IoDlJzMQoS41XpnORSG7+GfavhnKYbt0iIDsdp8/ftXlA9HmXPWH2Ry6YJO+q1jue/ChO80gq9HxK8Loa8WXVjgZcP4Vf5MjKxa60Xt5J1oI+lsxUuXTHkgunLg76WWGy+euo=} / key=a3K8Bx%2r8Y7#xDh
2021-06-12T13:25:04.003Z [info]: New device found: 1ec3237f (f4911ec3237f), binding...
2021-06-12T13:25:04.010Z [debug]: Sending request to 192.168.178.16:7000: {mac:f4911ec3237f,t:bind,uid:0}
2021-06-12T13:25:04.012Z [debug]: handling response - decrypt msg={t:pack,i:1,uid:0,cid:f4911ec3237f,tcid:,pack:LP24Ek0OaYogxs3iQLjL4HUg+iGf2/n36lQtj/OTxG+Ma9lM2RqI/KytvJ32IsGSZXrOr+MakVzzXHbghPeyijnWMzaLQaaw1aFXlE9k71L0cMm8bsr/y4FkxumpRg1tKs/34xhBuMSxXfNfvEgS5yEpZpsQlqiaQjru60IoDlJzMQoS41XpnORSG7+GfavhnKYbt0iIDsdp8/ftXlA9HmXPWH2Ry6YJO+q1jue/ChO80gq9HxK8Loa8WXVjgZcP4Vf5MjKxa60Xt5J1oI+lsxUuXTHkgunLg76WWGy+euo=} / key=a3K8Bx%2r8Y7#xDh
2021-06-12T13:25:04.014Z [debug]: handling response - decrypt success for msg={t:pack,i:1,uid:0,cid:f4911ec3237f,tcid:,pack:LP24Ek0OaYogxs3iQLjL4HUg+iGf2/n36lQtj/OTxG+Ma9lM2RqI/KytvJ32IsGSZXrOr+MakVzzXHbghPeyijnWMzaLQaaw1aFXlE9k71L0cMm8bsr/y4FkxumpRg1tKs/34xhBuMSxXfNfvEgS5yEpZpsQlqiaQjru60IoDlJzMQoS41XpnORSG7+GfavhnKYbt0iIDsdp8/ftXlA9HmXPWH2Ry6YJO+q1jue/ChO80gq9HxK8Loa8WXVjgZcP4Vf5MjKxa60Xt5J1oI+lsxUuXTHkgunLg76WWGy+euo=} / key=a3K8Bx%2r8Y7#xDh
2021-06-12T13:25:04.014Z [info]: New device found: 1ec3237f (f4911ec3237f), binding...
2021-06-12T13:25:04.016Z [debug]: Sending request to 192.168.178.16:7000: {mac:f4911ec3237f,t:bind,uid:0}
2021-06-12T13:25:04.017Z [debug]: Received message from f4911ec3237f (192.168.178.16:7000) {t:pack,i:1,uid:0,cid:f4911ec3237f,tcid:,pack:LP24Ek0OaYogxs3iQLjL4HUg+iGf2/n36lQtj/OTxG+Ma9lM2RqI/KytvJ32IsGSZXrOr+MakVzzXHbghPeyijnWMzaLQaaw1aFXlE9k71L0cMm8bsr/y4FkxumpRg1tKs/34xhBuMSxXfNfvEgS5yEpZpsQlqiaQjru60IoDlJzMQoS41XpnORSG7+GfavhnKYbt0iIDsdp8/ftXlA9HmXPWH2Ry6YJO+q1jue/ChO80gq9HxK8Loa8WXVjgZcP4Vf5MjKxa60Xt5J1oI+lsxUuXTHkgunLg76WWGy+euo=}
2021-06-12T13:25:04.044Z [debug]: handling response - decrypt msg={t:pack,i:1,uid:0,cid:f4911ec3237f,tcid:,pack:T2tGu9JTsZPLMhoPO/mBcpvquqEChgcA4q0sw9u28tAz69cDvnykALGq1M6jRfp4VNrLSHh05C9h9V783LuxkIzD1k6jjxiwE2rMrTg7Xnk=} / key=a3K8Bx%2r8Y7#xDh
2021-06-12T13:25:04.045Z [debug]: handling response - decrypt success for msg={t:pack,i:1,uid:0,cid:f4911ec3237f,tcid:,pack:T2tGu9JTsZPLMhoPO/mBcpvquqEChgcA4q0sw9u28tAz69cDvnykALGq1M6jRfp4VNrLSHh05C9h9V783LuxkIzD1k6jjxiwE2rMrTg7Xnk=} / key=a3K8Bx%2r8Y7#xDh
2021-06-12T13:25:04.046Z [debug]: Received message from f4911ec3237f (192.168.178.16:7000) {t:pack,i:1,uid:0,cid:f4911ec3237f,tcid:,pack:T2tGu9JTsZPLMhoPO/mBcpvquqEChgcA4q0sw9u28tAz69cDvnykALGq1M6jRfp4VNrLSHh05C9h9V783LuxkIzD1k6jjxiwE2rMrTg7Xnk=}
2021-06-12T13:25:04.048Z [debug]: Received message from f4911ec3237f (192.168.178.16:7000) {t:pack,i:1,uid:0,cid:f4911ec3237f,tcid:,pack:T2tGu9JTsZPLMhoPO/mBcpvquqEChgcA4q0sw9u28tAz69cDvnykALGq1M6jRfp4VNrLSHh05C9h9V783LuxkIzD1k6jjxiwE2rMrTg7Xnk=}
2021-06-12T13:25:04.052Z [info]: New device bound: 1ec3237f (192.168.178.16:7000)
2021-06-12T13:25:04.053Z [info]: New device bound: 1ec3237f (192.168.178.16:7000)
2021-06-12T13:25:04.058Z [info]: MQTT message received: ewpe-smart/f4911ec3237f {cid:f4911ec3237f,bc:000000000000000000000000000000,brand:gree,catalog:gree,mac:f4911ec3237f,mid:10001,model:gree,name:1ec3237f,series:gree,vender:1,ver:V1.2.1,lock:0,address:192.168.178.16,port:7000,key:l0No3Qr6Tu9Wx2Za}
2021-06-12T13:25:04.059Z [info]: MQTT message received: ewpe-smart/f4911ec3237f {cid:f4911ec3237f,bc:000000000000000000000000000000,brand:gree,catalog:gree,mac:f4911ec3237f,mid:10001,model:gree,name:1ec3237f,series:gree,vender:1,ver:V1.2.1,lock:0,address:192.168.178.16,port:7000,key:l0No3Qr6Tu9Wx2Za}
2021-06-12T13:25:04.134Z [debug]: handling response - decrypt msg={t:pack,i:1,uid:0,cid:f4911ec3237f,tcid:,pack:T2tGu9JTsZPLMhoPO/mBcpvquqEChgcA4q0sw9u28tAz69cDvnykALGq1M6jRfp4VNrLSHh05C9h9V783LuxkIzD1k6jjxiwE2rMrTg7Xnk=} / key=l0No3Qr6Tu9Wx2Za
internal/crypto/cipher.js:164
  const ret = this._handle.final();
                           ^

Error: error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt
    at Decipheriv.final (internal/crypto/cipher.js:164:28)
    at decrypt (/home/pi/ewpe-smart-mqtt/app/encryptor.js:16:48)
    at Connection.handleResponse (/home/pi/ewpe-smart-mqtt/app/connection.js:112:26)
    at Socket.emit (events.js:198:13)
    at UDP.onMessage [as onmessage] (dgram.js:628:8)

( i added a two debug msgs within connection.js.handleResponse() just before and after decrypt(...) )
as you can see decrypt works for all initial messages with the default key (a3K8Bx%2r8Y7#xDh) but not for messages with the exchanged key (l0No3Qr6Tu9Wx2Za). so why could the exchanged key be wrong suddenly? maybe a sw update of the ac?

not very likely but maybe a problem with a newer mosquitto? i have "mosquitto/buster,now 2.0.9-0mosquitto1~buster1 armhf"

"reinstalling" ewpe-smart-mqtt (fresh git clone) made no difference.

"npm install" also indicates the use of some older libs (no surprise):

pi@raspberrypi:~/ewpe-smart-mqtt $ npm install
added 101 packages, and audited 102 packages in 16s
5 vulnerabilities (4 moderate, 1 high)
To address issues that do not require attention, run:
  npm audit fix
To address all issues (including breaking changes), run:
  npm audit fix --force
Run `npm audit` for details.

auto fixing this warnings with "npm audit fix --force" as suggested also made no difference.

problem set command

Hello,

I must have missed a step because I receive the status of the air conditioner but I can't send any set.
I tried ewpe-smart/502cc654d3d7/set {"Pow": 1, "SetTem": 24}
I am under unraid, I have my bridge that communicates but only in one direction.
Is it possible to have a more detailed tutorial please?

2022-07-19T16:39:08.388Z [info]: MQTT message received: ewpe-smart/502cc654d3d7/status {Pow:0,Mod:1,TemUn:0,SetTem:24,TemRec:0,WdSpd:0,Air:0,Blo:0,Health:0,SwhSlp:0,Lig:1,SwingLfRig:0,SwUpDn:0,Quiet:0,Tur:0,SvSt:0,TemSen:-40}

Cipher error

i get a cipher error.
is there any way to give the encryption key in the properties
2022-05-18_11-46-34
?

Unable to publish to device

I am running Mosquitto MQTT and ewpe-smart-mqtt on rasberry pi, each part in it's own Docker container. To debug I am using MQTT.fx on windows.

If I subscribe to "ewpe-smart/{IP}/status" I can see regular status messages, but I am unable to make the "publish" functionality work. Since I do not understand how it should work I do not know how to test it. I publish "ewpe-smart/{IP}/get" on MQTT, I can see in MQTT logs that message was published succesfully, but I do not understand what I need to do to make ewpe-smart-mqtt read it and forward it to AC unit.

standard_init_linux.go:211

After starting the ewpe-smart-mqtt by npm start command it works properly. After setting up the hardware in Domoticz the particular mapped devices can be found in the Devices tab.

The problem comes when trying to install ewpe-smart-mqtt by Docker. After pasting the command to run it I'm getting the following response:

standard_init_linux.go:211: exec user process caused "exec format error" failed to resize tty, using default size

Obviously the particular Docker container is not set up.

Raspberri PI stuck after a little use

I ran: mosquitto_pub -h localhost -t ewpe-smart/deviceId/set -m "{\"Pow\": 1, \"SetTem\": 24}"
And really got the AC on!! Thank you!

But I think that's killing my memory? I run it on raspberri pi 3B and after a minute or so it stops responding.

thanks!

not binding...

I have a GREE+ AC unit working with ewpe android app, and I wanted to try out this code, but I'm not getting the "New device bound" message I see other on the forums that others are getting just after the "New Device found (....) binding...",
I tried to send commands but I get Device not found, here's my log:

2020-06-29T17:59:00.296Z [info]: Trying to connect to MQTT server mqtt://127.0.0.1 ...
2020-06-29T17:59:00.447Z [info]: Successfully connected to MQTT server
2020-06-29T17:59:00.481Z [info]: Socket server is listening on 0.0.0.0:46858
2020-06-29T17:59:00.764Z [info]: New device found: Parter (f4911ed59a49), binding...
2020-06-29T17:59:00.768Z [info]: New device found: Sypialnia (f4911ec262a3), binding...
2020-06-29T17:59:18.416Z [info]: MQTT message received: ewpe-smart/f4911ec262a3/set {Pow: 1, SetTem: 23}
(node:985) UnhandledPromiseRejectionWarning: Error: Device f4911ec262a3 not found

Any ideas what can cause this?
Thanks

Specifying multiple network addresses does not work

Hello,

Unfortunately, the specification of several IP addresses does not work for me.
I have tried the following:
NETWORK=192.168.3.10;192.168.3.9
NETWORK=192.168.3.10; 192.168.3.9

The system uses only the first IP. Does anyone have an idea?

pi@pi01:~ $ su -
Password:
-bash: 192.168.3.9: command not found
root@pi01:# cd ewpe-smart-mqtt/
root@pi01:
/ewpe-smart-mqtt# npm start

[email protected] start /root/ewpe-smart-mqtt
node index.js

2021-08-29T09:01:11.233Z [info]: Trying to connect to MQTT server mqtt://localhost ...
2021-08-29T09:01:11.677Z [info]: Successfully connected to MQTT server
2021-08-29T09:01:11.732Z [info]: Socket server is listening on 0.0.0.0:56331
2021-08-29T09:01:11.736Z [info]: Scanning network 192.168.3.10 for available devices...
2021-08-29T09:01:11.773Z [info]: New device found: 1ed***** (f4911ed4****), binding...
2021-08-29T09:01:11.806Z [info]: New device bound: 1ed***** (192.168.3.10:7000)
2021-08-29T09:01:11.815Z [info]: MQTT message received: ewpe-smart/f4911ed***** {cid:f4911ed*****,bc:gree,brand:gree,catalog:gree,mac:f4911ed*****,mid:10002,model:gree,name:1ed*****,series:gree,vender:1,ver:V1.1.13,lock:0,address:192.168.3.10,port:7000,key:**********}
2021-08-29T09:01:41.843Z [info]: MQTT message received: ewpe-smart/f4911ed*****/status {Pow:0,Mod:1,TemUn:0,SetTem:25,TemRec:0,WdSpd:0,Air:0,Blo:1,Health:0,SwhSlp:0,Lig:1,SwingLfRig:0,SwUpDn:0,Quiet:0,Tur:0,SvSt:0,TemSen:-40}

Thank you,
pictop

Missing 'cid' in the mqtt data

Hi,

First i must say happy to see there is a mqtt bridge/plugin for ewpe devices!!

I have three devices, two are detect perfectly but one is missing the cid in the mqtt data.

[{"cid":"","bc":"gree","brand":"gree","catalog":"gree","mac":"502cc6b957df","mid":"10001","model":"gree","name":"","lock":0,"series":"gree","vender":"1","ver":"V3.0.0","address":"192.168.1.125","port":7000,"key":"delete"},{"cid":"502cc6a1b426","bc":"","brand":"gree","catalog":"gree","mac":"502cc6a1b426","mid":"10001","model":"gree","name":"c6a1b426","series":"gree","vender":"1","ver":"V1.2.1","lock":0,"address":"192.168.1.177","port":7000,"key":"delete"},{"cid":"502cc6a1bdb2","bc":"","brand":"gree","catalog":"gree","mac":"502cc6a1bdb2","mid":"10001","model":"gree","name":"c6a1bdb2","series":"gree","vender":"1","ver":"V1.2.1","lock":0,"address":"192.168.1.103","port":7000,"key":"delete"}]

As you can see the cid is empty, i think this is why in Domoticz the status is not updated. When using the controls the command are received by the unit. How can I fix this?

The product is a Cooper & Hunter VERITAS CH-S18FTXQ-NG

UnhandledPromiseRejectionWarning: Error: Device f4911edfdf6f not found

Hi there!
Today in the morning my AC wouldn't react to the flows I set up in Node-red, so started to look around what's happened.
I got this message running npm start:
UnhandledPromiseRejectionWarning: Error: Device f4911edfdf6f not found
at DeviceManager.setDeviceState (/home/pi/ewpe-smart-mqtt/app/device_manager.js:82:19)
at MqttClient. (/home/pi/ewpe-smart-mqtt/index.js:72:59)
at MqttClient.emit (events.js:315:20)
at MqttClient._handlePublish (/home/pi/ewpe-smart-mqtt/node_modules/mqtt/lib/client.js:1162:12)
at MqttClient._handlePacket (/home/pi/ewpe-smart-mqtt/node_modules/mqtt/lib/client.js:351:12)
at work (/home/pi/ewpe-smart-mqtt/node_modules/mqtt/lib/client.js:283:12)
at processTicksAndRejections (internal/process/task_queues.js:79:11)
(node:1335) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:1335) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
2020-08-01T08:20:26.130Z [info]: MQTT message received: ewpe-smart/devices []

Have no idea what happened, everything was fine yesterday at midnight (when I set up a flow to turn it off).
This morning, nothing works.

Restarted node-red, rewrited index.js for this module, rewrited scanning ip from .255 to the AC's ip, .28 .... nothing.
Can you help me please?

Thanks you

Issue with new ewpe ac devices

Hi,

Thanks for the great work on this program.
I'm trying to read out two ac units which have been installed today with ewpe wifi modules.
Unfortunately I get a cipher error:

> [email protected] start
> node index.js

2021-08-16T19:36:47.375Z [info]: Trying to connect to MQTT server mqtt://127.0.0.1 ...
2021-08-16T19:36:48.318Z [info]: Successfully connected to MQTT server
2021-08-16T19:36:48.483Z [info]: Socket server is listening on 0.0.0.0:36315
2021-08-16T19:36:48.489Z [info]: Scanning network 192.168.1.255 for available devices...
node:internal/crypto/cipher:193
  const ret = this[kHandle].final();
                            ^

Error: error:0606506D:digital envelope routines:EVP_DecryptFinal_ex:wrong final block length
    at Decipheriv.final (node:internal/crypto/cipher:193:29)
    at decrypt (/opt/ewpe-smart-mqtt/app/encryptor.js:15:48)
    at Connection.handleResponse (/opt/ewpe-smart-mqtt/app/connection.js:110:26)
    at Socket.emit (node:events:394:28)
    at UDP.onMessage [as onmessage] (node:dgram:931:8) {
  library: 'digital envelope routines',
  function: 'EVP_DecryptFinal_ex',
  reason: 'wrong final block length',
  code: 'ERR_OSSL_EVP_WRONG_FINAL_BLOCK_LENGTH'
}
npm notice
npm notice New minor version of npm available! 7.15.1 -> 7.20.6
npm notice Changelog: https://github.com/npm/cli/releases/tag/v7.20.6
npm notice Run npm install -g [email protected] to update!
npm notice

Any idea what the problem could be?
Maybe something changed in the communication protocol of the new devices?

Best 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.