Skip to content

A Kotlin myQ API wrapper for Liftmaster/Chamberlain devices.

Notifications You must be signed in to change notification settings

rushiiMachine/myq

Repository files navigation

myQ Views JitPack

A Kotlin library for using the myQ API to interact with Liftmaster/Chamberlain devices.

Dependency

repositories {
	maven("https://jitpack.io")
}

dependencies {
	implementation("com.github.DiamondMiner88:myq:1.0.1")
}

Usage

MyQ().apply {
	login("email@example.com", "password")
	// OR
	login("[refresh_token]")

	// Save this if using multiple times to shorten login procces
	getRefreshToken()

	// Cache this during runtime only
	val devices = fetchDevices()
	device.forEach {
		println("${it.serial} ${it.deviceFamily}: ${it.name}")
	}

	val goDevice = device.find { it.deviceFamily == "garagedoor" }
	setGarageDoorState(goDevice, open = true)

	// Same thing
	setLampState(lampDevice, isOn = true)
}

Limitations

  • Not the entire API is implemented
  • Locks are not supported (yet)
  • Device states are just parsed into a JsonObject for now, since I do not have the full data for all types of devices.
    • If you have an account with locks/lamps registered on it, I would appreciate it if you would let me test with it! (@email on user page)