From 6d2e3109e36776b09ef2b4038a00fa23af482e37 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Tue, 21 Nov 2023 00:58:22 +0100 Subject: [PATCH] Add Ledvance support While trying to get my shiny new Ledvance smart plugs to work, I found that none of the embedded keys to access Tuya work. However, there was a python tool that was able to access the APIs just fine: https://github.com/FlagX/ha-ledvance-tuya-resync-localkey.git This patch adds the Ledvance keys from that tool into the iobroker code. With this, I can successfully access power measurements from my Ledvance power switches. Signed-off-by: Alexander Graf --- admin/index_m.html | 1 + lib/appcloud.js | 8 ++++++++ main.js | 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/admin/index_m.html b/admin/index_m.html index 0d4cf8a..b3945a1 100644 --- a/admin/index_m.html +++ b/admin/index_m.html @@ -361,6 +361,7 @@
Cloud-App-Login
diff --git a/lib/appcloud.js b/lib/appcloud.js index 4dc2101..f521fe7 100644 --- a/lib/appcloud.js +++ b/lib/appcloud.js @@ -29,6 +29,14 @@ class AppCloud { secret2: 'vay9g59g9g99qf3rtqptmc3emhkanwkx', secret: 'aq7xvqcyqcnegvew793pqjmhv77rneqc', }; + } else if (appType === 'ledvance') { + this.apiKeys = { + ttid: 'sdk_tuya@fx3fvkvusmw45d7jn8xh', + key: 'fx3fvkvusmw45d7jn8xh', + secret: 'cgqx3ku34mh5qdesd7fcaru3gx7tyurr', + secret2: 'armptsqyfpxa4ftvtc739ardncett3uy', + certSign: 'A', + } } else { this.apiKeys = { ttid: 'smart_life', diff --git a/main.js b/main.js index b4aa5bd..933f78a 100644 --- a/main.js +++ b/main.js @@ -2254,7 +2254,8 @@ async function connectMqtt() { adapter.config.cloudUsername, adapter.config.cloudPassword, adapter.config.appPhoneCode || 49, - adapter.config.appType === 'tuya_smart' ? 'tuyaSmart' : 'smartLife', + adapter.config.appType === 'tuya_smart' ? 'tuyaSmart' : + (adapter.config.appType === 'ledvance' ? 'ledvance' : 'smartLife'), {log: adapter.log.debug.bind(this)}, );