'Set the state of this lamp to the provided brightness.'

def set_state(self, brightness):

    import avion
    initial = time.monotonic()
    while True:
        if ((time.monotonic() - initial) >= 10):
            return False
        try:
            self._switch.set_brightness(brightness)
            break
        except avion.avionException:
            self._switch.connect()
    return True
