code: def all(types, unit, precision, as_json):  # pylint: disable=redefined-builtin
      
      sensors = W1ThermSensor.get_available_sensors(types)
      temperatures = []
      for sensor in sensors:
          if precision:
              sensor.set_precision(precision, persist=False)
  
          temperatures.append(sensor.get_temperature(unit))
  
      if as_json:
          data = [
              {"id": i, "hwid": s.id, "type": s.type_name, "temperature": t, "unit": unit}
              for i, s, t in zip(count(start=1), sensors, temperatures)
          ]
          click.echo(json.dumps(data, indent=4, sort_keys=True))
      else:
          click.echo(
              "Got temperatures of {0} sensors:".format(
                  click.style(str(len(sensors)), bold=True)
              )
          )
          for i, sensor, temperature in zip(count(start=1), sensors, temperatures):
              click.echo(
                  "  Sensor {0} ({1}) measured temperature: {2} {3}".format(
                      click.style(str(i), bold=True),
                      click.style(sensor.id, bold=True),
                      click.style(str(round(temperature, 2)), bold=True),
                      click.style(unit, bold=True),
                  )
              )
docs: Get temperatures of all available sensors