hjdhjd / homebridge-myq

:car: myQ Liftmaster and Chamberlain Plugin for Homebridge https://github.com/nfarina/homebridge
Other
568 stars 44 forks source link

Error when running homebridge - UnhandledPromiseRejectionWarning: TypeError #71

Closed LampeMW closed 4 years ago

LampeMW commented 4 years ago

I recently updated to the newest version of homebridge as well as the newest version of homebridge-myq2, and am now getting this error when running homebridge. I'm not quite sure how to debug this and wanted to see if you could help figure it out.

(node:104498) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getCharacteristic' of undefined
    at /usr/lib/node_modules/homebridge-myq2/dist/index.js:238:21
    at Array.forEach (<anonymous>)
    at myQPlatform.myQUpdateDeviceList (/usr/lib/node_modules/homebridge-myq2/src/index.ts:264:22)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
    at myQPlatform.updateAccessories (/usr/lib/node_modules/homebridge-myq2/src/index.ts:423:5)
(node:104498) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

Here's a sample of my config json:

{
        "bridge": {
                "name": "Homebridge",
                "username": "redacted",
                "port": 51826,
                "pin": "123-45-678"
        },
        "platforms": [
                {
                        "platform": "myQ",
                        "email": "redacted",
                        "password": "redacted"
                }
        ]
}

Thanks!

hongziyang commented 4 years ago

I'm seeing the same after doing a full updated to homebridge and the plugin.

4rsfed commented 4 years ago

Same issue here was working on 2.0.11

LampeMW commented 4 years ago

Same issue here was working on 2.0.11

Thanks, I was on a way older version before updating today, so I just downgraded to 2.0.11 and it's working for me as a temporary fix.

4rsfed commented 4 years ago

Same issue here was working on 2.0.11

Thanks, I was on a way older version before updating today, so I just downgraded to 2.0.11 and it's working for me as a temporary fix.

How did you do that? I'd like to as well. :)

SafariKC commented 4 years ago

Same here. It seems that one of my homes gateways is causing the issue. The other home is able to use the latest plugin.

@4rsfed from the terminal where you have homebridge installed.

sudo npm install -g homebridge-myq2@2.0.11

SafariKC commented 4 years ago

I just figured out what was throwing the error for me. My Garage here at the main house has an old Chamberlain light module for controlling a plugged in lamp. I don't use it so I removed it from the MyQ app and upgraded to the latest version again and it works.

Sounds like there's some logic around non-garage devices that still needs some love. Which makes sense looking at the change log as to why 2.0.11 works for folks.

4rsfed commented 4 years ago

I just figured out what was throwing the error for me. My Garage here at the main house has an old Chamberlain light module for controlling a plugged in lamp. I don't use it so I removed it from the MyQ app and upgraded to the latest version again and it works.

Sounds like there's some logic around non-garage devices that still needs some love. Which makes sense looking at the change log as to why 2.0.11 works for folks.

My setup is just 2 doors, pretty straightforward.

BindersFullOfWomen commented 4 years ago

Experiencing this issue as well on the latest MyQ2 version. Using HB version 1.1.1.

hjdhjd commented 4 years ago

I’ll look at this later today folks...thanks!

hjdhjd commented 4 years ago

@LampeMW Can you tell me the actual hardware device that you’re using for myQ? It would be helpful.

BindersFullOfWomen commented 4 years ago

Overhead Door garage door and Win 10 for homebridge

hjdhjd commented 4 years ago

@BindersFullOfWomen (BTW...love the handle!)...can you do me a favor and turn on debugging and fire it up. You’re going to see A LOT of data. I’m interested in the JSON parts that talk about the devices. You’ll see things like the serialnumber, device_type, etc...feel free to redact sensitive information, but it would help tremendously.

Thanks!

BindersFullOfWomen commented 4 years ago

Thank you.

Here is what you were looking for (I think). This (and the rest of the log files) are looping too. Same logs and error message over and over.

[7/6/2020, 2:52:32 PM] [Home] Throttling myQ API call. Using cached data from the past five seconds.
(node:13896) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getCharacteristic' of undefined
    at myQ.Devices.forEach (C:\Users\stieger\AppData\Roaming\npm\node_modules\homebridge-myq2\dist\index.js:238:21)
    at Array.forEach (<anonymous>)
    at myQPlatform.myQUpdateDeviceList (C:\Users\stieger\AppData\Roaming\npm\node_modules\homebridge-myq2\src\index.ts:264:22)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:13896) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
hjdhjd commented 4 years ago

Nope. Did you turn on debugging for the plugin? Go into plugin settings, advanced, turn on debugging. This will generate a lot of information.

Then look in the logs and find lines that talk about device_type and device_family....paste that block here (redacted for sensitive information).

Thanks!

LampeMW commented 4 years ago

Let me know if this is what you're looking for. I removed the urls as they had the API key in them, not sure if I left anything else in there that should be removed.

Edit: I just realized that it's working now. I stopped homebridge, updated to the latest version, and re-ran homebridge and the error isn't happening anymore. I was on a previous version where the platform was still called "MyQ2", can't remember exactly what version. I wonder if somehow going to version 2.0.11 and then updating to the latest had an impact.

[7/6/2020, 11:58:04 AM] [myQ] myQ garagedoor device discovered: Garage Door (serial number: removed, gateway: removed).
[7/6/2020, 11:58:04 AM] [myQ] {
  created_date: '2019-12-03T16:04:45.637',
  device_family: 'garagedoor',
  device_platform: 'myq',
  device_type: 'virtualgaragedooropener',
  href: 'removed',
  name: 'Garage Door',
  parent_device: 'removed',
  parent_device_id: 'removed',
  serial_number: 'removed',
  state: {
    aux_relay_behavior: 'None',
    aux_relay_delay: '00:00:00',
    close: 'removed',
    command_channel_report_status: false,
    control_from_browser: false,
    door_ajar_interval: '00:00:00',
    door_state: 'closed',
    dps_low_battery_mode: false,
    invalid_credential_window: '00:00:00',
    invalid_shutout_period: '00:00:00',
    is_unattended_close_allowed: true,
    is_unattended_open_allowed: true,
    last_status: '2020-07-06T18:52:46.6090159Z',
    last_update: '2020-07-06T17:14:29.1114887Z',
    max_invalid_attempts: 0,
    monitor_only_mode: false,
    number_of_learned_dps_devices: 1,
    online: true,
    open: 'removed',
    passthrough_interval: '00:00:00',
    report_ajar: false,
    report_forced: false,
    rex_fires_door: false,
    sensor_comm_error: false,
    use_aux_relay: false
  }
}
[7/6/2020, 11:58:04 AM] [myQ] myQ gateway device discovered: Hub (serial number: removed).
[7/6/2020, 11:58:04 AM] [myQ] {
  created_date: '2019-12-03T16:04:23.593',
  device_family: 'gateway',
  device_platform: 'myq',
  device_type: 'hub',
  href: 'removed',
  name: 'Hub',
  serial_number: 'removed',
  state: {
    firmware_version: '3.8',
    homekit_capable: false,
    homekit_enabled: false,
    last_status: '2020-07-06T18:52:13.2227321Z',
    learn: 'removed',
    learn_mode: false,
    online: true,
    pending_bootload_abandoned: false,
    physical_devices: [ 'removed', 'removed' ],
    updated_date: '2020-07-06T18:52:17.4497114Z'
  }
}
BindersFullOfWomen commented 4 years ago

I did enable debugging, yeah. Just took a guess at what you were looking for. I'll dump it all to be safe and just clean up the PPI.

  items:
   [ { created_date: '2020-03-09T14:21:11.223',
       device_family: 'garagedoor',
       device_platform: 'myq',
       device_type: 'virtualgaragedooropener',
       href:
        'http://api.myqdevice.com/api/v5/accounts/XXXXXXXXXXX/devices/XXXXXXXXXXX',
       name: 'Garage Door',
       parent_device:
        'http://api.myqdevice.com/api/v5/accounts/XXXXXXXXXXX/devices/XXXXXXXXXXX',
       parent_device_id: 'XXXXXXXXXXX',
       serial_number: 'XXXXXXXXXXX',
       state:
        { aux_relay_behavior: 'None',
          aux_relay_delay: '00:00:00',
          close:
           'http://api.myqdevice.com/api/v5/accounts/XXXXXXXXXXX/devices/XXXXXXXXXXX/close',
          command_channel_report_status: false,
          control_from_browser: false,
          door_ajar_interval: '00:00:00',
          door_state: 'closed',
          dps_low_battery_mode: false,
          invalid_credential_window: '00:00:00',
          invalid_shutout_period: '00:00:00',
          is_unattended_close_allowed: true,
          is_unattended_open_allowed: true,
          last_status: '2020-07-06T18:55:02.4113062Z',
          last_update: '2020-07-06T13:23:49.1131354Z',
          max_invalid_attempts: 0,
          monitor_only_mode: false,
          number_of_learned_dps_devices: 1,
          online: true,
          open:
           'http://api.myqdevice.com/api/v5/accounts/XXXXXXXXXXX/devices/XXXXXXXXXXX/open',
          passthrough_interval: '00:00:00',
          report_ajar: false,
          report_forced: false,
          rex_fires_door: false,
          sensor_comm_error: false,
          use_aux_relay: false } },
     { created_date: '2020-03-09T14:20:27.967',
       device_family: 'gateway',
       device_platform: 'myq',
       device_type: 'hub',
       href:
        'http://api.myqdevice.com/api/v5/accounts/XXXXXXXXXXX/devices/XXXXXXXXXXX',
       name: 'Hub',
       serial_number: 'XXXXXXXXXXX',
       state:
        { firmware_version: '3.8',
          homekit_capable: false,
          homekit_enabled: false,
          last_status: '2020-07-06T18:54:41.1119546Z',
          learn:
           'http://api.myqdevice.com/api/v5/accounts/XXXXXXXXXXX/devices/XXXXXXXXXXX/learn',
          learn_mode: false,
          online: true,
          pending_bootload_abandoned: false,
          physical_devices: [Array],
          updated_date: '2020-07-06T18:54:53.3978937Z' } } ] }
hjdhjd commented 4 years ago

Thanks. Give me a bit...

hjdhjd commented 4 years ago

@BindersFullOfWomen and @LampeMW would you mind turning off debugging and showing me what the logs show when you startup? With debugging on, the messages will get lost in the noise. :smile:

BindersFullOfWomen commented 4 years ago

The message that pops up is the first code snippet I posted. It shows up regardless of whether debugging is enabled.

hjdhjd commented 4 years ago

@BindersFullOfWomen there are no other messages from the myQ2 plugin? Looking for all of them. The snippet you first posted is just the exception / error...seeing what else there is. Thanks.

maelstromchanneled commented 4 years ago

For what it's worth, I'm seeing the same error.

Here is the startup log:

<snip>
[7/6/2020, 12:07:39 PM] ---
[7/6/2020, 12:07:39 PM] Loaded plugin: homebridge-myq2@2.1.0
[7/6/2020, 12:07:39 PM] Registering platform 'homebridge-myq2.myQ'
[7/6/2020, 12:07:39 PM] --- 
<snip>
[7/6/2020, 12:07:44 PM] [myQ] Initializing myQ platform... 
[7/6/2020, 12:07:44 PM] [myQ] Debug logging on. Expect a lot of data.
<snip>

Here is my debug log:

[7/6/2020, 12:08:30 PM] [myQ] {
  count: 3,
  href: 'http://api.myqdevice.com/api/v5/accounts/REDACTED/devices',
items: [
  {
    created_date: ‘2018-05-31T05:44:29.837',
    device_family: ‘gateway',
    device_platform: ‘myq',
    device_type: ‘hub',
    href: ‘http://api.myqdevice.com/api/v5/accounts/REDACTED/devices/REDACTED',
      name: 'Garage Door Hub’,
      serial_number: ‘REDACTED',
      state: {
        firmware_version: ‘3.8',
        homekit_capable: false,
        homekit_enabled: false,
        last_status: ‘2020-07-06T18:54:25.065759Z',
        learn: 'http://api.myqdevice.com/api/v5/accounts/REDACTED/devices/REDACTED/learn',
        learn_mode: false,
        online: true,
        pending_bootload_abandoned: false,
        physical_devices: [Array],
        updated_date: ‘2020-07-06T18:54:39.313463Z'
      }
    },
    {
      created_date: ‘2019-05-19T22:44:02.417',
      device_family: ‘garagedoor',
      device_platform: ‘myq',
      device_type: ‘virtualgaragedooropener',
      href: 'http://api.myqdevice.com/api/v5/accounts/REDACTED/devices/REDACTED',
      name: 'Main Garage Door’,
      parent_device: 'http://api.myqdevice.com/api/v5/accounts/REDACTED/devices/REDACTED',
      parent_device_id: ‘REDACTED',
      serial_number: ‘REDACTED',
      state: {
        aux_relay_behavior: ‘None',
        aux_relay_delay: ’00:00:00',
        close: 'http://api.myqdevice.com/api/v5/accounts/REDACTED/devices/REDACTED/close',
        command_channel_report_status: false,
        control_from_browser: false,
        door_ajar_interval: ’00:00:00',
        door_state: ‘closed',
        dps_low_battery_mode: false,
        invalid_credential_window: ’00:00:00',
        invalid_shutout_period: ’00:00:00',
        is_unattended_close_allowed: true,
        is_unattended_open_allowed: true,
        last_status: ‘2020-07-06T19:05:33.9353284Z',
        last_update: ‘2020-07-06T04:34:23.6211838Z',
        max_invalid_attempts: 0,
        monitor_only_mode: false,
        number_of_learned_dps_devices: 1,
        online: true,
        open: 'http://api.myqdevice.com/api/v5/accounts/REDACTED/devices/REDACTED/open',
        passthrough_interval: ’00:00:00',
        report_ajar: false,
        report_forced: false,
        rex_fires_door: false,
      sensor_comm_error: false,
        use_aux_relay: false
      }
    },
    {
      created_date: ‘2020-02-02T21:39:10.683',
      device_family: ‘garagedoor',
      device_platform: ‘myq',
      device_type: ‘virtualgaragedooropener',
      href: 'http://api.myqdevice.com/api/v5/accounts/REDACTED/devices/REDACTED',
      name: 'Side Garage Door’,
      parent_device: 'http://api.myqdevice.com/api/v5/accounts/REDACTED/devices/REDACTED',
      parent_device_id: ‘REDACTED',
      serial_number: ‘REDACTED',
      state: {
        aux_relay_behavior: ‘None',
        aux_relay_delay: ’00:00:00',
        close: 'http://api.myqdevice.com/api/v5/accounts/REDACTED/devices/REDACTED/close',
        command_channel_report_status: false,
        control_from_browser: false,
        door_ajar_interval: ’00:00:00',
        door_state: ‘closed',
        dps_low_battery_mode: false,
        invalid_credential_window: ’00:00:00',
        invalid_shutout_period: ’00:00:00',
        is_unattended_close_allowed: true,
        is_unattended_open_allowed: true,
        last_status: ‘2020-07-06T19:03:27.7722015Z',
        last_update: ‘2020-07-06T02:53:43.2831135Z',
        max_invalid_attempts: 0,
        monitor_only_mode: false,
        number_of_learned_dps_devices: 1,
        online: true,
        open: 'http://api.myqdevice.com/api/v5/accounts/REDACTED/devices/REDACTED/open',
        passthrough_interval: ’00:00:00',
      report_ajar: false,
        report_forced: false,
        rex_fires_door: false,
        sensor_comm_error: false,
        use_aux_relay: false
      }
    }
  ]
}
[7/6/2020, 12:08:30 PM] [myQ] Throttling myQ API call. Using cached data from the past five seconds.

(node:51) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getCharacteristic' of undefined
    at /usr/local/lib/node_modules/homebridge-myq2/dist/index.js:238:21
    at Array.forEach (<anonymous>)
    at myQPlatform.myQUpdateDeviceList (/usr/local/lib/node_modules/homebridge-myq2/src/index.ts:264:22)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at myQPlatform.updateAccessories (/usr/local/lib/node_modules/homebridge-myq2/src/index.ts:423:5)
(node:51) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by
throwing inside of an async function without a catch block, or by rejecting a promise which was not handled
with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
`--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode).
(rejection id: 3)

Here is my config.json snippet:

    {
      "platform": "myQ",
      "email": "REDACTED",
      "password": "REDACTED",
      "debug": true
    }
BindersFullOfWomen commented 4 years ago

@BindersFullOfWomen there are no other messages from the myQ2 plugin? Looking for all of them. The snippet you first posted is just the exception / error...seeing what else there is. Thanks.

Found it.

7/6/2020, 3:42:07 PM] [Home] Successfully connected to the myQ API.
[7/6/2020, 3:42:07 PM] [Home] myQ garagedoor device discovered: Garage Door (serial number: CG0846124DBD, gateway: GW2300171978).
[7/6/2020, 3:42:07 PM] [Home] myQ gateway device discovered: Hub (serial number: GW2300171978).
(node:13664) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getCharacteristic' of undefined
    at myQ.Devices.forEach (C:\Users\XXXXX\AppData\Roaming\npm\node_modules\homebridge-myq2\dist\index.js:238:21)
    at Array.forEach (<anonymous>)
    at myQPlatform.myQUpdateDeviceList (C:\Users\XXXXX\AppData\Roaming\npm\node_modules\homebridge-myq2\src\index.ts:264:22)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:13664) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:13664) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:13664) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getCharacteristic' of undefined
maelstromchanneled commented 4 years ago

Yeah I'm seeing the same:

[7/6/2020, 12:46:32 PM] Homebridge is running on port 51826.
[7/6/2020, 12:46:43 PM] [myQ] Successfully connected to the myQ API.
[7/6/2020, 12:46:43 PM] [myQ] myQ gateway device discovered: Garage Door Hub (serial number: REDACTED).
[7/6/2020, 12:46:43 PM] [myQ] myQ garagedoor device discovered: Main Garage Door (serial number: REDACTED, gateway: REDACTED).
[7/6/2020, 12:46:43 PM] [myQ] myQ garagedoor device discovered: Side Garage Door (serial number: REDACTED, gateway: REDACTED).
(node:50) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getCharacteristic' of undefined
    at /usr/local/lib/node_modules/homebridge-myq2/dist/index.js:238:21
    at Array.forEach (<anonymous>)
    at myQPlatform.myQUpdateDeviceList (/usr/local/lib/node_modules/homebridge-myq2/src/index.ts:264:22)
    at processTicksAndRejections (internal/process/task_queues.js:97:5) 
    at myQPlatform.updateAccessories (/usr/local/lib/node_modules/homebridge-myq2/src/index.ts:423:5)
(node:50) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside
of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the
node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict`
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:50) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections
that are not handled will terminate the Node.js process with a non-zero exit code.
hjdhjd commented 4 years ago

Thanks guys. Looking.

hjdhjd commented 4 years ago

@BindersFullOfWomen @maelstromchanneled can you tell me what the actual devices you guys have are again?

Basically - I’m trying to answer this question: are all the devices you have being discovered by the API correctly?

You’ll note the “XXX device discovered...” lines. Can you cross-reference them with what you actually have physically installed?

maelstromchanneled commented 4 years ago

One MyQ gateway with two sensors (two different doors) for me. When I looked through the logs, the number of gateways and openers looked right to me.

Also, it was working correctly before the API change.

I can compare the serial numbers (maybe?) if that helps? What other information are you seeking?

maelstromchanneled commented 4 years ago

Yeah these lines are correct:

‘’’ [7/6/2020, 12:46:43 PM] [myQ] myQ gateway device discovered: Garage Door Hub (serial number: REDACTED). [7/6/2020, 12:46:43 PM] [myQ] myQ garagedoor device discovered: Main Garage Door (serial number: REDACTED, gateway: REDACTED). [7/6/2020, 12:46:43 PM] [myQ] myQ garagedoor device discovered: Side Garage Door (serial number: REDACTED, gateway: REDACTED). ‘’’

hjdhjd commented 4 years ago

In your logs...are the serial numbers all unique, or do any of them repeat? They should (hopefully) all be unique...it’s a long shot, for sure. :smile:

hjdhjd commented 4 years ago

One more thing to try...can you shutdown homebridge, delete all your cached accessories:

rm -rf ~/.homebridge/accessories (or whatever your homebridge directory is...).

Then restart homebridge. You need to ensure homebridge is shutdown before you execute the above.

BindersFullOfWomen commented 4 years ago

@BindersFullOfWomen @maelstromchanneled can you tell me what the actual devices you guys have are again?

Basically - I’m trying to answer this question: are all the devices you have being discovered by the API correctly?

You’ll note the “XXX device discovered...” lines. Can you cross-reference them with what you actually have physically installed?

Yes. I have one device and it's being discovered just fine.

hjdhjd commented 4 years ago

Can you try installing the beta version I just published...I don’t think this is going to fix anything, but perhaps we can narrow this down further.

npm install -g homebridge-myq2@beta

See if that produces the same errors or not...

maelstromchanneled commented 4 years ago

Just went back and checked the serial numbers. My gateway and two devices all have unique serial numbers, and the gateway serial number is consistently cited with each device. So that part seems correct (no repeats or bad numbers).

I'll shutdown HB, delete the cached accessories, and restart. If that doesn't work, I'll switch to the beta. Shouldn't take more than a few minutes...

maelstromchanneled commented 4 years ago

Deleting cached accessories did not have an effect. All other devices reloaded correctly, but myQ:

[7/6/2020, 3:50:51 PM] [myQ] Successfully connected to the myQ API.
[7/6/2020, 3:50:51 PM] [myQ] myQ gateway device discovered: Garage Door Hub (serial number: XXX).
[7/6/2020, 3:50:51 PM] [myQ] myQ garagedoor device discovered: Main Garage Door (serial number: XXX, gateway: XXX).
[7/6/2020, 3:50:51 PM] [myQ] myQ garagedoor device discovered: Side Garage Door (serial number: XXX, gateway: XXX).
(node:50) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getCharacteristic' of undefined
    at /usr/local/lib/node_modules/homebridge-myq2/dist/index.js:238:21
    at Array.forEach (<anonymous>)
    at myQPlatform.myQUpdateDeviceList (/usr/local/lib/node_modules/homebridge-myq2/src/index.ts:264:22)
    at processTicksAndRejections (internal/process/task_queues.js:97:5) 
    at myQPlatform.updateAccessories (/usr/local/lib/node_modules/homebridge-myq2/src/index.ts:423:5)
(node:50) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside
of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the
node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see
https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:50) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections
that are not handled will terminate the Node.js process with a non-zero exit code.

So, I'll try the beta now

maelstromchanneled commented 4 years ago

No dice:

<snip>
removed 35 packages in 1.276s
+ homebridge-myq2@2.1.3-beta.0
added 35 packages from 81 contributors in 6.081s
<snip>
[7/6/2020, 3:59:09 PM] ---
[7/6/2020, 3:59:09 PM] Loaded plugin: homebridge-myq2@2.1.3-beta.0 
[7/6/2020, 3:59:09 PM] Registering platform 'homebridge-myq2.myQ' 
[7/6/2020, 3:59:09 PM] ---  
<snip>
[7/6/2020, 3:59:14 PM] [myQ] Initializing myQ platform...  
<snip>
[7/6/2020, 3:59:19 PM] Homebridge is running on port 51826.  
[7/6/2020, 3:59:30 PM] [myQ] Successfully connected to the myQ API.   
[7/6/2020, 3:59:30 PM] [myQ] myQ gateway device discovered: Garage Door Hub (serial number: XXX).    
[7/6/2020, 3:59:30 PM] [myQ] myQ garagedoor device discovered: Main Garage Door (serial number: XXX, gateway: XXX).  
[7/6/2020, 3:59:30 PM] [myQ] myQ garagedoor device discovered: Side Garage Door (serial number: XXX, gateway: XXX). 
(node:61) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getCharacteristic' of undefined   
    at /usr/local/lib/node_modules/homebridge-myq2/dist/index.js:242:21    
    at Array.forEach (<anonymous>)   
    at myQPlatform.myQUpdateDeviceList (/usr/local/lib/node_modules/homebridge-myq2/src/index.ts:265:22)   
    at processTicksAndRejections (internal/process/task_queues.js:97:5)  
    at myQPlatform.updateAccessories (/usr/local/lib/node_modules/homebridge-myq2/src/index.ts:424:5)    
(node:61) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside
of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the
node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see
https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) 
(node:61) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections
that are not handled will terminate the Node.js process with a non-zero exit code.     
<snip>
hjdhjd commented 4 years ago

Let’s try this... install:

npm install homebridge-myq2@2.0.13

hjdhjd commented 4 years ago

I want to trace down where this error crept in. That’s the last version before 2.1.0....

maelstromchanneled commented 4 years ago

Yeah, that fixed it:

[7/6/2020, 4:19:45 PM] Homebridge is running on port 51826.   
[7/6/2020, 4:19:56 PM] [myQ] Successfully connected to the myQ API.      
[7/6/2020, 4:19:56 PM] [myQ] myQ gateway device discovered: Garage Door Hub (serial number: XXX).   
[7/6/2020, 4:19:56 PM] [myQ] myQ garagedoor device discovered: Main Garage Door (serial number: XXX, gateway: XXX). 
[7/6/2020, 4:19:56 PM] [myQ] myQ garagedoor device discovered: Side Garage Door (serial number: XXX, gateway: XXX).  
[7/6/2020, 4:19:56 PM] [myQ] Adding myQ garagedoor device: Main Garage Door (serial number: XXX, gateway: XXX) to HomeKit.     
[7/6/2020, 4:19:57 PM] [myQ] Adding myQ garagedoor device: Side Garage Door (serial number: XXX, gateway: XXX) to HomeKit.    
hjdhjd commented 4 years ago

@maelstromchanneled Can confirm that between 2.0.13 and 2.1.0 something broke?

If so...that’s super helpful. If you wouldn’t mind testing for posterity...

maelstromchanneled commented 4 years ago

Ok - no problem. So now I will restart HB and execute these two commands in the startup script?

npm uninstall -g homebridge-myq2
npm install -g homebridge-myq2@2.1.0
hjdhjd commented 4 years ago

Shutdown homebridge.

npm -g uninstall homebridge-myq2
npm -g install homebridge-myq2@2.1.0

Restart homebridge.

maelstromchanneled commented 4 years ago

Ok done. This is what I got:

[7/6/2020, 4:27:34 PM] [myQ] Successfully connected to the myQ API.  
[7/6/2020, 4:27:34 PM] [myQ] myQ gateway device discovered: Garage Door Hub (serial number: XXX). 
[7/6/2020, 4:27:34 PM] [myQ] myQ garagedoor device discovered: Main Garage Door (serial number: YYY, gateway: XXX).  
[7/6/2020, 4:27:34 PM] [myQ] myQ garagedoor device discovered: Side Garage Door (serial number: ZZZ, gateway: XXX). 
HAP Warning: Characteristic xxx-xxx-xxx-xxx-xxx not in required or optional characteristics for
service xxx-xxx-xxx-xxx-xxx. Adding anyway. 
HAP Warning: Characteristic xxx-xxx-xxx-xxx-xxx not in required or optional characteristics for service xxx-xxx-xxx-xxx-xxx. Adding anyway.

Then there was an initial moment where none of the devices in Home App were updating (all red), but that cleared when I changed rooms and now everything appears to be working ..?

Should I try opening and closing the garage door to confirm? What's next for you?

hjdhjd commented 4 years ago

@maelstromchanneled That initial moment is correct and expected behavior. You won’t get the accessories online until they connect to myQ.

What version of homebridge are you running?

Also...the xxx-xxx in this case is key, and is not private information, it’s the key name for the attribute and is a funky-looking string (a UUID) that every attribute in HomeKit has and is not unique to you. Can you share them?

Thanks.

maelstromchanneled commented 4 years ago

Ok no problem. Homebridge v1.1.0.

Now I am getting an error, here is the log:

[7/6/2020, 4:27:34 PM] [myQ] Successfully connected to the myQ API.   
[7/6/2020, 4:27:34 PM] [myQ] myQ gateway device discovered: Garage Door Hub (serial number: XXX).                                                                                                              
[7/6/2020, 4:27:34 PM] [myQ] myQ garagedoor device discovered: Main Garage Door (serial number: YYY, gateway: XXX). 
[7/6/2020, 4:27:34 PM] [myQ] myQ garagedoor device discovered: Side Garage Door (serial number: ZZZ, gateway: XXX). 
HAP Warning: Characteristic 00000079-0000-1000-8000-0026BB765291 not in required or optional characteristics for service 00000041-0000-1000-8000-0026BB765291. Adding anyway.                                           
HAP Warning: Characteristic 00000079-0000-1000-8000-0026BB765291 not in required or optional characteristics for service 00000041-0000-1000-8000-0026BB765291. Adding anyway.                                           
[7/6/2020, 4:33:38 PM] [myQ] Fetch error encountered: FetchError: request to https://api.myqdevice.com/api/v5.1/Accounts/xxx-xxx-xxx-xxx-xxx/Devices?filterOn=true failed, reason: read ECONNRESET 
[7/6/2020, 4:33:38 PM] [myQ] myQ API error: unable to refresh. Will retry later.                                                                                                                                        
hjdhjd commented 4 years ago

Thanks.

hjdhjd commented 4 years ago

Anyone who is having this issue...if you want to be up and running now, install v2.0.13 for now by doing:

npm install homebridge-myq2@2.0.13

I’m working on solving this one.

maelstromchanneled commented 4 years ago

Agreed. I just went out in the garage and asked Siri to ...

  1. ... open the side garage door
  2. ... open the main garage door
  3. ... close the side garage door
  4. ... tell me the status of the main garage door
  5. ... tell me the status of the side garage door
  6. ... close the main garage door

Everything went as expected, and the HB log backs it up:

[7/6/2020, 4:46:32 PM] [myQ] myQ Side Garage Door is opening.                                                                                                                                                           
[7/6/2020, 4:46:48 PM] [myQ] myQ Side Garage Door is open.                                                                                                                                                              
[7/6/2020, 4:46:50 PM] [myQ] myQ Main Garage Door is opening.                                                                                                                                                           
[7/6/2020, 4:47:05 PM] [myQ] myQ Side Garage Door is closing.                                                                                                                                                           
[7/6/2020, 4:47:30 PM] [myQ] myQ Main Garage Door is open.                                                                                                                                                              
[7/6/2020, 4:47:35 PM] [myQ] myQ Side Garage Door is closed.                                                                                                                                                            
[7/6/2020, 4:47:54 PM] [myQ] myQ Main Garage Door is closing.                                                                                                                                                           
[7/6/2020, 4:48:29 PM] [myQ] myQ Main Garage Door is closed.                                                                                                                                                            

Running with npm install -g homebridge-myq2@2.1.0

hjdhjd commented 4 years ago

If you’re on 2.1.0 without an issue...that’s the current release version...so what changed?

maelstromchanneled commented 4 years ago

Maybe doing 2.0.13 changed something along the way? Let me restart HB and extra carefully check the myQ version ...

hjdhjd commented 4 years ago

Thanks.

maelstromchanneled commented 4 years ago

Yeah, I'm on 2.1.0 now... Still initially throws the above HAP warnings, but the openers are showing up in Home ... Not sure, but it appears that

  1. stop HB
  2. uninstalling 2.1.0
  3. force install 2.0.13
  4. start HB
  5. verify openers are in Home
  6. stop HB
  7. uninstall 2.0.13
  8. force install 2.1.0
  9. start HB
  10. verify openers are in Home

Has resolved the issue?