Example #1
0
    def interpret_response(self, data):
        """
        Converts the raw response from the device to the proper data type.

        :param bytes data: Received raw bytes from the read operation.
        :return: The read humidity.
        :rtype: :py:class:`~sensirion_i2c_sht.sht2x.response_types.Sht2xHumidity`
        """  # noqa: E501
        checked_data = SensirionI2cCommand.interpret_response(self, data)
        return Sht2xHumidity(unpack(">H", checked_data)[0])
Example #2
0
    def interpret_response(self, data):
        """
        Converts the raw response from the device to the proper data type.

        :param bytes data: Received raw bytes from the read operation.
        :return: The read words from the metal ROM.
        :rtype: list(int)
        """
        checked_data = SensirionI2cCommand.interpret_response(self, data)
        n_words = int(len(checked_data) / 2)
        words = unpack(">{}H".format(n_words), checked_data)
        return words
Example #3
0
    def interpret_response(self, data):
        """
        Converts the raw response from the device to the proper data type.

        :param bytes data:
            Received raw bytes from the read operation.
        :return:
            The measured temperature and humidity.

            - temperature (:py:class:`~sensirion_i2c_sht.sht4x.response_types.Sht4xTemperature`) -
              Temperature response object.
            - humidity (:py:class:`~sensirion_i2c_sht.sht4x.response_types.Sht4xHumidity`) -
              Humidity response object.
        :rtype:
            tuple
        """  # noqa: E501
        checked_data = SensirionI2cCommand.interpret_response(self, data)
        temperature_ticks, humidity_ticks = unpack(">2H", checked_data)
        return Sht4xTemperature(temperature_ticks), \
            Sht4xHumidity(humidity_ticks)