pixcept / ioBroker.myq

ioBroker adapter for MyQ (Chamberlain/Liftmaster)
MIT License
0 stars 4 forks source link

Verbindungsfehler #13

Open I3imbel opened 2 years ago

I3imbel commented 2 years ago

Hi, der Adapter läuft, ist aber nicht einem Dienst oder Gerät verbunden.

image

Node: 12.16.1 NPM: 6.13.4

Wie kann ich beim testen unterstützen?

Grüße

Ben-x86 commented 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

RedondoBoony commented 2 years ago

myq hat ihre API geändert. Adapter müsste angepasst werden, ist etwas komplizierter als auch schon.

StrathCole commented 2 years ago

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.

patrick-stoeckel commented 2 years ago

Ist ein Fix für dieses Problem in Sicht ?

StrathCole commented 2 years ago

I currently have no need to change something as the current github version is working fine here.

DominikReber commented 2 years ago

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...

DominikReber commented 2 years ago

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

DominikReber commented 2 years ago

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.

  1. Install Javascript Adapter (if needed)
  2. Install Instance and add "@hjdhjd/myq" as "Additional NPM module" (or add to your existing instance)
  3. Create a new Javascript (and enter your username and password):
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.

Ben-x86 commented 2 years ago

@DominikReber your script works fine for me. Thank you!

StrathCole commented 2 years ago

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.

DominikReber commented 2 years ago

0.3.0 is working for me. Like my implementation does too. Thanks for updating