npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

node-myq

v7.0.10

Published

MyQ device controller

Downloads

103

Readme

A module for the Chamberlain / Liftmaster - MyQ Smart Garage Hub

Tested and works on API V4 and API V5!

Light functionality coming soon

Install

npm i --save node-myq

Initilization

const myq = require('node-myq')

const options = {
    autoSetGarageDoorDevice: true, //automatically adds a SINGLE DOOR to the API if true
    autoSetMultipleGarageDoorDevices: false, //automatically adds MULTIPLE DOORS to the API if true
    deviceId || deviceSerialNumber: 213213, //manually set your own single deviceId or serial number. Leave out if auto set single or multiple devices
    smartTokenManagement: true, // allows for significantly increased performance by managing token state
    apiVersion: 5 // Set either 4 or 5. Defaults to 4 if no option provided untill MyQ API V4 is no longer supported
    //deviceId = int
    //deviceSerialNumber = string
}

myq.setCredentials('[email protected]', 'password', options)

Methods

deviceId is an optional overload. Use it if you have multiple devices in your network and wish to call a specific device. If deviceId is not provided, the API will default to the single deviceId that you set using autoSetGarageDoorDevice: true or deviceId: yourDeviceId.

getDevices()

A promise that returns an array of devices detected on the network

//returns array of devices detected on the network

myq.getDevices().then(deviceList => {
    console.log(deviceList)
}).catch(error => {})

//or
const deviceList = await myq.getDevices()

getDoorState(deviceId)

Promise resolves a string of door state on success of the call. Reference the constants below to see the door state output.

//optional overloads
const deviceId = 212121 // used for API V4
const deviceSerialNumber = 'CG0846469ED5'  // used for API V5

myq.getDoorState(deviceId).then(doorState => {
    console.log(doorState)
    //Returns a string of door state. See Return Values at the bottom of the page.
}).catch(error => {})

//or just without the serial / device number if you have an auto set id or set the id / serial yourself
const doorState = await myq.getDoorState()

openDoor(deviceId)

Promise resolves an object from the myQ device on success of call.

//optional overloads
const deviceId = 212121 // used for API V4
const deviceSerialNumber = 'CG0846469ED5'  // used for API V5

myq.openDoor(deviceId).then(data => {
    // Promise resolves on success with a return object from the MyQ device
}).catch(error => {})

//or
await myq.openDoor()

//or just without the serial / device number if you have an auto set id or set the id / serial yourself
const response = await myq.openDoor()

This is an example return object for API V4

{
    UpdatedTime: '1581692278599',
    ReturnCode: '0',
    ErrorMessage: '',
    CorrelationId: '223e24ef-e452-4fda-a027-5570858ab341'
}

closeDoor(deviceId)

Promise resolves an object from the myQ device on success of call.

//optional overloads
const deviceId = 212121 // used for API V4
const deviceSerialNumber = 'CG0846469ED5'  // used for API V5

myq.closeDoor(deviceId).then(data => {
    // Promise resolves on success with a return object from the MyQ device
}).catch(error => {})

//or just without the serial / device number if you have an auto set id or set the id / serial yourself
await myq.closeDoor()

//or just without the serial / device number if you have an auto set id or set the id / serial yourself
const response = await myq.closeDoor()

This is an example return object for API V4

{
    UpdatedTime: '1581692278599',
    ReturnCode: '0',
    ErrorMessage: '',
    CorrelationId: '223e24ef-e452-4fda-a027-5570858ab341'
}

detectDoorStateChange(state, deviceId)

Resolves when door action completes. Use this method once the door starts closing or opening. Rejects after 30 seconds and if the door is still in the same state.

//optional overloads
const deviceId = 212121 // used for API V4
const deviceSerialNumber = 'CG0846469ED5'  // used for API V5

//pass either opened or closed as the state
const desiredState = "closed"
const desiredState = "opened"

//deviceId is an optional overload

myq.detectDoorStateChange(desiredState, deviceId).then(state => {
    console.log('the door is now ' + state)
    // Promise resolves on success
}).catch(error => {})

//or just without the serial / device number if you have an auto set id or set the id / serial yourself
const state = await myq.detectDoorStateChange(desiredState)

console.log('the door is now ' + state)

getAutoAddedDevices()

Returns an array of door or garage door device objects that were automatically added to the API using autoSetMultipleGarageDoorDevices: true

myq.getAutoAddedDevices().then(deviceList => {
    console.log(deviceList)
    // Promise resolves on success
}).catch(error => {})

//or

const deviceList = await myq.getAutoAddedDevices()

Notes

API V5 funtionality has been added. When using API V5, you can pass in a device serial number in place of a deviceId used in API V4 to communicate with a single device. The getDevices call for V5 returns a different object than V4.

Here is the V4 return object for Get Devices

{
    Devices: [{
            MyQDeviceId: 1801232,
            ParentMyQDeviceId: 11751349,
            MyQDeviceTypeId: 7,
            MyQDeviceTypeName: 'VGDO',
            RegistrationDateTime: '2020-02-17T15:11:41.7911418Z',
            SerialNumber: 'CG0846239ED5',
            UserName: '[email protected]',
            UserCountryId: 0,
            Attributes: [Array],
            ChildrenMyQDeviceIds: '',
            UpdatedBy: 'System',
            UpdatedDate: '2020-02-17T15:11:41.7911418Z',
            ConnectServerDeviceId: '180912312'
        },
        {
            MyQDeviceId: 11751349,
            MyQDeviceTypeId: 1,
            MyQDeviceTypeName: '',
            RegistrationDateTime: '2020-02-17T15:29:37.9694407Z',
            SerialNumber: 'GW23032C61',
            UserName: '[email protected]',
            UserCountryId: 0,
            Attributes: [Array],
            ChildrenMyQDeviceIds: '12221232',
            UpdatedBy: 'System',
            UpdatedDate: '2020-02-17T15:29:37.9694407Z',
            ConnectServerDeviceId: '1172399'
        }
    ],
    ReturnCode: '0',
    ErrorMessage: '',
    CorrelationId: 'ed8e1eb8-397a-4f58-af79-d1c53d8c3cc5'
}

Here is the V5 return object for Get Devices

{
    href: 'http://api.myqdevice.com/api/v5/accounts/79a4960d-e449-4c80-85f7-e28dasdsa203d31/devices',
    count: 2,
    items: [{
            href: 'http://api.myqdevice.com/api/v5/accounts/79a4960d-e449-4c80-85f7-e281asddas03d31/devices/CG0846469ED5',
            serial_number: 'CG0846469ED5',
            device_family: 'garagedoor',
            device_platform: 'myq',
            device_type: 'virtualgaragedooropener',
            name: 'Garage Door',
            parent_device: 'http://api.myqdevice.com/api/v5/accounts/79a4960d-e449-4c80-85f7-e281asddas03d31/devices/GW2300201C61',
            parent_device_id: 'GW2300201C61',
            created_date: '2020-02-01T16:02:20.773',
            state: [Object]
        },
        {
            href: 'http://api.myqdevice.com/api/v5/accounts/79a4960d-e449-4c80-85f7-e281asddas03d31/devices/GW2300201C61',
            serial_number: 'GW2300201C61',
            device_family: 'gateway',
            device_platform: 'myq',
            device_type: 'hub',
            name: 'Garage Door',
            created_date: '2020-02-01T16:01:26.14',
            state: [Object]
        }
    ]
}

The state object is where you will find all the information you need about your device for V5. Here is the example.

{
    dps_low_battery_mode: false,
    monitor_only_mode: false,
    number_of_learned_dps_devices: 1,
    sensor_comm_error: false,
    door_state: 'closed',
    open: 'http://api.myqdevice.com/api/v5/accounts/79a4960d-e449-4c80-85f7-e12331/devices/CG084644125/open',
    close: 'http://api.myqdevice.com/api/v5/accounts/79a4960d-e449-4c80-85f7-2131d31/devices/CG0421ED5/close',
    last_update: '2020-02-17T15:11:41.7911418Z',
    passthrough_interval: '00:00:00',
    door_ajar_interval: '00:00:00',
    invalid_credential_window: '00:00:00',
    invalid_shutout_period: '00:00:00',
    is_unattended_open_allowed: true,
    is_unattended_close_allowed: true,
    aux_relay_delay: '00:00:00',
    use_aux_relay: false,
    aux_relay_behavior: 'None',
    rex_fires_door: false,
    command_channel_report_status: false,
    control_from_browser: false,
    report_forced: false,
    report_ajar: false,
    max_invalid_attempts: 0,
    online: true,
    last_status: '2020-02-17T15:21:56.6413241Z'
}

Enjoy API V5 and please report any bugs or submit a pull request if you have something to improve!

Constants

| Door State | Description | |------------|-----------------------| | 1 | NA | | 2 | closed | | 3 | stopped in the middle | | 4 | going up | | 5 | going down | | 9 | opened |

Author

Cole Stasney ([email protected])

License

Apache-2.0