ndg63276 / smartathome

GNU General Public License v3.0
48 stars 15 forks source link

Some Tuya devices not showing #6

Open filipdns opened 5 months ago

filipdns commented 5 months ago

Hello,

I'm trying to use your webApp but some devices are not visible (Cookies cleared, not items hidden) Do you know why?

Kind regards Philippe

SmartAtHome tuya

ndg63276 commented 5 months ago

Unfortunately it's very tricky to know why it doesn't show some of your devices. If you can look in the developer console, your browser should be doing requests to an address like https://px1.tuyaeu.com/homeassistant/skill, so if you can look at the response from that, it might tell you what the server is responding. I'm just a hobbyist so I only have a few bulbs to play with.

filipdns commented 5 months ago

Hello, thanks to take time to reply to me.

I Have already check on this and the response is what it’s show on your page. I don’t see any thing wrong on the response but only some devices missing, I can not explain why.

I suppose that the problem is from the https://px1.tuyaeu.com/homeassistant itself. Sensors, thermostat etc are not show.

ndg63276 commented 5 months ago

It's weird that Bulb 8182 4 and Bulb 8182 5 are shown, but not Bulb 8182 3 or Bulb 8182 2. I guess it is possible there is a second page of results, but unless the API tells us the address of the second page, I can't look for it.

filipdns commented 5 months ago

For bulbs, that is normal, I don’t have the 3 and 2.

Anyway, lights control is not working even ON/OFF or color but I don’t need them.

The devices missing are :

Dual Temp Controller

bfc16a812842bc8899b8su

poêle temperature

bf3fdacd9a3888d71fcuuj

TV Sync Backlights

bfef9f313256d5b4d0nydj

I can give you my ident and password of https://auth.tuya.com/ and my smart life account if you want make some test if you want.

Kind regards

Philippe

De : Mark W @.*** Envoyé : jeudi 21 mars 2024 15:22 À : ndg63276/smartathome Cc : filipdns; Author Objet : Re: [ndg63276/smartathome] Some Tuya devices not showing (Issue #6)

It's weird that Bulb 8182 4 and Bulb 8182 5 are shown, but not Bulb 8182 3 or Bulb 8182 2. I guess it is possible there is a second page of results, but unless the API tells us the address of the second page, I can't look for it.

— Reply to this email directly, view it on GitHub https://github.com/ndg63276/smartathome/issues/6#issuecomment-2012427551 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AIMY25VD5MJ7MFBXXXMHA6DYZLUHFAVCNFSM6AAAAABFBMAUJ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJSGQZDONJVGE . You are receiving this because you authored the thread.Image supprimée par l'expéditeur.Message ID: @.***>

filipdns commented 5 months ago

I’m not specialist of web app but it’s not possible to pass through tuya platform directly to get information and control devices ?

Example, in developer mode in mozilla, I went to https://eu.iot.tuya.com/cloud/device/detail/?id=p17110189623875m4ncc&sourceId=eu1669210445613B3LCl&sourceType=4&region=EU&deviceKey=deviceDebug&deviceId=bf3fdacd9a3888d71fcuuj

And I get all devices and all information of them :

POST :https://eu.iot.tuya.com/micro-app/cloud/api/v10/device/list

Response header :

HTTP/2 200 OK

date: Thu, 21 Mar 2024 15:39:50 GMT

content-type: application/json; charset=utf-8

vary: Accept-Encoding

x-fast-id: 1f8e5d8a447ee0c3

x-via: 1.1 fr

set-cookie: csrf-token=5wIG1o8t-okrX3xLJq9MnXSlQW_OioUtui5k; path=/; secure

set-cookie: csrf-token.sig=lRsneff0KJoArO1G3n7WfX0e0rw; path=/; secure

set-cookie: s-sid=s:679e8b30-bf4c-4a6f-9c81-80ff9a29ab20.JScYQLGRmpmjNa5a+h/BuY7Rj6iX2wVTesdgGrK63ME; path=/; expires=Thu, 21 Mar 2024 21:39:50 GMT; httponly

set-cookie: fast-sid=qoWzHGO024qFDNImSlRLuW5vzLFM6dzU; path=/; expires=Mon, 25 Mar 2024 15:39:50 GMT; secure; httponly

x-envoy-upstream-service-time: 172

strict-transport-security: max-age=31536000

server: Sec

cache-control: no-store

x-content-type-options: nosniff

x-frame-options: *.tuya-inc.com

x-xss-protection: 1; mode=block

x-b3-traceid: 1f8e5d8a447ee0c3

content-encoding: gzip

X-Firefox-Spdy: h2

Request header :

POST /micro-app/cloud/api/v10/device/list HTTP/2

Host: eu.iot.tuya.com

User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0

Accept: application/json, text/plain, /

Accept-Language: en-GB,en;q=0.5

Accept-Encoding: gzip, deflate, br

Content-Type: application/json; charset=utf-8

Content-Length: 142

Referer: https://eu.iot.tuya.com/cloud/device/detail/?id=p17110189623875m4ncc&sourceId=eu1669210445613B3LCl&sourceType=4&region=EU&deviceKey=deviceDebug

X-Requested-With: XMLHttpRequest

Cache-Control: no-cache

Pragma: no-cache

csrf-token: 7OtbPoMZ-NAQhqdV8f3bzOJCACCMnVcctq4U

sentry-trace: 5b9bb3fda27f441d8bdbb089bad8bece-b8a7af4ab13d948b-1

baggage: sentry-environment=prod,sentry-release=20240115-104430701-81355edb3d,sentry-public_key=6b01b12c0757425f92998890f7294d4a,sentry-trace_id=5b9bb3fda27f441d8bdbb089bad8bece,sentry-sample_rate=1,sentry-sampled=true

Origin: https://eu.iot.tuya.com

DNT: 1

Sec-Fetch-Dest: empty

Sec-Fetch-Mode: cors

Sec-Fetch-Site: same-origin

Connection: keep-alive

Cookie: _tpmGuid=TY-a3ae64bf8e6d0bae; gTyPlatLang=en; locale=en; fast-sid=qoWzHGO024qFDNImSlRLuW5vzLFM6dzU; s-sid=s:679e8b30-bf4c-4a6f-9c81-80ff9a29ab20.JScYQLGRmpmjNa5a+h/BuY7Rj6iX2wVTesdgGrK63ME; _tpmSid=b7971586ababf55e354d7294c96cbdc12e39b0070542890fa2b7e8f0fb789e1f; csrf-token=x0gYxRA7-tRKMj7on_yIgNxNAXVrLKCxd15U; csrf-token.sig=Bne0nKLzWRX5KRAKBBOyk4bFUac; tz=1; _iss_hist=%5B%7B%22006453ea31b3d46715e6dcb8c9025beb%22%3A%5B%22smart_menu_cloud_develop_api_group%22%2C%22smart_menu_developer_platform_home%22%2C%22smart_menu_stat_portrait_customergroup%22%5D%7D%5D; projectCode=p17110189623875m4ncc; __th_p_c=1|1|1; _iss_cloud_saas=true; _tpmSeqId=seq_id_b1ac903fc267bc3f; region=EU

TE: trailers

The json received on it :

{"result":{"data":[{"activeTime":1706656770000,"appName":"Smart Life","devId":"bf747e5ee1a5ae28a3jls8","devName":"Poêle @.","sourceType":4,"tuyagoUrl":"","uid":"eu1669210445613B3LCl"},{"activeTime":1706655266000,"appName":"Smart @.","sourceType":4,"tuyagoUrl":"","uid":"eu1669210445613B3LCl"},{"activeTime":1706656615000,"appName":"Smart Life","devId":"bfef9f313256d5b4d0nydj","devName":"TV Sync Backlights","icon":"smart/icon/bay1620612456877DitN/1aae025ef332c2e5bd1ad8abd4831443.png","isOnline":false,"isVirtual":false,"ownType":0,"pid":"gaobbrxqiblcng2p","productCategory":"Strip @.","sourceType":4,"tuyagoUrl":"","uid":"eu1669210445613B3LCl"},{"activeTime":1706655313000,"appName":"Smart Life","devId":"bf6507c9ad5f46414drlxd","devName":"Volet salon","icon":"smart/icon/ay1533257659316XGZOd/9a78e5d3a0db2cd5f770ff5e82d60bb0.jpg","isOnline":true,"isVirtual":false,"ownType":0,"pid":"igtakqsfhbr7qsp7","productCategory":"Breaker","productName":" 1CH WiFi Curtain Module @.","sourceType":4,"tuyagoUrl":"","uid":"eu1669210445613B3LCl"},{"activeTime":1710515634000,"appName":"Smart Life","devId":"bfbc5eab23a676d0bbrwvz","devName":"Porte @.","sourceType":4,"tuyagoUrl":"","uid":"eu1669210445613B3LCl"},{"activeTime":1706656675000,"appName":"Smart Life","devId":"bf3fdacd9a3888d71fcuuj","devName":"poêle temperature","icon":"smart/icon/bay16341152123566Lf0/76a8f27e4a74e0685a969c4ad7bade0b.jpg","isOnline":true,"isVirtual":false,"ownType":0,"pid":"4pja3f7t79s8mzzx","productCategory":"Temperature control @.","sourceType":4,"tuyagoUrl":"","uid":"eu1669210445613B3LCl"},{"activeTime":1706655207000,"appName":"Smart @.","sourceType":4,"tuyagoUrl":"","uid":"eu1669210445613B3LCl"},{"activeTime":1706702248000,"appName":"Smart Life","devId":"bfc16a812842bc8899b8su","devName":"Dual Temp Controller","icon":"smart/icon/ay1524831691838LKBMs/16481045156913f009b16.jpg","isOnline":true,"isVirtual":false,"ownType":0,"pid":"84iv5eqjgvvpzyma","productCategory":"Water @.","sourceType":4,"tuyagoUrl":"","uid":"eu1669210445613B3LCl"},{"activeTime":1710382111000,"appName":"Smart Life","devId":"bf28abbd1cf7fc463cnapv","devName":"WIFI-CW","icon":"smart/icon/ay1532660270361428EU/a5a498ddfc25e3f9c1b4786b9fdffadf.png","isOnline":false,"isVirtual":false,"ownType":0,"pid":"ejm60abidvur2hio","productCategory":"Strip @.","sourceType":4,"tuyagoUrl":"","uid":"eu1669210445613B3LCl"},{"activeTime":1710160699000,"appName":"Smart Life","devId":"bfbddbnng7s1vnan","devName":"LED BULB 8182 2","icon":"smart/icon/bay1638666472267gXxe/ed4b82985a867400f47f19704a5a7e61.png","isOnline":true,"isVirtual":false,"ownType":0,"pid":"bjoxnbwa","productCategory":"Light Source","productName":"LED BULB @.","sourceType":4,"tuyagoUrl":"","uid":"eu1669210445613B3LCl"}],"hasNext":true,"lastId":"1710180109,bfbddbnng7s1vnan","pageSize":10},"t":1711036158416,"success":true,"status":"ok"}

And selecting one of device :

GET : https://openapi.tuyaeu.com/v1.0/devices/bf3fdacd9a3888d71fcuuj/status

Request header :

GET /v1.0/devices/bf3fdacd9a3888d71fcuuj/status HTTP/2

Host: openapi.tuyaeu.com

User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0

Accept: application/json, text/plain, /

Accept-Language: en-GB,en;q=0.5

Accept-Encoding: gzip, deflate, br

Referer: https://eu.iot.tuya.com/

X-Requested-With: XMLHttpRequest

Cache-Control: no-cache

Pragma: no-cache

csrf-token: 73EwzUUc-1miPSoAxn0pCfKV254IkM34XxuM

sign_method: HMAC-SHA256

client_id: sf9hgwk3nv95s3ymcn4m

t: 1711036683119

mode: cors

sign: 5F63A5B423FBDE6C617B18A2A01DDE62138FEEC25DC51B3E642C63E1A759CDD9

access_token: 6b60440f410661d47d26d188daae6540

signVersion: 2.0

Origin: https://eu.iot.tuya.com

DNT: 1

Sec-Fetch-Dest: empty

Sec-Fetch-Mode: cors

Sec-Fetch-Site: cross-site

Connection: keep-alive

TE: trailers

Json received :

{"result":[{"code":"switch_1","value":false},{"code":"countdown_1","value":0},{"code":"cycle_time","value":"AAAAgk4AAAHBawH9AAAAgoQBwgWfawLYAAAAgk4AAAGGFAFrAAAAgoQBhwH+FAKhAAAAgk4B/wQaFAICAAAAgoQEGwWfFAHd"},{"code":"work_mode","value":"hot"},{"code":"customize_mode_switch","value":true},{"code":"add_ele","value":1},{"code":"cur_current","value":0},{"code":"cur_power","value":0},{"code":"cur_voltage","value":2241},{"code":"voltage_coe","value":377},{"code":"electric_coe","value":25820},{"code":"power_coe","value":10106},{"code":"electricity_coe","value":4120},{"code":"power_limit","value":12000},{"code":"test_bit","value":1},{"code":"temp_unit_convert","value":"c"},{"code":"temp_set_f","value":384},{"code":"temp_set","value":36},{"code":"temp_current","value":161},{"code":"temp_current_f","value":609},{"code":"vibration_value","value":10},{"code":"temp_correction","value":0},{"code":"fault","value":0},{"code":"cold_delay","value":2},{"code":"cold_delay_switch","value":false}],"success":true,"t":1711036683358,"tid":"cc897d4be79b11eeb8e44adb5c011a40"}

I don’t know if it can be used..

Kind regards

Philippe

ndg63276 commented 5 months ago

I think you need a Tuya developer account to access those APIs.

filipdns commented 5 months ago

Yes I have it

De : Mark W @.*** Envoyé : jeudi 21 mars 2024 17:26 À : ndg63276/smartathome Cc : filipdns; Author Objet : Re: [ndg63276/smartathome] Some Tuya devices not showing (Issue #6)

I think you need a Tuya developer account to access those APIs.

— Reply to this email directly, view it on GitHub https://github.com/ndg63276/smartathome/issues/6#issuecomment-2012882761 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AIMY25TXGPHK4RO7UTY7GMLYZMCZNAVCNFSM6AAAAABFBMAUJ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJSHA4DENZWGE . You are receiving this because you authored the thread.Image supprimée par l'expéditeur.Message ID: @.***>

ndg63276 commented 5 months ago

You do, but the other people who use my site don't.

filipdns commented 5 months ago

I see, thank you very much for your time

De : Mark W @.*** Envoyé : jeudi 21 mars 2024 17:29 À : ndg63276/smartathome Cc : filipdns; Author Objet : Re: [ndg63276/smartathome] Some Tuya devices not showing (Issue #6)

You do, but the other people who use my site don't.

— Reply to this email directly, view it on GitHub https://github.com/ndg63276/smartathome/issues/6#issuecomment-2012896218 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AIMY25S3WBFDVSXCVYNKGR3YZMDERAVCNFSM6AAAAABFBMAUJ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJSHA4TMMRRHA . You are receiving this because you authored the thread.Image supprimée par l'expéditeur.Message ID: @.***>

filipdns commented 5 months ago

Hello Mark,   I check on home assistant intégration procédure for tuya and for that, people must have tuya account.   https://developer.tuya.com/en/docs/iot/Home-assistant-tuya-intergration?id=Kb0eqjig0utdd   Kind regards  Philippe   

    Philippe DENIS _______________________________________________________________ Responsable du Pôle Aéronautique du S.I.A.  T + 33 (0)3 75 41 40 04   3 rue Cassini 60 000 Tille ign.fr - geoportail.gouv.fr     Conseil éco responsable: n'imprimez ce message que si nécessaire.             

-----Message original-----

De: Mark @.> à: ndg63276 @.> Cc: filipdns @.>; Author @.> Envoyé: jeudi 21 mars 2024 17:29 CET Sujet : Re: [ndg63276/smartathome] Some Tuya devices not showing (Issue #6)

  You do, but the other people who use my site don't. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>