title: How can I implement an increment function for enum objects?
body: <p>I'm working with a Dyson fan and am trying to write a function that increases the speed of the fan. The enum object FanSpeed has the following members. When I execute [print(i) for i in FanSpeed] I get:</p>
  
  <pre><code>FanSpeed.FAN_SPEED_1
  FanSpeed.FAN_SPEED_2
  FanSpeed.FAN_SPEED_3
  FanSpeed.FAN_SPEED_4
  FanSpeed.FAN_SPEED_5
  FanSpeed.FAN_SPEED_6
  FanSpeed.FAN_SPEED_7
  FanSpeed.FAN_SPEED_8
  FanSpeed.FAN_SPEED_9
  FanSpeed.FAN_SPEED_10
  </code></pre>
  
  <p>So the first enum object (above) has the name FAN_SPEED_1 (<code>FanSpeed.FAN_SPEED_1.name</code>) and has a value of "0001" (<code>FanSpeed.FAN_SPEED_1.value</code>), and so on.</p>
  
  <p>The function to set speed (to 5 in this example is):</p>
  
  <pre><code>fan.set_configuration(fan_mode=FanMode.FAN, fan_speed=FanSpeed.FAN_SPEED_5)
  </code></pre>
  
  <p>I can't figure out how to write a function that gets the current speed and then sets it to one level higher. I've tried:</p>
  
  <p>1/ Treating the enum object as a a string and replacing the last character with a number (character type) that's higher. This approach doesn't work for enum objects though.</p>
  
  <p>2/ Looking for some kind of increment or next function but those don't seem to exist for enum objects.</p>