Skip to content
This repository has been archived by the owner on May 30, 2020. It is now read-only.

ercpe/pymax

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pymax

Build Status Coverage Status

Basics

Requirements

Supported Python versions: Python 2.7.9+, 3.3, 3.4, 3.5, 3.6 (nightly) and PyPy 2.5.0.

Installation

If you are on Gentoo Linux, run

emerge dev-python/pymax --ask

otherwise use pip

pip install pymax

Usage

Discovery

To find any cube in your network:

from pymax.cube import Discovery

response = Discovery().discover()
print(response)

To find a specific cube in your network:

from pymax.cube import Discovery
response = Discovery().discover(cube_serial=u'LEQ1154727', discovery_type=Discovery.DISCOVERY_TYPE_NETWORK_CONFIG)
print(response)
>>> LEQ1154727: IP: 10.10.10.153, Netmask: 255.255.255.0, Gateway: 10.10.10.1, DNS1: 10.10.10.1, DNS2: 0.0.0.0

Connecting

from pymax.cube import Cube, Connection

cube = Cube('192.168.1.123')
# or
cube = Cube('192.168.1.123', 62910)
# or
cube = Cube(address='192.168.1.123', port=62910)
# or
cube = Cube(Connection(('192.168.1.123', 62910))

try:
    cube.connect()
    
    # fun code here
finally:
    cube.disconnect()

The Cube object implements a context manager, so it's easier to write:

from pymax.cube import Cube

with Cube('192.168.1.123') as cube:
    # fun code here

or, together with a discovery query:

response = Discovery().discover(cube_serial=u'LEQ1154727', discovery_type=Discovery.DISCOVERY_TYPE_NETWORK_CONFIG)
with Cube(response.ip_address) as cube:
	print(cube)

Basic Usage

with Cube(response.ip_address) as cube:
	for room in cube.rooms:
		print("%s:" % room.name)
		for device in room.devices:
			print("  %s (%s), serial: %s" % (device.name, device.type, device.serial))

Protocol

Resources:

License

See LICENSE.txt