コード例 #1
0
    def update(self):
        """Update KNX climate."""
        from knxip.conversion import knx2_to_float

        super().update()

        self._current_temp = knx2_to_float(self.value('temperature'))
        self._target_temp = knx2_to_float(self.value('setpoint'))
コード例 #2
0
ファイル: knx.py プロジェクト: Khabi/home-assistant
    def update(self):
        """Update KNX climate."""
        from knxip.conversion import knx2_to_float

        super().update()

        self._current_temp = knx2_to_float(self.value('temperature'))
        self._target_temp = knx2_to_float(self.value('setpoint'))
コード例 #3
0
ファイル: test_conversion.py プロジェクト: daBONDi/pknx
    def test_knx_to_float(self):
        """Does the KNX to float conversion works correctly?"""

        # example pg. 21/36
        self.assertEquals(knx2_to_float([0x8a, 0x24]), -30)

        self.assertEquals(knx2_to_float([0x00, 0x00]), 0)
        self.assertEquals(knx2_to_float([0x00, 0x01]), 0.01)
        self.assertEquals(knx2_to_float([0x00, 0x64]), 1)
コード例 #4
0
    def test_knx_to_float(self):
        """Does the KNX to float conversion works correctly?"""

        # example pg. 21/36
        self.assertEquals(knx2_to_float([0x8a, 0x24]), -30)

        self.assertEquals(knx2_to_float([0x00, 0x00]), 0)
        self.assertEquals(knx2_to_float([0x00, 0x01]), 0.01)
        self.assertEquals(knx2_to_float([0x00, 0x64]), 1)
コード例 #5
0
 def state(self):
     """Return the Value of the KNX Sensor."""
     if self._data:
         from knxip.conversion import knx2_to_float
         value = knx2_to_float(self._data)
         if self._minimum_value <= value <= self._maximum_value:
             return value
     return None
コード例 #6
0
ファイル: knx.py プロジェクト: Bart274/home-assistant
 def state(self):
     """Return the Value of the KNX Sensor."""
     if self._data:
         from knxip.conversion import knx2_to_float
         value = knx2_to_float(self._data)
         if self._minimum_value <= value <= self._maximum_value:
             return value
     return None
コード例 #7
0
ファイル: knx.py プロジェクト: xiaogangzzg123/home-assistant
def convert_float(raw_value):
    """Conversion for 2 byte floating point values.

    2byte Floating Point KNX Telegram.
    Defined in KNX 3.7.2 - 3.10
    """
    from knxip.conversion import knx2_to_float

    return knx2_to_float(raw_value)
コード例 #8
0
    def update(self):
        """Update KNX sensor."""
        from knxip.conversion import knx2_to_float

        super().update()

        self._value = None

        if self._data:
            value = knx2_to_float(self._data)
            if self._minimum_value <= value <= self._maximum_value:
                self._value = value
コード例 #9
0
ファイル: knx.py プロジェクト: compvter/home-assistant
    def update(self):
        """Update KNX sensor."""
        from knxip.conversion import knx2_to_float

        super().update()

        self._value = None

        if self._data:
            value = 0 if self._data == 0 else knx2_to_float(self._data)
            if self._minimum_value <= value <= self._maximum_value:
                self._value = value
コード例 #10
0
def convert_float(raw_value):
    """Conversion for 2 byte floating point values.

    2byte Floating Point KNX Telegram.
    Defined in KNX 3.7.2 - 3.10
    """
    from knxip.conversion import knx2_to_float
    from knxip.core import KNXException

    try:
        return knx2_to_float(raw_value)
    except KNXException as exception:
        _LOGGER.error("Can't convert %s to float (%s)", raw_value, exception)
コード例 #11
0
ファイル: knx.py プロジェクト: brg468/home-assistant
def convert_float(raw_value):
    """Conversion for 2 byte floating point values.

    2byte Floating Point KNX Telegram.
    Defined in KNX 3.7.2 - 3.10
    """
    from knxip.conversion import knx2_to_float
    from knxip.core import KNXException

    try:
        return knx2_to_float(raw_value)
    except KNXException as exception:
        _LOGGER.error("Can't convert %s to float (%s)", raw_value, exception)
コード例 #12
0
    def target_temperature(self):
        """Return the temperature we try to reach."""
        from knxip.conversion import knx2_to_float

        return knx2_to_float(self.value('setpoint'))
コード例 #13
0
    def current_temperature(self):
        """Return the current temperature."""
        from knxip.conversion import knx2_to_float

        return knx2_to_float(self.value('temperature'))
コード例 #14
0
ファイル: knx.py プロジェクト: 12-hak/hak-assistant
    def target_temperature(self):
        """Return the temperature we try to reach."""
        from knxip.conversion import knx2_to_float

        return knx2_to_float(self.value("setpoint"))
コード例 #15
0
ファイル: knx.py プロジェクト: 12-hak/hak-assistant
    def current_temperature(self):
        """Return the current temperature."""
        from knxip.conversion import knx2_to_float

        return knx2_to_float(self.value("temperature"))