#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# (c) Copyright 2023 Sensirion AG, Switzerland
#
# THIS FILE IS AUTOMATICALLY GENERATED!
#
# Generator: sensirion-driver-generator 0.33.0
# Product: sht3x
# Model-Version: 1.0.0
#
"""
The signal classes specify transformations of the raw sensor signals into a meaningful units.
The generated signal types are used by the driver class and not intended for direct use.
"""
from sensirion_driver_support_types.signals import AbstractSignal
[docs]class SignalTemperature(AbstractSignal):
"""Converted from ticks to degrees celsius by -45 + (175 * value / 65535)"""
def __init__(self, temperature_ticks):
self._temperature = float(temperature_ticks)
self._temperature = -45 + ((self._temperature * 175.0) / 65535.0)
@property
def value(self):
return self._temperature
def __str__(self):
return '{0:.2f}'.format(self.value)
[docs]class SignalHumidity(AbstractSignal):
"""Converted from ticks to relative humidity by 100 * value / 65535"""
def __init__(self, humidity_ticks):
self._humidity = float(humidity_ticks)
self._humidity = (100 * self._humidity) / 65535.0
@property
def value(self):
return self._humidity
def __str__(self):
return '{0:.2f}'.format(self.value)