def set_state(self, state, speed=None):
        """
        :param state: bool
        :param speed: a string one of ["lowest", "low",
            "medium", "high", "auto"] defaults to last speed
        :return: nothing
        """
        speed = speed or self.current_fan_speed()
        if state:
            desired_state = {"powered": state, "mode": speed}
        else:
            desired_state = {"powered": state}

        response = self.api_interface.set_device_state(self, {
            "desired_state": desired_state
        })

        self._update_state_from_response(response)