Closed atus42 closed 4 years ago
Can you post a link to the product page for your device?
Generally, the devId
parameter will be different for sub-devices than the gwId
parameter.
Sorry for the delay. The package I ordered was this: https://www.aliexpress.com/item/4000303908100.html?spm=a2g0s.9042311.0.0.194e4c4dCtWaZQ
It has an SWG-03 gateway (bfd62f405900fd4511rabd
) and two SEA801-APP thermostat (bfdcbeaf72ae6bfbe7zzoa
and bf88a38b43cae1ca740e09
)
If you see/search the relevant sections from the json file
part of my issue report you can find the corresponding productId's. They may help you.
In the tuya_gw.js
file, you can see that the id
and gwID
parameters are different.
Sorry, should have looked closer at that.
It should be working. Could you use Wirecapture / tcpdump to sniff traffic between your phone and your device to see what it sends as a GET payload?
I made two pcaps width tpacketcapture app. One was an old phone width an old tuya smart version (that saved the local key, and IDs), the other was a newer phone width latest tuya smart app. None of the captures contained http requests to the gateway. They only communicated width http://crl.godaddy.com/gdig2s2-12.crl http://ocsp.godaddy.com/ http://certificates.godaddy.com/repository/gdig2.crt http://crl.godaddy.com/gdroot.crl and such.
This was probabli because the tpacketcapture app uses a vpn connection to capture traffic. If you have a good/working way to capture needed traffic please tell me.
I will try to capture traffic on the unifi AP later. Didn't know it it is even possible.
It looks like the app didn't 'speak' to the gateway itself, but the tuya cloud. Attached You can find the packets I captured on the unifi AP. Both the phone and the tuya gateway are connected to this AP.
when I filter traffic between the phone and the gateway, only arp requests are matched the filter.
Thank you. Given that, (assuming your phone can ping your gateway's IP) the app/protocol must not support that specific device type for some reason.
Unfortunately, if the app doesn't support controlling it locally, there's not much I can do either.
If you find out that there was a network issue preventing local communication between the gateway and your phone, please re-open. Otherwise I'm closing it for now.
@atus42 did you solved it? I also cannot send to the sub devices
@danielgiovanni : Unfortunately I was not able to solve it yet. It appears, that even the tuya smart app didn't communicate to the gateway directly, but through the tuya cloud.
I plan to create an artifical block towards the internet on the AP the devices connected to (Phone, tuya GW), and see if the phone tries to communicate the gateway directly if there is no internet connection to the tuya cloud.
If this didn't help, I don't know what else can I do.
@danielgiovanni : Unfortunately I was not able to solve it yet. It appears, that even the tuya smart app didn't communicate to the gateway directly, but through the tuya cloud.
I plan to create an artifical block towards the internet on the AP the devices connected to (Phone, tuya GW), and see if the phone tries to communicate the gateway directly if there is no internet connection to the tuya cloud.
If this didn't help, I don't know what else can I do.
Hi @atus42, did you have any update?
@danielgiovanni : well, I have not take time to do this (summer, other things, like covid-19). Shortly I'll got a Mikrotik device, width which I can easily do this. Autumn is coming, so this project will get more time on my side.
I found something interesting that the same code test with tuya wire zigbee hub and result is different.
/homebridge # DEBUG=* node gateway.js
TuyAPI IP and ID are already both resolved. +0ms
TuyAPI Connecting to 10.1.9.28... +6ms
TuyAPI Socket connected. +5ms
Connected to device!
TuyAPI GET Payload: +2ms
TuyAPI {
TuyAPI gwId: 'ebdd7925c7531bf4falakg',
TuyAPI devId: 'ebd2e8be35c5cc00d3nkp9',
TuyAPI t: '1599384049',
TuyAPI dps: {},
TuyAPI uid: 'ebd2e8be35c5cc00d3nkp9'
TuyAPI } +1ms
TuyAPI Received data: 000055aa000000010000000a0000001c00000001a4fd046f973e79562bee4dfbd672a9ca03a3f1f40000aa55 +15ms
TuyAPI Parsed: +2ms
TuyAPI {
TuyAPI payload: 'devid not found',
TuyAPI leftover: false,
TuyAPI commandByte: 10,
TuyAPI sequenceN: 1
TuyAPI } +1ms
Data from device: devid not found
TuyAPI Pinging 10.1.9.28 +10s
TuyAPI Received data: 000055aa00000000000000090000000c00000000b051ab030000aa55 +5ms
TuyAPI Parsed: +0ms
TuyAPI { payload: false, leftover: false, commandByte: 9, sequenceN: 0 } +1ms
TuyAPI Pong from 10.1.9.28 +0ms
TuyAPI Disconnect +5s
TuyAPI Socket closed: 10.1.9.28 +2ms
Disconnected from device.
Describe the bug I have a json file from tuya smart data, which contains all device ID's and the localKey for the gateway. Tuyapi can connect (and/or discover) the gateway, but can not get data from any subdevice. It may be the fault of my coding...
To Reproduce DEBUG=* node tuya_gw.js (I posted the code below)
Expected behavior I expected to get any available dps data from the given subdevice.
Debug Output
Screenshots N/A
Desktop (please complete the following information):
Additional context tuya_gw.js:
relevant sections from the json file:
Tuya smart app shows the very same device ID's as I see in the json file. Sub devices regulary send broadcast messages:
Please help me by finding the right code to get dps data or by improving tuyapi to support this kind of device.