package module
v0.0.0-...-45e07df Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2023 License: MIT Imports: 15 Imported by: 0




myq is a Go package and command-line tool providing access to the Liftmaster / Chamberlain MyQ API.

I forked this straight from and fixed the Sept 2023 issues that were causing API calls to fail becuase of the missing user-agent.

With the MyQ API you can get a list of devices and open and close garage doors and gates.

Command-line tool

The myq tool can be installed with:

go install

Run myq by itself to see full usage information.

To list devices:

myq -username <username> -password <password> devices

To open a door:

myq -username <username> -password <password> open <device ID>

To close a door:

myq -username <username> -password <password> open <device ID>

Usernames and passwords can also be provided through the environment variables MYQ_USERNAME and MYQ_PASSWORD.

MyQ protocol

David Pfeffer's MyQ API reference on Apiary was a helpful reference.

David also has an implementation in Ruby:

ArrayLab has a Python implementation:

J. Nunn has a Python implementation that ties in with Amazon Alexa:

HJD has a JavaScript implementation:


Issues and pull requests are welcome. When filing a PR, please make sure the code has been run through gofmt.


Copyright 2018 Joe Shaw

myq is licensed under the MIT License. See the LICENSE file for details.




View Source
const (
	ActionClose = "close"
	ActionOpen  = "open"

	StateUnknown = "unknown"
	StateOpen    = "open"
	StateClosed  = "closed"
	StateStopped = "stopped"


View Source
var (
	// Debug indiciates whether to log HTTP responses to stderr
	Debug = false

	// ErrNotLoggedIn is returned whenever an operation is run the
	// user has not logged in
	ErrNotLoggedIn = errors.New("not logged in")


This section is empty.


type Account

type Account struct {
	ID   string `json:"id"`
	Name string `json:"name"`

type Device

type Device struct {
	Account      *Account
	SerialNumber string
	Type         string
	Name         string
	DoorState    string

Device defines a MyQ device

type Session

type Session struct {
	Username string
	Password string
	// contains filtered or unexported fields

Session represents an authenticated session to the MyQ service.

func (*Session) DeviceState

func (s *Session) DeviceState(serialNumber string) (string, error)

DeviceState returns the device state (open, closed, etc.) for the provided device serial number

func (*Session) Devices

func (s *Session) Devices() ([]Device, error)

Devices returns the list of MyQ devices

func (*Session) Login

func (s *Session) Login() error

Login establishes an authenticated Session with the MyQ service

func (*Session) SetDoorState

func (s *Session) SetDoorState(serialNumber string, action string) error

SetDoorState sets the target door state (open or closed) for the provided device serial number


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL