I know that Nuki smart lock is supported natively over Bluetooth. However, I also have a Nuki Opener, that is not supported AND also, somehow when I add a Nuki device to nymea, it disconnects from Nuki Bridge.
But I want to use Nuki App and nymea App concurrently so I found the HTTP API to talk with the Nuki Bridge instead which allows that. That works pretty well.
Here is a basic and simple working script - however no proper security implemented yet.
What I am missing is a generic Smart Lock, can you maybe add that?
import QtQuick 2.0
import nymea 1.0
Item {
property string open: "http://BRIDGE_IP:8080/lockaction?nukiId=123456789&deviceType=0&action=1&token=123456"; //Smart Lock open
property string close: "http://BRIDGE_IP:8080/lockaction?nukiId=123456789&deviceType=0&action=2&token=123456"; //Smart Lock close
property string open_house: "http://BRIDGE_IP:8080/lockaction?nukiId=123456789&deviceType=0&action=1&token=123456"; //Opener open
ThingEvent {
id: wng_auf
thingId: "{c1d52c43-4bfa-4bb6-a149-33b9f3172f43}" // Wohnungstür öffnen
eventName: "pressed"
onTriggered: {
var http = new XMLHttpRequest();
http.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {console.log(http.responseText);}
};
http.open("GET", open, true);
http.send(open);
}
}
ThingEvent {
id: wng_zu
thingId: "{c6ba9dae-afb3-4b3d-9423-439152633cd8}" // Wohnungstür schließen
eventName: "pressed"
onTriggered: {
var http = new XMLHttpRequest();
http.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {console.log(http.responseText);}
};
http.open("GET", close, true);
http.send(close);
}
}
ThingEvent {
id: hs_auf
thingId: "{2320d59d-a84d-4b5f-8727-877da6b39409}" // Haustür öffnen
eventName: "pressed"
onTriggered: {
var http = new XMLHttpRequest();
http.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {console.log(http.responseText);}
};
http.open("GET", open_house, true);
http.send(open_house);
}
}
}