spenwall / myq-alexa

A simple alexa skill to open and close myq enabled garage door
25 stars 14 forks source link

Login issues #7

Open N3rd7 opened 2 years ago

N3rd7 commented 2 years ago

Hi, this code was working amazingly until this morning, and now Alexa returns "the door is undefined". I think there is a login issue (I use a similar code for smartthings, which is no longer able to login to MyQ despite correct login information). I so hope someone can fix the Alexa skill! I discovered it 2 weeks ago and loved it haha

Megalomac commented 2 years ago

Bad timing for me. I just discovered this code today and I'm getting the same error. I've tried updating index.js to set the # from 1 to 0, but get the same error "the door is undefined" for both.

spenwall commented 2 years ago

It looks like they have bumped the api version. I am looking into this.

dmau9600 commented 2 years ago

Just chiming in - having the same issue with undefined door despite trying different device numbers. Rooting for you spenwall, this code has been working great and makes our life a lot easier with a detached garage!

himanshunagar123 commented 2 years ago

Same here, door undefined error

tschommer commented 2 years ago

Same for me, door undefined. @spenwall you'll be my hero if you figure this out.

dmau9600 commented 2 years ago

If anyone here is looking for a workaround in the meantime, SimpleCommands got their MyQ API working again. I much prefer this custom skill solution, but the SimpleCommands integration works well with MyQ and Alexa.

N3rd7 commented 2 years ago

Hi Spenwall! I thought I would check if you are having any chance in modifying the code to adjust to the new login requirements from MyQ? I loved the code for this custom skill, and how Alexa would respond saying if the door was already closed, vs was closing etc. I don't know if it helps, but Brian managed to update his code for the Smartthings integration: https://github.com/brbeaird/SmartThings_MyQ Anyhow, thanks so much for looking into it!!! Cheers

spenwall commented 2 years ago

Hi everyone,

I was finally able to get around to this. I have updated the code with a new api library that seems to be worknig. You will need to go into the alexa dashboard and update index.js and package.json then deploy. Make sure that you replace your MYQ_EMAIL and MYQ_PASSWORD placehoders.

N3rd7 commented 2 years ago

Thank you so much spenwall! I have a question (I am a simple code copier/paster, not really knowing what I'm doing haha): I have 2 garage doors. In your former code, in the Index.js, you had this code in which I was able to change the number in the string return result.devices[1].serial_number to control both doors (my first door was 0, my second door was 3 - I created 2 skills, one for each door)):

const doorStatus = async () => { try { const doorSerial = await serial()

const response = await account.getDoorState(doorSerial);
return response.deviceState;

} catch(error) { console.log(error) } }

const serial = async () => { await account.login(email, password);

const result = await account.getDevices([3, 15, 17]);
return result.devices[1].serial_number;

}

Now the new code is as below. How can I get it to select a specific door?

const getDoor = async () => { await account.refreshDevices();

//Get the first garage door found for (const device of account.devices) { if(device.device_family==='garagedoor') { return device;

spenwall commented 2 years ago

That is a great simple idea to just make two seperate skills for each door. If you just change this getDoor function you can enter the device number in the square brackets.

const getDoor = async () => {
  await account.refreshDevices();

  //Get the first garage door found
  for (const device of account.devices) {
    if(device.device_family==='garagedoor') {
      return device;
    }
  }
}
const getDoor = async () => {
  await account.refreshDevices();

  return account.devices[0];
}
N3rd7 commented 2 years ago

It works fantastic!!! I love how with this skill alexa provides feedback "the door is already closed" etc. Thank you thank you thank you!

crackersnacker commented 2 years ago

@spenwall I just want to say how grateful I am for this project, and for the quick solution to the login issues! 💯 🅰️ ➕

vietsb commented 2 years ago

Hi @spenwall - registered w/ Git just to post a big thanks for the recent update to counter the API change. Your continued contribution is much, much appreciated!

Heads-up to those creating multiple skills to control multiple devices, esp if you have MyQ homes and garage doors being shared with you. Previously I used door sequence ID's starting at 0 and it handled doors under my main MyQ account and I didn't check for functionality on shared doors. Now it seems it takes into account shared homes and garage doors so when I made this update and tested, I wasn't seeing my garage doors go up/down and thought something was wrong still, but later found it was controlling other family member's doors inadvertently since the sequence index schema had changed. Freaked them out, but it was in the name of science. :) See what I found below.

Rule:

[0] = Home # 1, Garage Door # 1 (shared w/ my account) [1] = Undefined / Unused (like a separator) [2] = Home # 2, Garage Door # 1 (shared w/ my account) [3] = Undefined / Unused (like a separator) [4] = Home # 3, Garage Door # 1 (part of my account) [5] = Home # 3, Garage Door # 2 (part of my account) [6] = Home # 3, Garage Door # 3 (part of my account)

Hope this helps someone.

lalalandrus commented 1 year ago

The code is confirmed working as of today. Worked first try, instructions and code were perfect, this is a rarity. Thanks a bunch for the code.