stas-demydiuk / ewpe-smart-mqtt

MQTT bridge for EWPE Smart powered devices
MIT License
64 stars 26 forks source link

Unable to publish to device #5

Closed nnmm79 closed 5 years ago

nnmm79 commented 5 years ago

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.

stas-demydiuk commented 5 years ago

If you publish message to ewpe-smart/devices/list you will receive list with available devices and their ids. After that you could publish to ewpe-smart/{deviceId}/set with JSON string as payload (keys are similar to what you receive in status messages), for example {"Pow": 1, "SetTem": 24} to power unit on and set temperature to 24. List of all available attributes with their explanation you could find here https://github.com/tomikaa87/gree-remote (scroll to "Reading status of a device" section)

nnmm79 commented 5 years ago

Even if i publish with MQTT.fx to ewpe-smart/devices/list I do not get any response and from logs I do not see anything happening. I suppose that ewpe-smart-mqtt should regurally check ewpe-smart/devices/list channel?

nnmm79 commented 5 years ago

Is maybe a problem in my Network adress to scan devices setting? I assumed that 192.168.1.255 means that AC can line on any IP in 192.168.1.? range? Should I set here IP address from AC? If this is wrong, how comes that I receive status updates?

stas-demydiuk commented 5 years ago

Do you receive status updates from your unit?

nnmm79 commented 5 years ago

Yes, I do receive status updates

stas-demydiuk commented 5 years ago

Could you please provide example of MQTT message you receive

nnmm79 commented 5 years ago

Sorry for late delay, I had to come from work to get to output.

I am pasting this output from windows MQTT.fx app connected to my Mosquitto running on rasberry pi. I am subscribed to ewpe-smart/f4911e7289ab/status

{"Pow":0,"Mod":4,"TemUn":0,"SetTem":24,"TemRec":0,"WdSpd":1,"Air":0,"Blo":0,"Health":0,"SwhSlp":0,"Lig":0,"SwingLfRig":0,"SwUpDn":6,"Quiet":0,"Tur":0,"SvSt":0}

stas-demydiuk commented 5 years ago

Looks good to me. Could you please try to publish to ewpe-smart/f4911e7289ab/set with payload {"Pow":1}. It should turn your unit on

nnmm79 commented 5 years ago

It works. This is what was missing, I did not send any payload with my publish messages. It is true, that I still do not se any response from ewpe-smart/devices/list and ewpe-smart/{deviceId}/get, but in all honesty I do not need those. I get currect status and I can set variables so that is good enough for me. Thank you very much for your support.

shgubar commented 3 years ago

Hi, Stas.

My steps for response from ewpe-smart/devices/list and ewpe-smart/{deviceId}/get is:

  1. cd ewpe-smart-mqtt/
  2. npm start
  3. Receive -> MQTT message received: ewpe-smart/f4911ed40f90/status... (with data in JSON style)
  4. Opened new window with this server -> 'cd ewpe-smart-mqtt/'
  5. mosquitto_pub -h 127.0.0.1 -m "test" -t ewpe-smart/devices/list
  6. Just added to mosquitto log -> "test"

Where I'm wrong?

shgubar commented 3 years ago

When I trying use build in mqtt, recieved next error:

[raspberrypi:~/ewpe-smart-mqtt] root #./node_modules/mqtt/mqtt.js publish ewpe-smart/devices/list /home/sh/ewpe-smart-mqtt/nodemodules/mqtt/bin/pub.js:121 args.message = (args.message || args..shift()).toString() ^ TypeError: Cannot read property 'toString' of undefined at Command.start [as func] (/home/sh/ewpe-smart-mqtt/node_modules/mqtt/bin/pub.js:121:51) at Command.call (/home/sh/ewpe-smart-mqtt/node_modules/commist/index.js:105:8) at Object.parse (/home/sh/ewpe-smart-mqtt/node_modules/commist/index.js:54:19) at cli (/home/sh/ewpe-smart-mqtt/node_modules/mqtt/mqtt.js:33:15) at Object. (/home/sh/ewpe-smart-mqtt/node_modules/mqtt/mqtt.js:40:3) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3)