def connect(self): if self.__max_cube_connection is None: try: self.__max_cube_connection = MaxCubeConnection(self.cube_ip_adress, 62910) self.logger.info('Connecting to Max!Cube') except Exception as e: self.logger.error('Problem opening connection')
def setup(hass, config): """Establish connection to MAX! Cube.""" from maxcube.connection import MaxCubeConnection from maxcube.cube import MaxCube if DATA_KEY not in hass.data: hass.data[DATA_KEY] = {} connection_failed = 0 gateways = config[DOMAIN][CONF_GATEWAYS] for gateway in gateways: host = gateway[CONF_HOST] port = gateway[CONF_PORT] try: cube = MaxCube(MaxCubeConnection(host, port)) hass.data[DATA_KEY][host] = MaxCubeHandle(cube) except timeout as ex: _LOGGER.error("Unable to connect to Max!Cube gateway: %s", str(ex)) hass.components.persistent_notification.create( 'Error: {}<br />' 'You will need to restart Home Assistant after fixing.' ''.format(ex), title=NOTIFICATION_TITLE, notification_id=NOTIFICATION_ID) connection_failed += 1 if connection_failed >= len(gateways): return False load_platform(hass, 'climate', DOMAIN) load_platform(hass, 'binary_sensor', DOMAIN) return True
def setup(hass, config): """Establish connection to MAX! Cube.""" from maxcube.connection import MaxCubeConnection from maxcube.cube import MaxCube # Read Config host = config.get(DOMAIN).get(CONF_HOST) port = config.get(DOMAIN).get(CONF_PORT) # Assign Cube Handle to global variable try: cube = MaxCube(MaxCubeConnection(host, port)) except timeout: _LOGGER.error("Connection to Max!Cube could not be established") cube = None return False hass.data[MAXCUBE_HANDLE] = MaxCubeHandle(cube) # Load Climate (for Thermostats) load_platform(hass, 'climate', DOMAIN) # Load BinarySensor (for Window Shutter) load_platform(hass, 'binary_sensor', DOMAIN) # Initialization successfull return True
def setup(hass, config): """Establish connection to MAX! Cube.""" if DATA_KEY not in hass.data: hass.data[DATA_KEY] = {} connection_failed = 0 gateways = config[DOMAIN][CONF_GATEWAYS] for gateway in gateways: host = gateway[CONF_HOST] port = gateway[CONF_PORT] scan_interval = gateway[CONF_SCAN_INTERVAL].total_seconds() try: cube = MaxCube(MaxCubeConnection(host, port)) hass.data[DATA_KEY][host] = MaxCubeHandle(cube, scan_interval) except timeout as ex: _LOGGER.error("Unable to connect to Max!Cube gateway: %s", str(ex)) hass.components.persistent_notification.create( "Error: {}<br />" "You will need to restart Home Assistant after fixing." "".format(ex), title=NOTIFICATION_TITLE, notification_id=NOTIFICATION_ID, ) connection_failed += 1 if connection_failed >= len(gateways): return False load_platform(hass, "climate", DOMAIN, {}, config) load_platform(hass, "binary_sensor", DOMAIN, {}, config) return True
def onStart(self): # Set heartbeat self.skipbeats=int(Parameters["Mode5"])/30 self.beats=self.skipbeats Domoticz.Heartbeat(30) # Set debugging if Parameters["Mode6"]=="True": Domoticz.Debugging(2) Domoticz.Debug("Debugging mode activated") # Read Cube for intialization of devices Domoticz.Debug("Reading e-Q3 MAX! devices from Cube...") try: cube = MaxCube(MaxCubeConnection(Parameters["Address"], int(Parameters["Port"]))) except: Domoticz.Error("Error connecting to Cube. Other running MAX! programs may block the communication!") return # Check which rooms have a wall mounterd thermostat max_room = 0 for room in cube.rooms: if room.id > max_room: max_room = room.id Domoticz.Debug("Number of rooms found: " + str((len(cube.rooms))) + " (highest number: " + str(max_room) + ")") self.RoomHasThermostat=[False] * (max_room+1) for EQ3device in cube.devices: if cube.is_wallthermostat(EQ3device): self.RoomHasThermostat[EQ3device.room_id] = True Domoticz.Debug("Room " + str(EQ3device.room_id) + " (" + cube.room_by_id(EQ3device.room_id).name + ") has a thermostat") # Create or delete devices if necessary for EQ3device in cube.devices: if cube.is_thermostat(EQ3device): self.CheckDevice(EQ3device.name, EQ3device.rf_address, "Valve") if not self.RoomHasThermostat[EQ3device.room_id]: self.CheckDevice(EQ3device.name, EQ3device.rf_address, "Thermostat") self.CheckDevice(EQ3device.name, EQ3device.rf_address, "Temperature") self.CheckDevice(EQ3device.name, EQ3device.rf_address, "Mode") elif cube.is_wallthermostat(EQ3device): self.CheckDevice(EQ3device.name, EQ3device.rf_address, "Thermostat") self.CheckDevice(EQ3device.name, EQ3device.rf_address, "Temperature") self.CheckDevice(EQ3device.name, EQ3device.rf_address, "Mode") elif cube.is_windowshutter(EQ3device): self.CheckDevice(EQ3device.name, EQ3device.rf_address, "Contact") # Create or delete heat demand switch if necessary if Parameters["Mode3"] == "True" and 255 not in Devices: Domoticz.Device(Name="Heat demand", Unit=255, TypeName="Switch", Image=9, Used=1).Create() if 255 not in Devices: Domoticz.Error("Heat demand switch could not be created. Is 'Accept new Hardware Devices' enabled under Settings?") else: Domoticz.Log("Created device '" + Parameters["Name"] + " - Heat demand'") Devices[255].Update(nValue=0, sValue="Off") elif Parameters["Mode3"] == "False" and 255 in Devices: Devices[255].Delete() Domoticz.Log("Deleted heat demand switch")
def discover(self): try: self.cube = MaxCube(MaxCubeConnection(self.address, self.port)) except socket.timeout: logging.error('Could not connect to MAX! cube when setting up the bridge. ' 'Make sure nothing else is connected to the MAX! cube at start up and ' 'try again.') for device in self.cube.devices: if device.type != MAX_THERMOSTAT: logging.info('Discovered non-thermostat') continue self.add_accessory(Thermostat(self.cube, device, self.driver))
def onCommand(self, Unit, Command, Level, Hue): # Update commands for thermostats if Devices[Unit].Type == 242 and Devices[Unit].sValue != str(Level): Domoticz.Log("Setpoint changed for " + Devices[Unit].Name + ". New setpoint: " + str(Level)) try: cube = MaxCube(MaxCubeConnection(Parameters["Address"], int(Parameters["Port"]))) except: Domoticz.Error("Error connecting to Cube. Other running MAX! programs may block the communication!") return for EQ3device in cube.devices: if Devices[Unit].DeviceID == EQ3device.rf_address: cube.set_target_temperature(EQ3device, Level) Devices[Unit].Update(nValue=0, sValue=str(Level)) Devices[Unit].Refresh() # Update commands for mode switches if Devices[Unit].Type == 244 and Devices[Unit].SubType == 62 and Devices[Unit].sValue != str(Level): if Level == 00: mode = 0 mode_text = "Auto" elif Level == 10: mode = 1 mode_text = "Manual" elif Level == 20: mode = 2 mode_text = "Vacation" elif Level == 30: mode = 3 mode_text = "Boost" Domoticz.Log("Mode changed for " + Devices[Unit].Name + ". New mode: " + mode_text) try: cube = MaxCube(MaxCubeConnection(Parameters["Address"], int(Parameters["Port"]))) except: Domoticz.Error("Error connecting to Cube. Other running MAX! programs may block the communication!") return for EQ3device in cube.devices: if Devices[Unit].DeviceID == EQ3device.rf_address: cube.set_mode(EQ3device, mode) Devices[Unit].Update(nValue=0, sValue=str(Level)) Devices[Unit].Refresh()
def onHeartbeat(self): #Cancel the rest of this function if this heartbeat needs to be skipped if self.beats < self.skipbeats: Domoticz.Debug("Skipping heartbeat: " + str(self.beats)) self.beats += 1 return self.beats=1 self.HeatDemand = 0 # Read data from Cube Domoticz.Debug("Reading e-Q3 MAX! devices from Cube...") try: cube = MaxCube(MaxCubeConnection(Parameters["Address"], int(Parameters["Port"]))) except: Domoticz.Error("Error connecting to Cube. Other running MAX! programs may block the communication!") return # Update devices in Domoticz for EQ3device in cube.devices: Domoticz.Debug("Checking device '" + EQ3device.name + "' in room " + str(EQ3device.room_id)) if cube.is_thermostat(EQ3device): # Check if valve requires heat if EQ3device.valve_position > int(Parameters["Mode4"]): self.HeatDemand += 1 # Update Domoticz devices for radiator valves self.UpdateDevice(EQ3device, "Valve") if not self.RoomHasThermostat[EQ3device.room_id]: self.UpdateDevice(EQ3device, "Thermostat") self.UpdateDevice(EQ3device, "Temperature") self.UpdateDevice(EQ3device, "Mode") elif cube.is_wallthermostat(EQ3device): # Update Domoticz devices for wall thermostats self.UpdateDevice(EQ3device, "Thermostat") self.UpdateDevice(EQ3device, "Temperature") self.UpdateDevice(EQ3device, "Mode") elif cube.is_windowshutter(EQ3device): # Look up & update Domoticz device for contact switches self.UpdateDevice(EQ3device, "Contact") # Update heat demand switch if necessary Domoticz.Debug(str(self.HeatDemand) + " valves require heat") if self.HeatDemand > 0 and Parameters["Mode3"] == "True" and 255 in Devices and Devices[255].sValue == "Off": Devices[255].Update(nValue=1, sValue="On") Domoticz.Log("Heat demand switch turned on") elif self.HeatDemand == 0 and Parameters["Mode3"] == "True" and 255 in Devices and Devices[255].sValue == "On": Devices[255].Update(nValue=0, sValue="Off") Domoticz.Log("Heat demand switch turned off")
def __init__(self, address, port): # connect to the cube self.cube = MaxCube(MaxCubeConnection(address, port)) # setup the output mode on all the pins wiringpi.wiringPiSetup() wiringpi.pinMode(PIN1, 1) wiringpi.pinMode(PIN2, 1) wiringpi.pinMode(PIN3, 1) # pin_status dict contains the current status of the output pins # status 0 means that the pump is operating normally (turned on) # status 1 means that the pump is turned off (1 on the GPIO pin opens the relay) self.pin_status = {PIN1: 0, PIN2: 0, PIN3: 0} # map apartment IDs to the output pins self.pin_mapping = {"10": PIN1, "11": PIN2}
def setup(hass, config): """Establish connection to MAX! Cube.""" from maxcube.connection import MaxCubeConnection from maxcube.cube import MaxCube host = config.get(DOMAIN).get(CONF_HOST) port = config.get(DOMAIN).get(CONF_PORT) try: cube = MaxCube(MaxCubeConnection(host, port)) except timeout: _LOGGER.error("Connection to Max!Cube could not be established") cube = None return False hass.data[MAXCUBE_HANDLE] = MaxCubeHandle(cube) load_platform(hass, 'climate', DOMAIN) load_platform(hass, 'binary_sensor', DOMAIN) return True
def check_maxdevices(app): if not serverIP: return # only check every 15 minutes global minuteCounter minuteCounter = minuteCounter + 1 if minuteCounter > 15: minuteCounter = 0 if minuteCounter != 0: return try: cube = MaxCube(MaxCubeConnection(serverIP, 62910)) except socket.timeout: print "MAX: Timeout..." return with app.app_context(): for device in cube.devices: if device.linkStatusError != 0: statusOk = False else: statusOk = True record = Hosts.query.filter_by(fqdn=device.name).first() if record: # update if MAX! device already exists record.status = statusOk record.last_checked = datetime.utcnow() else: # otherwise create a new entry host = Hosts(fqdn=device.name, friendly_name=None, status=statusOk, last_checked=datetime.utcnow(), type='MAX', idle_duration=60) db.session.add(host) db.session.commit()
def Connect(self): if not cBaseInterFaceSettings.Connect(self): return False if self.aInterFaceIniSettings.uHost == '': return False try: if self.oDevice is None: # self.oDevice = Cube(address=self.aInterFaceIniSettings.uHost, port=ToInt(self.aInterFaceIniSettings.uPort)) self.oDevice = MaxCube( MaxCubeConnection( host=self.aInterFaceIniSettings.uHost, port=ToInt(self.aInterFaceIniSettings.uPort))) # self.oDevice.connect() self.oInterFace.oInterFaceConfig.WriteDefinitionConfigPar( uSectionName=self.uSection, uVarName=u'OldDiscoveredIP', uVarValue=self.aInterFaceIniSettings.uHost) self.bIsConnected = True return self.bIsConnected except Exception as e: if hasattr(e, "errno"): if e.errno == 10051: self.bOnError = True self.ShowWarning(u'Cannot connect (No Network):' + self.aInterFaceIniSettings.uHost + ':' + self.aInterFaceIniSettings.uPort) return False self.ShowError( u'Cannot connect:' + self.aInterFaceIniSettings.uHost + ':' + self.aInterFaceIniSettings.uPort, e) self.bOnError = True return False
class MaxWorker(multiprocessing.Process): def __init__(self, messageQ, commandQ, config): self.logger = logging.getLogger('Max!-MQTT.MaxWorker') self.logger.info("Starting...") multiprocessing.Process.__init__(self) self.__messageQ = messageQ self.__commandQ = commandQ self.topology = {} self.desired_temperatures = {} self.load_topology() self.__max_cube_connection = None self.cube_ip_adress = config['max_cube_ip_adress'] self.topology_refresh_period = config['max_topology_refresh_interval'] self.mqtt_update_period = config['max_mqtt_update_interval'] self.cube_duty_cycle_reset_interval = config['max_cube_duty_cycle_reset_interval'] self.enable_sanity_check = config['max_perform_sanity_check'] self.topology_last_refresh = 0 self.mqtt_last_refresh = 0 self.cube_duty_cycle = 0 self.cube_duty_cycle_reset = 0 def update_timer_elapsed(self): if time.time() > (self.mqtt_last_refresh + self.mqtt_update_period): return True else: return False def load_topology(self): try: with open('topology.json') as json_data: d = json.load(json_data) self.topology = d self.logger.info("topology initial load suceeded") except Exception as e: self.logger.error("Topology initial load failed") def refresh_topology(self): time.sleep(0.01) self.logger.debug('Starting topology refresh') try: self.connect() cube = MaxCube(self.__max_cube_connection) #TODO report cube values to the broker # self.__messageQ.put(self.prepare_output('cube', 'free_mem_slots', cube.free_mem_slots)) # self.__messageQ.put(self.prepare_output('cube', 'duty_cycle', cube.duty_cycle)) for device in cube.devices: device_id = self.update_device(device) if device.type in (MAX_THERMOSTAT, MAX_THERMOSTAT_PLUS) \ and self.enable_sanity_check \ and (device_id in self.desired_temperatures) \ and (self.desired_temperatures[device_id] != device.target_temperature): try: self.logger.info("Correcting temperature for device :%s (%s/%s) from:%s to:%s" % ( device_id, device.room_name, device.name, device.target_temperature, self.desired_temperatures[device_id])) cube.set_target_temperature(device, self.desired_temperatures[device_id]) self.logger.info("Command result:%s" % cube.command_result) if cube.command_success: self.__messageQ.put(self.prepare_output( device_id, 'target_temperature', self.topology[device_id]['target_temperature'])) self.__messageQ.put(self.prepare_output( 'cube', 'free_mem_slots', cube.free_mem_slots)) self.__messageQ.put(self.prepare_output('' 'cube', 'duty_cycle', cube.duty_cycle)) self.cube_duty_cycle = cube.duty_cycle self.cube_duty_cycle_reset = time.time() except Exception as e: self.logger.error("Set error:%s" % (format(e))) except Exception as e: self.logger.error(format(e)) self.logger.debug('Finished topology refresh') if self.update_timer_elapsed(): self.mqtt_last_refresh = time.time() self.dump_topology() return (True) def update_device(self, device): device_id = device.serial if not device_id in self.topology: self.topology[device_id] = {} self.topology[device_id]['rf_address'] = device.rf_address self.topology[device_id]['name'] = device.name self.topology[device_id]['room_id'] = device.room_id self.topology[device_id]['room_name'] = device.room_name self.topology[device_id]['type'] = device.device_type_name() self.topology[device_id]['serial'] = device.serial self.update_device_metric(device, 'link_ok') self.update_device_metric(device, 'battery_ok') # metrics available only for specific device types if device.type in (MAX_THERMOSTAT, MAX_THERMOSTAT_PLUS): self.topology[device_id]['mode'] = device.device_mode_name() if device.actual_temperature: self.update_device_metric(device, 'actual_temperature') self.update_device_metric(device, 'target_temperature') self.update_device_metric(device, 'valve_position') # send data to MQTT self.logger.debug("Refreshing data in MQTT for device :%s (%s/%s)" % (device_id, device.room_name, device.name)) self.__messageQ.put(self.prepare_output( device_id, 'actual_temperature', self.topology[device_id].get('actual_temperature', None))) self.__messageQ.put(self.prepare_output( device_id, 'target_temperature', self.topology[device_id]['target_temperature'])) self.__messageQ.put(self.prepare_output( device_id, 'link_ok', self.topology[device_id]['link_ok'])) self.__messageQ.put(self.prepare_output( device_id, 'battery_ok', self.topology[device_id]['battery_ok'])) self.__messageQ.put(self.prepare_output( device_id, 'valve_position', self.topology[device_id]['valve_position'])) self.__messageQ.put(self.prepare_output( device_id, 'mode', self.topology[device_id]['mode'])) return device_id def dump_topology(self): try: with open('topology.json', 'w') as outfile: json.dump(self.topology, outfile, ensure_ascii=False) except Exception as e: self.logger.error(format(e)) def update_device_metric(self, device, param): device_id = device.serial try: if self.topology[device_id].get(param, None) != device.__dict__[param]: self.topology[device_id][param] = device.__dict__[param] self.__messageQ.put(self.prepare_output(device_id, param, self.topology[device_id].get(param, None))) except Exception as e: self.logger.error("problem while udating param %s in device %s" % (param, device_id)) def prepare_output(self, device_id, param_name, param_value): out = { 'method': 'publish', 'deviceId': device_id, 'param': param_name, 'payload': param_value, 'qos': 1, 'timestamp': time.time() } return out def connect(self): if self.__max_cube_connection is None: try: self.__max_cube_connection = MaxCubeConnection(self.cube_ip_adress, 62910) self.logger.info('Connecting to Max!Cube') except Exception as e: self.logger.error('Problem opening connection') def close(self): if not self.__max_cube_connection is None: try: self.__max_cube_connection.disconnect() except: self.logger.error('Problem closing connection') self.__max_cube_connection = None self.logger.debug('Connection to Max!Cube closed') def set_temperature(self, cube, device_id, target_temperature): device = self.topology[device_id] self.desired_temperatures[device_id] = float(target_temperature) if float(device['target_temperature']) != float(target_temperature): rf_id = device['rf_address'] try: self.logger.debug("Setting temperature for %s (%s/%s) to:%s" % (device_id, device['room_name'], device['name'], target_temperature)) cube.set_target_temperature(cube.device_by_rf(rf_id), float(target_temperature)) self.logger.info("Command result:%s" % (cube.command_result)) if cube.command_success: self.update_cube_stats(cube) self.__messageQ.put(self.prepare_output( device_id, 'target_temperature', target_temperature)) except Exception as ex: self.logger.error("Send error:%s" % (format(ex))) return def update_cube_stats(self, cube): self.__messageQ.put(self.prepare_output( 'cube', 'free_mem_slots', cube.free_mem_slots)) self.__messageQ.put(self.prepare_output( 'cube', 'duty_cycle', cube.duty_cycle)) def set_mode(self, cube,device_id, target_mode): modes={'AUTO':0, 'MANUAL':1, 'VACATION':2, 'BOOST':3} device = self.topology[device_id] if device['mode'] != target_mode: rf_id = device['rf_address'] try: self.logger.debug("Setting mode for %s (%s/%s) to:%s" % (device_id, device['room_name'], device['name'], target_mode)) cube.set_mode(cube.device_by_rf(rf_id), modes[target_mode]) self.logger.info("Command result:%s" % (cube.command_result)) if cube.command_success: self.__messageQ.put(self.prepare_output( 'cube', 'free_mem_slots', cube.free_mem_slots)) self.__messageQ.put(self.prepare_output( 'cube', 'duty_cycle', cube.duty_cycle)) self.__messageQ.put(self.prepare_output( device_id, 'mode', target_mode)) except Exception as ex: self.logger.error("Send error:%s" % (format(ex))) return def run(self): self.refresh_topology() self.topology_last_refresh = time.time() while True: time.sleep(0.01) # resetting internal duty cycle metric if time.time() > (self.cube_duty_cycle_reset + self.cube_duty_cycle_reset_interval): self.cube_duty_cycle = 0 self.cube_duty_cycle_reset = time.time() self.__messageQ.put(self.prepare_output( 'cube', 'duty_cycle', self.cube_duty_cycle)) # processing incoming data if not self.__commandQ.empty(): try: self.connect() cube = MaxCube(self.__max_cube_connection) while not self.__commandQ.empty(): task = self.__commandQ.get() if task['method'] == 'command': if task['param'] == 'target_temperature': self.set_temperature(cube,task['deviceId'],task['payload']) elif task['param'] == 'mode': self.set_mode(cube,task['deviceId'],task['payload']) self.logger.debug("Executing command:%s" % (task)) except Exception as e: self.logger.error(format(e)) # refreshing topology if self.update_timer_elapsed(): self.refresh_topology() self.topology_last_refresh = time.time() self.close()
from maxcube.cube import MaxCube from maxcube.connection import MaxCubeConnection cube = MaxCube(MaxCubeConnection('192.168.0.20', 62910)) for device in cube.devices: print(device.name) print(device.actual_temperature) print(device.target_temperature) cube.set_target_temperature(device, 18) class MaxcubeMQTT:
import argparse import sys from maxcube.connection import MaxCubeConnection from maxcube.cube import MaxCube if __name__ == '__main__': parser = argparse.ArgumentParser( description='Set or dump thermostat programmes') parser.add_argument('--host', required=True) parser.add_argument('--port', required=True, type=int) parser.add_argument('cmd', choices=['load', 'dump']) args = parser.parse_args() cube = MaxCube(MaxCubeConnection(args.host, args.port)) if args.cmd == 'load': cube.set_programmes_from_config(sys.stdin) elif args.cmd == 'dump': print(cube.devices_as_json())
print(i['Name'] + " has a idx " + i['idx']) domoticz_props[i['Name']] = [i['idx'], i['LastUpdate'], i['Data']] #searching for -Sens url = "http://" + DOMOTICZ_IP + ":" + DOMOTICZ_PORT + "/json.htm?type=devices&filter=temp&used=true&order=Name" response = urllib.urlopen(url) data = json.loads(response.read()) for i in data['result']: if i['Name'][-5:] == "-Sens": #print (i['Name'] + " has a idx " + i['idx'] + " last updated " + i['LastUpdate']) domoticz_props[i['Name']] = [i['idx'], i['LastUpdate'], i['Data']] cube = MaxCube(MaxCubeConnection(IP_CUBE, PORT_CUBE)) for device in cube.devices: if device.type != MAX_THERMOSTAT: print("Not a thermostat ommiting this device") else: print("Updating Termostat: " + device.name + 'Read valve open: ' + str(device.valve_position) + ' Read temperature: ' + str(device.actual_temperature)) #updating domoticz with the read value search_name = device.name[0:-5].encode('ascii', 'ignore') url = "http://" + DOMOTICZ_IP + ":" + DOMOTICZ_PORT + "/json.htm?type=command¶m=udevice&idx=" + domoticz_props[ search_name + '-Rad'][0] + "&nvalue=0&svalue=" + str( device.valve_position) response = urllib.urlopen(url) if str(device.actual_temperature) != "None":
#!/usr/bin/python from maxcube.cube import MaxCube from maxcube.connection import MaxCubeConnection from maxcube.device import \ MAX_THERMOSTAT, \ MAX_THERMOSTAT_PLUS, \ MAX_WINDOW_SHUTTER, \ MAX_WALL_THERMOSTAT, \ MAX_DEVICE_MODE_AUTOMATIC, \ MAX_DEVICE_MODE_MANUAL, \ MAX_DEVICE_MODE_VACATION, \ MAX_DEVICE_MODE_BOOST import logging cube = MaxCube(MaxCubeConnection('192.168.XXX.XXX', 62910)) for room in cube.rooms: print("Room: " + room.name) for device in cube.devices_by_room(room): print("Device: " + device.name) print("") for device in cube.devices: if device.type == MAX_THERMOSTAT: type = "MAX_THERMOSTAT" elif device.type == MAX_THERMOSTAT_PLUS: type = "MAX_THERMOSTAT_PLUS" elif device.type == MAX_WINDOW_SHUTTER: type = "MAX_WINDOW_SHUTTER" elif device.type == MAX_WALL_THERMOSTAT:
def __init__(self, address, port): # connect to the cube self.cube = MaxCube(MaxCubeConnection(address, port))