TheAgentK / tuya-mqtt

Nodejs-Script to combine tuyaapi and openhab via mqtt
MIT License
173 stars 80 forks source link

dps topic does not work as described (see my pull request: fa22807), label:bug #20

Closed GadgetAngel closed 3 years ago

GadgetAngel commented 5 years ago

Describe the bug your description of using the "dps" topic does not work because the device does not respond to a dps/1 topic or any dps/index topic because the current state of tuya-mqtt.exe has the case statement falls thru if the command is neither "command" or "color". There is no case statement for "dps".

To Reproduce Steps to reproduce the behavior:

  1. if one goes to MQTT and publishes to the following topic, the tuya device will just ignore the request: tuya/tuyaAPI-id/tuyaAPI-key/tuyaAPI-ip/dps

  2. if one goes to MQTT and publishes to the following topic, the tuya device will just ignore the request: tuya/tuyaAPI-id/tuyaAPI-key/tuyaAPI-ip/dps/7

  3. if one goes to MQTT and publishes to the following topic, the tuya device will just ignore the request: tuya/tuyaAPI-id/tuyaAPI-key/tuyaAPI-ip/command/{"schema": true}

Expected behavior

  1. I expect that the device would respond to the dps query and tell me the current state of all the dps

  2. I expect that the device would respond to the dps query and tell me the current state of dps 7

  3. I expected this query to fail but I would really like to see this query added to the command topic

Screenshots If applicable, add screenshots to help explain your problem.

If you look at the DEBUG output you will see that I published to the dps topic

tuya/3543376268c63ae3f978/25f1f8c229dacaa6/192.168.0.38/dps

and got nothing back from the device.

I also published to the dps/1 topic and got nothing back from the tuya device.

BUT if I published to the command topic with {"schema": true} , which uses ( the pull request #21 code), I do get a response back from the tuya device with all the dps values

screen shots:

output from mqtt.fx

mqtt fx subscribe and publish output

DEBUG output from tuya-mqtt.exe

code debug output 1 of 7 code debug output 2 of 7 code debug output 3 of 7 code debug output 4 of 7 code debug output 5 of 7 code debug output 6 of 7 code debug output 7 of 7

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context I want a forced response from the device when I ask for a dps request. I know the device will respond after a command is given to change the state of the device. I want to see a response from the device even if the state of the device has NOT changed. That is why I would like to see {"schema": true} implemented as a command under the command TOPIC. {"schema": true} is the ONLY command in the TuyAPI that does not require the device to change its state to get a response from the device.

21