#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# (c) Copyright 2024 Sensirion AG, Switzerland
#
# THIS FILE IS AUTOMATICALLY GENERATED!
#
# Generator: sensirion-driver-generator 0.40.0
# Product: sht4x
# Model-Version: 2.1.1
#
"""
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 (175 * ticks_value / 65535) - 45"""
def __init__(self, temperature_ticks):
self._temperature = float(temperature_ticks)
self._temperature = ((self._temperature * 175.0) / 65535.0) - 45.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 percent relative humdity by (125 * ticks_value / 65535) - 6"""
def __init__(self, humidity_ticks):
self._humidity = float(humidity_ticks)
self._humidity = ((self._humidity * 125.0) / 65535.0) - 6.0
@property
def value(self):
return self._humidity
def __str__(self):
return '{0:.2f}'.format(self.value)