def listDevices(self): r = "" devices = pywink.get_all_devices() for d in devices: r += '{color}{name} ({type}) - {state}\n```'.format( color=("```css\n" if d.state() else "```brainfuck\n"), name=d.name(), type=d.object_type(), state=("ON" if d.state() else "OFF")) return r
def getDeviceNames(self): devices = pywink.get_all_devices() names = [] for d in devices: names.append(d.name()) return names
def getDevice(self, name): devices = pywink.get_all_devices() for d in devices: if d.name().lower() == name.lower(): return d, d.object_type() return None, None