Open I3imbel opened 2 years ago
Sieht bei mir ähnlich aus. Kam nach Update js-controller from @3.2.16 to @3.3.15 Bis dahin lief es ohne Probleme. Info: Node.js v12.22.6 NPM 6.14.15 Admin Instanz: 5.1.23 MyQ Instanz: 0.2.0
myq hat ihre API geändert. Adapter müsste angepasst werden, ist etwas komplizierter als auch schon.
I need to switch to a different myq-api nodejs library. Maybe https://github.com/hjdhjd/myq will work. I have to try that, but it will take some time.
Ist ein Fix für dieses Problem in Sicht ?
I currently have no need to change something as the current github version is working fine here.
Just reinstalled it using the current github version and still the same - "Verbunden mit Gerät oder Dienst" is red and no objects are filled into the instance...
So I tried to use the above mentioned api and that is working by command line:
npm install @hjdhjd/myq
const { myQApi } = require("@hjdhjd/myq");
let myq = new myQApi("myusername", "mypassword");
myq.refreshDevices().then(result => {
console.log("connected, trying to open");
myq.execute(myq.devices[0], "open");
console.log("Done");
}
);
Which did indeed open my garage door! So any thoughts about implementing this as an easy fix (as this OAuth implementation is the way to go) or do I need to create an own iobroker plugin? You choose
For anyone who wants a quick implementation. I have created a Javascript which is implementing Open/Close/State I have created my own Smarthome Android app, so this is enough for me.
var pathClose ='0_userdata.0.Garage.Close';
var pathOpen ='0_userdata.0.Garage.Open';
var pathState ='0_userdata.0.Garage.State';
createState(path, false, {type: 'boolean', name: 'DoorStateChanger', role: 'info'}, null);
createState(pathClose, false, {type: 'boolean', name: 'CloseDoor', role: 'info'}, null);
createState(pathOpen, false, {type: 'boolean', name: 'OpenDoor', role: 'info'}, null);
createState(pathState, "closed", {type: 'string', name: 'DoorState', role: 'info'}, null);
const { myQApi } = require("@hjdhjd/myq");
let myq = new myQApi("yourusername", "yourpassword");
myq.refreshDevices().then(r =>{
StartPoller();
});
function StartPoller(){
console.log("Poller");
myq.refreshDevices().then(r =>{
setState(pathState, myq.devices[0].state.door_state);
});
setTimeout(function(){ StartPoller(); }, 5000);
}
on({id: path, change: "ne"}, function (obj) {
if(obj.state.val == true){
setState(path,false);
console.debug("go");
myq.refreshDevices().then(result => {
console.debug("connected");
if (myq.devices[0].state.door_state == "closed") {
console.debug("opening");
myq.execute(myq.devices[0], "open");
} else {
console.debug("closing");
myq.execute(myq.devices[0], "close");
}
}
);
}
});
on({id: pathClose, change: "ne"}, function (obj) {
if(obj.state.val == true){
setState(pathClose,false);
console.debug("go");
myq.refreshDevices().then(result => {
console.debug("connected");
console.debug("closing");
myq.execute(myq.devices[0], "close");
}
);
}
});
on({id: pathOpen, change: "ne"}, function (obj) {
if(obj.state.val == true){
setState(pathOpen,false);
console.debug("go");
myq.refreshDevices().then(result => {
console.debug("connected");
console.debug("opening");
myq.execute(myq.devices[0], "open");
}
);
}
});
Save and you will have options in 0_userdata.0.Garage Setting a value to true will open or close the garage (and it will reset to "false") State is showing the current state.
It is just a quick implementation and supporting 1 Garage (you might change the ID).
@StrathCole Maybe you want to use this to update your adapter.
@DominikReber your script works fine for me. Thank you!
Now I finally had time to update the adapter to use the mentioned api library. For me it works again, now. Please install 0.3.0 from github to test, if you like.
0.3.0 is working for me. Like my implementation does too. Thanks for updating
Hi, der Adapter läuft, ist aber nicht einem Dienst oder Gerät verbunden.
Node: 12.16.1 NPM: 6.13.4
Wie kann ich beim testen unterstützen?
Grüße