Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verbindungsfehler #13

Open
I3imbel opened this issue Aug 31, 2021 · 11 comments
Open

Verbindungsfehler #13

I3imbel opened this issue Aug 31, 2021 · 11 comments

Comments

@I3imbel
Copy link

I3imbel commented Aug 31, 2021

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
Copy link

Ben-x86 commented Sep 2, 2021

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
Copy link

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

@StrathCole
Copy link
Contributor

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
Copy link

Ist ein Fix für dieses Problem in Sicht ?

@StrathCole
Copy link
Contributor

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

@DominikReber
Copy link

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
Copy link

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
Copy link

DominikReber commented Oct 18, 2021

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
Copy link

Ben-x86 commented Nov 30, 2021

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

@StrathCole
Copy link
Contributor

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
Copy link

DominikReber commented Dec 1, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants