Closed JustH4ppy closed 5 months ago
I'm not sure to follow
In the 1st log block where you say "MQTT connect => Not working, I can clearly see:
13:23:12.122 MQT: stat/Luftentfeuchter/RESULT = {"POWER1":"OFF"}
13:23:12.126 MQT: stat/Luftentfeuchter/POWER1 = OFF
13:23:12.202 DMP: 55 AA 00 07 00 05 65 01 00 01 00 72
13:23:12.205 {"TuyaReceived":{"Data":"55AA00070005650100010072","Cmnd":7,"CmndData":"6501000100","DpType1Id101":0,"101":{"DpId":101,"DpIdType":1,"DpIdData":"00"}}}
13:23:12.208 TYA: fnId=11 is set for dpId=101
13:23:12.210 TYA: RX Relay-1 --> MCU State: Off Current State:Off
That I can translate by
And right after the same dialog with value 0 for OFF
So it looks like it is working as expected
The 2nd block of logs with MQTT not connected doesn't show a valid exchange on dpId 101
Hey,
sorry, maybe the second logs with MQTT not configured were not complete. Here again with MQTT not configured and device turning On/Off correctly:
17:35:32.940 SRC: WebGui from 192.168.178.148
17:35:32.955 TYA: Send "55aa00060005650100010172"
17:35:32.979 RSL: RESULT = {"POWER1":"ON"}
17:35:32.981 RSL: POWER1 = ON
17:35:33.049 DMP: 55 AA 00 07 00 05 65 01 00 01 01 73
17:35:33.051 {"TuyaReceived":{"Data":"55AA00070005650100010173","Cmnd":7,"CmndData":"6501000101","DpType1Id101":1,"101":{"DpId":101,"DpIdType":1,"DpIdData":"01"}}}
17:35:33.054 TYA: fnId=11 is set for dpId=101
17:35:33.056 TYA: RX Relay-1 --> MCU State: On Current State:On
17:35:33.059 DMP: 55 AA 00 07 00 05 02 04 00 01 01 13
17:35:33.061 {"TuyaReceived":{"Data":"55AA00070005020400010113","Cmnd":7,"CmndData":"0204000101","DpType4Id2":1,"2":{"DpId":2,"DpIdType":4,"DpIdData":"01"}}}
17:35:33.064 TYA: fnId=0 is set for dpId=2
17:35:33.066 DMP: 55 AA 00 07 00 05 0C 05 00 01 00 1D
17:35:33.068 {"TuyaReceived":{"Data":"55AA000700050C050001001D","Cmnd":7,"CmndData":"0C05000100","DpType5Id12":"0x00","12":{"DpId":12,"DpIdType":5,"DpIdData":"00"}}}
17:35:33.070 TYA: fnId=0 is set for dpId=12
17:35:33.072 DMP: 55 AA 00 07 00 05 65 01 00 01 01 73
17:35:33.074 {"TuyaReceived":{"Data":"55AA00070005650100010173","Cmnd":7,"CmndData":"6501000101","DpType1Id101":1,"101":{"DpId":101,"DpIdType":1,"DpIdData":"01"}}}
17:35:33.077 TYA: fnId=11 is set for dpId=101
17:35:33.078 TYA: RX Relay-1 --> MCU State: On Current State:On
17:35:33.080 DMP: 55 AA 00 07 00 05 66 01 00 01 00 73
17:35:33.083 {"TuyaReceived":{"Data":"55AA00070005660100010073","Cmnd":7,"CmndData":"6601000100","DpType1Id102":0,"102":{"DpId":102,"DpIdType":1,"DpIdData":"00"}}}
17:35:33.086 TYA: fnId=12 is set for dpId=102
17:35:33.088 TYA: RX Relay-2 --> MCU State: Off Current State:Off
17:35:33.092 DMP: 55 AA 00 07 00 05 67 01 00 01 01 75
17:35:33.094 {"TuyaReceived":{"Data":"55AA00070005670100010175","Cmnd":7,"CmndData":"6701000101","DpType1Id103":1,"103":{"DpId":103,"DpIdType":1,"DpIdData":"01"}}}
17:35:33.097 TYA: fnId=0 is set for dpId=103
17:35:33.315 CFG: Saved to flash at F6, Count 166, Bytes 4096
17:35:36.252 HTP: Console
17:35:40.453 TYA: Send "55aa00000000ff"
17:35:40.462 DMP: 55 AA 00 00 00 01 01 01
17:35:40.464 {"TuyaReceived":{"Data":"55AA000000010101","Cmnd":0,"CmndData":"01"}}
17:35:40.466 TYA: Heartbeat
17:35:51.456 TYA: Send "55aa00000000ff"
17:35:51.466 DMP: 55 AA 00 00 00 01 01 01
17:35:51.468 {"TuyaReceived":{"Data":"55AA000000010101","Cmnd":0,"CmndData":"01"}}
17:35:51.471 TYA: Heartbeat
17:35:52.518 WIF: Checking connection...
17:36:02.447 TYA: Send "55aa00000000ff"
17:36:02.456 DMP: 55 AA 00 00 00 01 01 01
17:36:02.459 {"TuyaReceived":{"Data":"55AA000000010101","Cmnd":0,"CmndData":"01"}}
17:36:02.461 TYA: Heartbeat
That I can translate by
MQTT command to set Power OFF Tasmota send a command (opcode 6) to dpId 101 with value 0 MCU replies with a status (opcode 7) where dpId 101 has value 0 And right after the same dialog with value 0 for OFF
So it looks like it is working as expected
The MCU responds correctly, but the device does not. When MQTT is configured I can Send/Receive commands and status from the MCU, but the device itself does nothing at all. As soon as I unconfigure MQTT the device works fine when toggeling both Relays. If this somehow helps, I can also make a video about it. I'm happy about any help!
Thanks!
Hey @JustH4ppy
After a thorough analysis, I would claim that the standard Tuya Wifi Serial Protocol is not implemented in your Tuya MCU. It could be the Wifi for Low Power Protocol or a Bluetooth Serial Protocol (which would, of course, not be compatible with the TYWE1S).
As I interpret it, Tasmota supports the standard Wifi Serial Protocol (@barbudor, would you agree with me on this?)
The following observations led me to this assumption:
Tasmota reports the Network State in several stages. When Wifi is activated, Tasmota sends Network State 3 (0x02 = The Wi-Fi network is set up, but the device is not connected to the router).
00:00:00.168 TYA: Send "55aa000300010205"
When Tasmota is connected to Wifi, it sends an incremented Network State 4 (0x03 = The Wi-Fi network is set up, and the device is connected to the router).
13:24:56.011 TYA: Send "55aa000300010306"
The next stage would be a connection with MQTT. Then Tasmota would send Network State 5 (0x04 = The device is connected to the cloud). I would have liked to see this in your first LOG (with MQTT enabled).
Regardless of which Network State Tasmota sends, your TuyaMCU always responds with 55 AA 00 03 00 00 02.
In the normal Wifi Serial Protocol, this response does not exist. It is invalid!
However, assuming that your Tuya MCU responds to the Wifi Low Power Protocol, it would repeatedly signal the Wifi Reset command in its response.
Check here: https://developer.tuya.com/en/docs/iot/wifie1smodulemcu?id=K9hhi0xp301u1 and here: https://developer.tuya.com/en/docs/iot/tuyacloudlowpoweruniversalserialaccessprotocol?id=K95afs9h4tjjh
Hey @benjaminnestler,
thank you very much for your deep research! That would totally make sense! What would be your suggestion on solving that? Can I somehow suppress sending the network state? Or is there a way to program the MCU to adjust the firmware?
Meanwhile I quickly want to post my workaround, how I currently managed to get the device controlled by Home Assistant without MQTT. Maybe it's useful for somebody dealing with the same.
command_line:
- switch:
name: Luftentfeuchter Reinigung
command_on: >
curl -X POST "http://192.168.178.44/cm?cmnd=Power1%20On"
command_off: >
curl -X POST "http://192.168.178.44/cm?cmnd=Power1%20Off"
command_state: curl -X GET "http://192.168.178.44/cm?cmnd=Power1"
value_template: >
{{value_json.POWER1 == "ON" }}
- switch:
name: Luftentfeuchter Entfeuchtung
command_on: >
curl -X POST "http://192.168.178.44/cm?cmnd=Power2%20On"
command_off: >
curl -X POST "http://192.168.178.44/cm?cmnd=Power2%20Off"
command_state: curl -X GET "http://192.168.178.44/cm?cmnd=Power2"
value_template: >
{{value_json.POWER2 == "ON" }}
Great analysis @benjaminnestler
Actually I always refer to the "Tuya Wifi Serial Protocol" documentation and I even didn't noticed that "Wifi for Low Power Protocol"
At least we see possibility for improvements as it should be possible to indentify which of those 2 protocols the MCU is using and adapt the dialog accordingly. But some more work and I don't have any of such devices in hand
Hey @barbudor,
I don't know if this is helpful, but I would like to provide any help remotely needed if this somehow helps. I can do photos of the pcb and also could set up a notebook in my network connected to the system, which you can remotely access if this somehow helps. Just let me know :)
Hi @JustH4ppy,
Can I somehow suppress sending the network state?
Currently, there is no SetOption or similar functionality to prevent reporting the network state. For the standard Tuya serial protocol, suppressing it does not seem practical.
Or is there a way to program the MCU to adjust the firmware?
Flashing the firmware of the TuyaMCU is not feasible unless you know the manufacturer of the firmware/device and have contact with them.
Tasmota is designed to adhere to the protocol by reporting the network state. The following lines are extracted from the Tuya serial protocol description:
- When the module detects that the MCU is restarted or reconnected, it will proactively send the current Wi-Fi status to the MCU.
- When the Wi-Fi status changes, the module will proactively send the current status to the MCU.
Perhaps we could consider implementing a configuration option to allow users to switch between different Tuya protocols, enabling them to decide which one to use.
@barbudor, I'm not sure if we can identify which of the tuya protocols is used by the TuyaMCU. The only difference lies in the third byte of the protocol versions (in some cases, 0x00 is used, and in others, 0x03), as well as in the available commands.
This issue has been automatically marked as stale because it hasn't any activity in last few weeks. It will be closed if no further activity occurs. Thank you for your contributions.
Issue still exists, please keep it open.
This issue has been automatically marked as stale because it hasn't any activity in last few weeks. It will be closed if no further activity occurs. Thank you for your contributions.
Please keep issue open.
This issue has been automatically marked as stale because it hasn't any activity in last few weeks. It will be closed if no further activity occurs. Thank you for your contributions.
Please keep open
This issue has been automatically marked as stale because it hasn't any activity in last few weeks. It will be closed if no further activity occurs. Thank you for your contributions.
please keep open
This issue has been automatically marked as stale because it hasn't any activity in last few weeks. It will be closed if no further activity occurs. Thank you for your contributions.
This issue was automatically closed because of being stale. Feel free to open a new one if you still experience this problem.
PROBLEM DESCRIPTION
A clear and concise description of what the problem is. I have a Sichler dehumidifier, which is currently not a supported device. It has a TYWE1S chip, which I flashed successfully. I was able to successfully assign TuyaRx and TuyaTx and was able to assign the fnids to dpids. I was able to toggle the relays I need successfully via the webinterface. As soon as I configure MQTT the device does not turn on/off anymore when toggeling the relays. No matter if actioned via Webinterface or MQTT. When I remove the Host from the MQTT configuration it starts working again. When MQTT is enabled but the MQTT Broker is stopped, it is working too.
REQUESTED INFORMATION
Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!
Backlog Template; Module; GPIO 255
:Status 0
:TO REPRODUCE
Steps to reproduce the behavior: Add/Remove MQTT Host IP. Toggle Power1 via Webinterface
EXPECTED BEHAVIOUR
A clear and concise description of what you expected to happen. Device turning On/Off when toggling DpID 101 which is working when MQTT is not configured
SCREENSHOTS
If applicable, add screenshots to help explain your problem.
ADDITIONAL CONTEXT
Add any other context about the problem here. MQTT Broker used: eclipse-mosquiotto and emqx. With both the same problem
(Please, remember to close the issue when the problem has been addressed)