hthiery/python-fritzhome

View on GitHub

Showing 22 of 22 total issues

Fritzhome has 55 functions (exceeds 30 allowed). Consider refactoring.
Open

class Fritzhome(object):
    """Fritzhome object to communicate with the device."""

    _sid = None
    _session = None
Severity: Major
Found in pyfritzhome/fritzhome.py - About 6 hrs to fix

    File fritzhome.py has 364 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """The main fritzhome handling class."""
    # -*- coding: utf-8 -*-
    
    from __future__ import print_function
    
    
    Severity: Minor
    Found in pyfritzhome/fritzhome.py - About 4 hrs to fix

      Function list_all has a Cognitive Complexity of 28 (exceeds 13 allowed). Consider refactoring.
      Open

      def list_all(fritz, args):
          """Command that prints all device information."""
          devices = fritz.get_devices()
      
          for device in devices:
      Severity: Minor
      Found in pyfritzhome/cli.py - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              if device.has_blind:
                  print(" Blind:")
                  print("  level=%s" % device.level)
                  print("  levelpercentage=%s" % device.levelpercentage)
                  print("  endpositionset=%s" % device.endpositionsset)
      Severity: Major
      Found in pyfritzhome/cli.py and 1 other location - About 2 hrs to fix
      pyfritzhome/cli.py on lines 43..47

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 58.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              if device.has_powermeter:
                  print(" Powermeter:")
                  print("  power=%s" % device.power)
                  print("  energy=%s" % device.energy)
                  print("  voltage=%s" % device.voltage)
      Severity: Major
      Found in pyfritzhome/cli.py and 1 other location - About 2 hrs to fix
      pyfritzhome/cli.py on lines 78..82

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 58.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      File cli.py has 269 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      #!/usr/bin/env python
      """A simple CLI tool."""
      # -*- coding: utf-8 -*-
      
      from __future__ import print_function
      Severity: Minor
      Found in pyfritzhome/cli.py - About 2 hrs to fix

        Function main has 74 lines of code (exceeds 45 allowed). Consider refactoring.
        Open

        def main(args=None):
            """Enter the main function of the CLI tool."""
            parser = argparse.ArgumentParser(description="Fritz!Box Smarthome CLI tool.")
            parser.add_argument(
                "-v", action="store_true", dest="verbose", help="be more verbose"
        Severity: Major
        Found in pyfritzhome/cli.py - About 2 hrs to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              def _update_blind_from_node(self, node):
                  _LOGGER.debug("update blind device")
                  blind_element = node.find("blind")
                  try:
                      self.endpositionsset = self.get_node_value_as_int_as_bool(
          Severity: Major
          Found in pyfritzhome/devicetypes/fritzhomedeviceblind.py and 1 other location - About 1 hr to fix
          pyfritzhome/devicetypes/fritzhomedevicehumidity.py on lines 31..38

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 49.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              def _update_humidity_from_node(self, node):
                  _LOGGER.debug("update humidity device")
                  humidity_element = node.find("humidity")
                  try:
                      self.rel_humidity = self.get_node_value_as_int(
          Severity: Major
          Found in pyfritzhome/devicetypes/fritzhomedevicehumidity.py and 1 other location - About 1 hr to fix
          pyfritzhome/devicetypes/fritzhomedeviceblind.py on lines 31..38

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 49.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 9 locations. Consider refactoring.
          Open

              def _update_from_node(self, node):
                  super()._update_from_node(node)
                  if self.present is False:
                      return
          
          
          Severity: Major
          Found in pyfritzhome/devicetypes/fritzhomedevicelevel.py and 8 other locations - About 1 hr to fix
          pyfritzhome/devicetypes/fritzhomedevicealarm.py on lines 17..23
          pyfritzhome/devicetypes/fritzhomedeviceblind.py on lines 17..23
          pyfritzhome/devicetypes/fritzhomedevicehumidity.py on lines 17..23
          pyfritzhome/devicetypes/fritzhomedevicelightbulb.py on lines 24..30
          pyfritzhome/devicetypes/fritzhomedevicepowermeter.py on lines 20..26
          pyfritzhome/devicetypes/fritzhomedeviceswitch.py on lines 19..25
          pyfritzhome/devicetypes/fritzhomedevicetemperature.py on lines 18..24
          pyfritzhome/devicetypes/fritzhomedevicethermostat.py on lines 34..40

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 46.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 9 locations. Consider refactoring.
          Open

              def _update_from_node(self, node):
                  super()._update_from_node(node)
                  if self.present is False:
                      return
          
          
          Severity: Major
          Found in pyfritzhome/devicetypes/fritzhomedevicealarm.py and 8 other locations - About 1 hr to fix
          pyfritzhome/devicetypes/fritzhomedeviceblind.py on lines 17..23
          pyfritzhome/devicetypes/fritzhomedevicehumidity.py on lines 17..23
          pyfritzhome/devicetypes/fritzhomedevicelevel.py on lines 18..24
          pyfritzhome/devicetypes/fritzhomedevicelightbulb.py on lines 24..30
          pyfritzhome/devicetypes/fritzhomedevicepowermeter.py on lines 20..26
          pyfritzhome/devicetypes/fritzhomedeviceswitch.py on lines 19..25
          pyfritzhome/devicetypes/fritzhomedevicetemperature.py on lines 18..24
          pyfritzhome/devicetypes/fritzhomedevicethermostat.py on lines 34..40

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 46.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 9 locations. Consider refactoring.
          Open

              def _update_from_node(self, node):
                  super()._update_from_node(node)
                  if self.present is False:
                      return
          
          
          Severity: Major
          Found in pyfritzhome/devicetypes/fritzhomedeviceblind.py and 8 other locations - About 1 hr to fix
          pyfritzhome/devicetypes/fritzhomedevicealarm.py on lines 17..23
          pyfritzhome/devicetypes/fritzhomedevicehumidity.py on lines 17..23
          pyfritzhome/devicetypes/fritzhomedevicelevel.py on lines 18..24
          pyfritzhome/devicetypes/fritzhomedevicelightbulb.py on lines 24..30
          pyfritzhome/devicetypes/fritzhomedevicepowermeter.py on lines 20..26
          pyfritzhome/devicetypes/fritzhomedeviceswitch.py on lines 19..25
          pyfritzhome/devicetypes/fritzhomedevicetemperature.py on lines 18..24
          pyfritzhome/devicetypes/fritzhomedevicethermostat.py on lines 34..40

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 46.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 9 locations. Consider refactoring.
          Open

              def _update_from_node(self, node):
                  super()._update_from_node(node)
                  if self.present is False:
                      return
          
          
          Severity: Major
          Found in pyfritzhome/devicetypes/fritzhomedevicethermostat.py and 8 other locations - About 1 hr to fix
          pyfritzhome/devicetypes/fritzhomedevicealarm.py on lines 17..23
          pyfritzhome/devicetypes/fritzhomedeviceblind.py on lines 17..23
          pyfritzhome/devicetypes/fritzhomedevicehumidity.py on lines 17..23
          pyfritzhome/devicetypes/fritzhomedevicelevel.py on lines 18..24
          pyfritzhome/devicetypes/fritzhomedevicelightbulb.py on lines 24..30
          pyfritzhome/devicetypes/fritzhomedevicepowermeter.py on lines 20..26
          pyfritzhome/devicetypes/fritzhomedeviceswitch.py on lines 19..25
          pyfritzhome/devicetypes/fritzhomedevicetemperature.py on lines 18..24

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 46.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 9 locations. Consider refactoring.
          Open

              def _update_from_node(self, node):
                  super()._update_from_node(node)
                  if self.present is False:
                      return
          
          
          Severity: Major
          Found in pyfritzhome/devicetypes/fritzhomedevicelightbulb.py and 8 other locations - About 1 hr to fix
          pyfritzhome/devicetypes/fritzhomedevicealarm.py on lines 17..23
          pyfritzhome/devicetypes/fritzhomedeviceblind.py on lines 17..23
          pyfritzhome/devicetypes/fritzhomedevicehumidity.py on lines 17..23
          pyfritzhome/devicetypes/fritzhomedevicelevel.py on lines 18..24
          pyfritzhome/devicetypes/fritzhomedevicepowermeter.py on lines 20..26
          pyfritzhome/devicetypes/fritzhomedeviceswitch.py on lines 19..25
          pyfritzhome/devicetypes/fritzhomedevicetemperature.py on lines 18..24
          pyfritzhome/devicetypes/fritzhomedevicethermostat.py on lines 34..40

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 46.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 9 locations. Consider refactoring.
          Open

              def _update_from_node(self, node):
                  super()._update_from_node(node)
                  if self.present is False:
                      return
          
          
          Severity: Major
          Found in pyfritzhome/devicetypes/fritzhomedeviceswitch.py and 8 other locations - About 1 hr to fix
          pyfritzhome/devicetypes/fritzhomedevicealarm.py on lines 17..23
          pyfritzhome/devicetypes/fritzhomedeviceblind.py on lines 17..23
          pyfritzhome/devicetypes/fritzhomedevicehumidity.py on lines 17..23
          pyfritzhome/devicetypes/fritzhomedevicelevel.py on lines 18..24
          pyfritzhome/devicetypes/fritzhomedevicelightbulb.py on lines 24..30
          pyfritzhome/devicetypes/fritzhomedevicepowermeter.py on lines 20..26
          pyfritzhome/devicetypes/fritzhomedevicetemperature.py on lines 18..24
          pyfritzhome/devicetypes/fritzhomedevicethermostat.py on lines 34..40

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 46.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 9 locations. Consider refactoring.
          Open

              def _update_from_node(self, node):
                  super()._update_from_node(node)
                  if self.present is False:
                      return
          
          
          Severity: Major
          Found in pyfritzhome/devicetypes/fritzhomedevicehumidity.py and 8 other locations - About 1 hr to fix
          pyfritzhome/devicetypes/fritzhomedevicealarm.py on lines 17..23
          pyfritzhome/devicetypes/fritzhomedeviceblind.py on lines 17..23
          pyfritzhome/devicetypes/fritzhomedevicelevel.py on lines 18..24
          pyfritzhome/devicetypes/fritzhomedevicelightbulb.py on lines 24..30
          pyfritzhome/devicetypes/fritzhomedevicepowermeter.py on lines 20..26
          pyfritzhome/devicetypes/fritzhomedeviceswitch.py on lines 19..25
          pyfritzhome/devicetypes/fritzhomedevicetemperature.py on lines 18..24
          pyfritzhome/devicetypes/fritzhomedevicethermostat.py on lines 34..40

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 46.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 9 locations. Consider refactoring.
          Open

              def _update_from_node(self, node):
                  super()._update_from_node(node)
                  if self.present is False:
                      return
          
          
          Severity: Major
          Found in pyfritzhome/devicetypes/fritzhomedevicetemperature.py and 8 other locations - About 1 hr to fix
          pyfritzhome/devicetypes/fritzhomedevicealarm.py on lines 17..23
          pyfritzhome/devicetypes/fritzhomedeviceblind.py on lines 17..23
          pyfritzhome/devicetypes/fritzhomedevicehumidity.py on lines 17..23
          pyfritzhome/devicetypes/fritzhomedevicelevel.py on lines 18..24
          pyfritzhome/devicetypes/fritzhomedevicelightbulb.py on lines 24..30
          pyfritzhome/devicetypes/fritzhomedevicepowermeter.py on lines 20..26
          pyfritzhome/devicetypes/fritzhomedeviceswitch.py on lines 19..25
          pyfritzhome/devicetypes/fritzhomedevicethermostat.py on lines 34..40

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 46.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 9 locations. Consider refactoring.
          Open

              def _update_from_node(self, node):
                  super()._update_from_node(node)
                  if self.present is False:
                      return
          
          
          Severity: Major
          Found in pyfritzhome/devicetypes/fritzhomedevicepowermeter.py and 8 other locations - About 1 hr to fix
          pyfritzhome/devicetypes/fritzhomedevicealarm.py on lines 17..23
          pyfritzhome/devicetypes/fritzhomedeviceblind.py on lines 17..23
          pyfritzhome/devicetypes/fritzhomedevicehumidity.py on lines 17..23
          pyfritzhome/devicetypes/fritzhomedevicelevel.py on lines 18..24
          pyfritzhome/devicetypes/fritzhomedevicelightbulb.py on lines 24..30
          pyfritzhome/devicetypes/fritzhomedeviceswitch.py on lines 19..25
          pyfritzhome/devicetypes/fritzhomedevicetemperature.py on lines 18..24
          pyfritzhome/devicetypes/fritzhomedevicethermostat.py on lines 34..40

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 46.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              def set_unmapped_color(self, hsv, duration=0):
                  """Set unmapped HSV color (Free color selection)."""
                  if self.has_color:
                      self._fritz.set_color(self.ain, hsv, duration, False)
          Severity: Minor
          Found in pyfritzhome/devicetypes/fritzhomedevicelightbulb.py and 1 other location - About 45 mins to fix
          pyfritzhome/devicetypes/fritzhomedevicelightbulb.py on lines 116..119

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 35.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              def set_color(self, hsv, duration=0):
                  """Set HSV color."""
                  if self.has_color:
                      self._fritz.set_color(self.ain, hsv, duration, True)
          Severity: Minor
          Found in pyfritzhome/devicetypes/fritzhomedevicelightbulb.py and 1 other location - About 45 mins to fix
          pyfritzhome/devicetypes/fritzhomedevicelightbulb.py on lines 121..124

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 35.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Severity
          Category
          Status
          Source
          Language