From 75847e6200c452d26d57c618f949155c08958582 Mon Sep 17 00:00:00 2001 From: Jajajajaja51 Date: Thu, 23 Jul 2026 19:55:13 +0200 Subject: [PATCH 1/3] Create home --- home | 1 + 1 file changed, 1 insertion(+) create mode 100644 home diff --git a/home b/home new file mode 100644 index 0000000..1393b39 --- /dev/null +++ b/home @@ -0,0 +1 @@ +b779b38e-da2b-499e-844e-1b88daa6692a \ No newline at end of file From d8591fa2df5d37869c8687c34bdb196762f8d418 Mon Sep 17 00:00:00 2001 From: Jajajajaja51 Date: Thu, 23 Jul 2026 20:25:05 +0200 Subject: [PATCH 2/3] Update app.json --- .homeycompose/app.json | 99 +++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 65 deletions(-) diff --git a/.homeycompose/app.json b/.homeycompose/app.json index 4dfeee4..1cc2f0a 100644 --- a/.homeycompose/app.json +++ b/.homeycompose/app.json @@ -1,69 +1,38 @@ { - "id": "ady.smartthings", - "version": "2.0.40", - "compatibility": ">=12.0.1", - "sdk": 3, - "platforms": [ - "local" - ], - "brandColor": "#2ACAEA", - "name": { - "en": "SmartThings Community" - }, - "description": { - "en": "Make your SmartThings smarter with Homey" - }, - "category": [ - "appliances" - ], - "contributing": { - "donate": { - "paypal": { - "username": "adyrock" - } - } - }, - "permissions": [], - "images": { - "large": "/assets/images/large.png", - "small": "/assets/images/small.png", - "xlarge": "/assets/images/xlarge.png" - }, - "author": { - "name": "Adrian Rockall", - "email": "ady@rockalls.com" - }, - "bugs": { - "url": "https://github.com/AdyRock/com.smartthings/issues" - }, - "source": "https://github.com/AdyRock/com.smartthings", - "support": "https://github.com/AdyRock/com.smartthings/issues", - "homeyCommunityTopicId": 61418, - "api": { - "getLog": { - "method": "get", - "path": "/getLog/" + "id": "com.smartthings", + "name": { + "en": "SmartThings", + "da": "SmartThings" + }, + "version": "1.0.0", + "compatibility": ">=5.0.0", + "permissions": [ + "homey:app:com.smartthings" + ], + "drivers": [ + { + "id": "st_device", + "name": { + "en": "SmartThings Enhed", + "da": "SmartThings Enhed" + }, + "class": "other", + "capabilities": ["onoff", "dim", "alarm_contact"], + "pair": [ + { + "id": "pat_input", + "template": "login_credentials", + "options": { + "title": "Forbind til SmartThings", + "usernameLabel": "Brugernavn (efterlad tom)", + "passwordLabel": "Indsæt PAT Token her" + } }, - "getDetect": { - "method": "get", - "path": "/getDetect/" - }, - "clearLog": { - "method": "post", - "path": "/clearLog/" - }, - "sendCmd": { - "method": "post", - "path": "/sendCmd/" - }, - "SendDeviceLog": { - "method": "post", - "path": "/SendDeviceLog/", - "public": true - }, - "SendInfoLog": { - "method": "post", - "path": "/SendInfoLog/" + { + "id": "list_devices", + "template": "list_devices" } + ] } -} \ No newline at end of file + ] +} From e67ed1bba002754ff0d1b959c49600e8932a2709 Mon Sep 17 00:00:00 2001 From: Jajajajaja51 Date: Thu, 23 Jul 2026 20:26:20 +0200 Subject: [PATCH 3/3] Create homebott --- homebott | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 homebott diff --git a/homebott b/homebott new file mode 100644 index 0000000..ed78b54 --- /dev/null +++ b/homebott @@ -0,0 +1,33 @@ +const Homey = require('homey'); +const fetch = require('node-fetch'); + +class SmartThingsDriver extends Homey.Driver { + async onPair(session) { + let patToken = ''; + + // Trin 1: Tjek om token virker + session.setHandler('login', async (data) => { + patToken = data.password; + const res = await fetch('https://api.smartthings.com/v1/devices', { + headers: { 'Authorization': 'Bearer ' + patToken } + }); + if (!res.ok) throw new Error('Ugyldig PAT Token. Tjek dine rettigheder.'); + return true; + }); + + // Trin 2: Hent enhedslisten + session.setHandler('list_devices', async () => { + const res = await fetch('https://api.smartthings.com/v1/devices', { + headers: { 'Authorization': 'Bearer ' + patToken } + }); + const json = await res.json(); + + return json.items.map(device => ({ + name: device.label || device.name, + data: { id: device.deviceId, token: patToken }, + store: { capabilities: device.components[0].capabilities.map(c => c.id) } + })); + }); + } +} +module.exports = SmartThingsDriver;