old_contents: #!/usr/bin/env python3
  """
  This is an example of how the pytradfri-library can be used.
  
  To run the script, do the following:
  $ pip3 install pytradfri
  $ Download this file (example.py)
  $ python3 test_pytradfri.py <IP> <KEY>
  
  Where <IP> is the address to your IKEA gateway and
  <KEY> is found on the back of your IKEA gateway.
  """
  
  import sys
  import pytradfri
  
  # Assign configuration variables.
  # The configuration check takes care they are present.
  api = pytradfri.coap_cli.api_factory(sys.argv[1], sys.argv[2])
  gateway = pytradfri.gateway.Gateway(api)
  devices = gateway.get_devices()
  lights = [dev for dev in devices if dev.has_light_control]
  tasks = gateway.get_smart_tasks()
  
  # Print all lights
  print(lights)
  
  # Lights can be accessed by its index, so lights[1] is the second light
  
  # Example 1: checks state of the light 2 (true=on)
  print(lights[1].light_control.lights[0].state)
  
  # Example 2: get dimmer level of light 2
  print(lights[1].light_control.lights[0].dimmer)
  
  # Example 3: What is the name of light 2
  print(lights[1].name)
  
  # Example 4: Set the light level of light 2
  lights[1].light_control.set_dimmer(20)
  
  # Example 5: Change color of light 2
  # f5faf6 = cold | f1e0b5 = normal | efd275 = warm
  lights[1].light_control.set_hex_color('f5faf6')
  
  # Example 6: Return the transition time (in minutes) for task#1
  tasks[0].task_control.tasks[0].transition_time
  
new_contents: #!/usr/bin/env python3
  """
  This is an example of how the pytradfri-library can be used.
  
  To run the script, do the following:
  $ pip3 install pytradfri
  $ Download this file (example.py)
  $ python3 test_pytradfri.py <IP> <KEY>
  
  Where <IP> is the address to your IKEA gateway and
  <KEY> is found on the back of your IKEA gateway.
  """
  
  import sys
  import pytradfri
  
  # Assign configuration variables.
  # The configuration check takes care they are present.
  api = pytradfri.coap_cli.api_factory(sys.argv[1], sys.argv[2])
  gateway = pytradfri.gateway.Gateway(api)
  devices = gateway.get_devices()
  lights = [dev for dev in devices if dev.has_light_control]
  tasks = gateway.get_smart_tasks()
  
  # Print all lights
  print(lights)
  
  # Lights can be accessed by its index, so lights[1] is the second light
  
  # Example 1: checks state of the light 2 (true=on)
  print(lights[1].light_control.lights[0].state)
  
  # Example 2: get dimmer level of light 2
  print(lights[1].light_control.lights[0].dimmer)
  
  # Example 3: What is the name of light 2
  print(lights[1].name)
  
  # Example 4: Set the light level of light 2
  lights[1].light_control.set_dimmer(20)
  
  # Example 5: Change color of light 2
  # f5faf6 = cold | f1e0b5 = normal | efd275 = warm
  lights[1].light_control.set_hex_color('f5faf6')
  
  # Example 6: Return the transition time (in minutes) for task#1
  tasks[0].task_control.tasks[0].transition_time
  
  # Example 7: Set the dimmer stop value to 30 for light#1 in task#1
  tasks[0].start_action.devices[0].item_controller.set_dimmer(30)
  
subject: Add example for controlling of item