NEWS
Virtuelle Sensor Smartthings
-
Hallo zusammen. Ich habe in Samsung Smartthings einen virtuellen Sensor erstellt, dessen Zustand ich mithilfe eines Google-Skripts steuern kann. Können Sie mir helfen, wie man dieses Skript in iobroker ausführt?
function close() { var url = 'https://api.smartthings.com/virtualdevices/XXXXXXX-c1f5-4029-8740-1c59dd5f1b35/events' var params = { method: "POST", 'contentType': 'application/json', "followRedirects": false, "headers": { "Content-Type": "application/json;charset=utf-8", "Accept": "application/json", "Authorization": "Bearer XXXXXXX-3eaa-4212-b946-XXXXXXX" }, 'payload': JSON.stringify( { "deviceEvents": [ { "component": "main", "capability": "contactSensor", "attribute": "contact", "value": "closed" } ] } ), } var UrlFetch = UrlFetchApp.fetch(url, params) var ResponseCode = UrlFetch.getResponseCode() Logger.log('ResponseCode ' + ResponseCode) } function open() { var url = 'https://api.smartthings.com/virtualdevices/XXXXXXX-c1f5-4029-8740-1c59dd5f1b35/events' var params = { method: "POST", 'contentType': 'application/json', "followRedirects": false, "headers": { "Content-Type": "application/json;charset=utf-8", "Accept": "application/json", "Authorization": "Bearer XXXXXXX-3eaa-4212-b946-XXXXXXX" }, 'payload': JSON.stringify( { "deviceEvents": [ { "component": "main", "capability": "contactSensor", "attribute": "contact", "value": "open" } ] } ), } var UrlFetch = UrlFetchApp.fetch(url, params) var ResponseCode = UrlFetch.getResponseCode() Logger.log('ResponseCode ' + ResponseCode) }
-
@vadim-kumpan Mit NodeRed wäre das einfach.
Aber ansonsten musst Du halt mit Javascript und dieser Axios Bibliothek programmieren. Da können Dir aber die JS Jungs sicher helfen. -
@mickym Danke!!!