import time import sys from meross_iot.api import MerossHttpClient from meross_iot.supported_devices.power_plugs import Mss310 httpHandler = MerossHttpClient(email="thomas.fransolet@hotmail.be", password="Coconuts07") devices = httpHandler.list_supported_devices() smartGardenPlugUUID = "1809010176291225180434298f165e27" smart3DPrinterUUID = "1809016169329025180434298f16641d" for counter, device in enumerate(devices): if isinstance(device, Mss310): #self.device = device #print(device.get_power_consumptionX()) print("SYSTEM DATA = "+str(device.get_sys_data())) #print(device.get_electricity()) print("DEVICE ID = "+str(device.device_id())) if (str(device.device_id()) == smartGardenPlugUUID): print("HOURRA It's smartGarden !") smartGardenPlug = device smartGardenPlugStatus = device.get_sys_data()['all']['digest']['togglex'][0]['onoff'] print("DEVICE STATUS = "+str(smartGardenPlugStatus)) smartGardenPlugElecticity = device.get_electricity() print(smartGardenPlugElecticity) if (str(device.device_id()) == smart3DPrinterUUID) : print("HOURRA It's smart3DPrinter !") smart3DPrinterPlug = device smartGardenPlug.turn_on(); time.sleep(5) smartGardenPlug.turn_off(); time.sleep(5) smart3DPrinterPlug.turn_on(); time.sleep(5) smart3DPrinterPlug.turn_off();