Exemple #1
0
    def __init__(self, hass, config):
        """Initialize a KNX Float Sensor."""
        # set up the KNX Group address
        KNXGroupAddress.__init__(self, hass, config)

        device_type = config.config.get(CONF_TYPE)
        sensor_config = FIXED_SETTINGS_MAP.get(device_type)

        if not sensor_config:
            raise NotImplementedError()

        # set up the conversion function based on the address type
        address_type = sensor_config.get('address_type')
        if address_type == KNXAddressType.FLOAT:
            self.convert = convert_float
        elif address_type == KNXAddressType.PERCENT:
            self.convert = convert_percent
        else:
            raise NotImplementedError()

        # other settings
        self._unit_of_measurement = sensor_config.get('unit')
        default_min = float(sensor_config.get('default_minimum'))
        default_max = float(sensor_config.get('default_maximum'))
        self._minimum_value = config.config.get(CONF_MINIMUM, default_min)
        self._maximum_value = config.config.get(CONF_MAXIMUM, default_max)
        _LOGGER.debug(
            "%s: configured additional settings: unit=%s, "
            "min=%f, max=%f, type=%s", self.name, self._unit_of_measurement,
            self._minimum_value, self._maximum_value, str(address_type))

        self._value = None
Exemple #2
0
    def __init__(self, hass, config):
        """Initialize a KNX Float Sensor."""
        # set up the KNX Group address
        KNXGroupAddress.__init__(self, hass, config)

        device_type = config.config.get(CONF_TYPE)
        sensor_config = FIXED_SETTINGS_MAP.get(device_type)

        if not sensor_config:
            raise NotImplementedError()

        # set up the conversion function based on the address type
        address_type = sensor_config.get('address_type')
        if address_type == KNXAddressType.FLOAT:
            self.convert = convert_float
        elif address_type == KNXAddressType.PERCENT:
            self.convert = convert_percent
        else:
            raise NotImplementedError()

        # other settings
        self._unit_of_measurement = sensor_config.get('unit')
        default_min = float(sensor_config.get('default_minimum'))
        default_max = float(sensor_config.get('default_maximum'))
        self._minimum_value = config.config.get(CONF_MINIMUM, default_min)
        self._maximum_value = config.config.get(CONF_MAXIMUM, default_max)
        _LOGGER.debug(
            "%s: configured additional settings: unit=%s, "
            "min=%f, max=%f, type=%s",
            self.name, self._unit_of_measurement,
            self._minimum_value, self._maximum_value, str(address_type)
        )

        self._value = None
Exemple #3
0
    def __init__(self, hass, config, unit_of_measurement, minimum_sensor_value,
                 maximum_sensor_value):
        """Initialize a KNX Float Sensor."""
        self._unit_of_measurement = unit_of_measurement
        self._minimum_value = minimum_sensor_value
        self._maximum_value = maximum_sensor_value

        KNXGroupAddress.__init__(self, hass, config)
Exemple #4
0
    def __init__(self, hass, config, unit_of_measurement, minimum_sensor_value,
                 maximum_sensor_value):
        """Initialize a KNX Float Sensor."""
        self._unit_of_measurement = unit_of_measurement
        self._minimum_value = minimum_sensor_value
        self._maximum_value = maximum_sensor_value

        KNXGroupAddress.__init__(self, hass, config)