(self, relative_value: float)
return max(min(value + relative_value, self.range[1]), self.range[0])
Return absolute value for relative value.
Return absolute value for relative value.
Return absolute value for relative value .
def get_absolute_value(self, relative_value: float) -> float:
        """Return absolute value for relative value."""
        value = self.get_value()
        if value is None:
            if self.state.state == STATE_OFF:
                raise SmartHomeError(
                    ERR_DEVICE_OFF,
                    f'Device {self.state.entity_id} probably turned off'
                )

            raise SmartHomeError(
                ERR_INVALID_VALUE,
                f'Unable to get current value or {self.instance} instance of {self.state.entity_id}'
            )

        return max(min(value + relative_value, self.range[1]), self.range[0])
def get_absolute_value ( self , relative_value : float ) -> float : value = self . get_value ( ) if value is None : if self . state . state == STATE_OFF : raise SmartHomeError ( ERR_DEVICE_OFF , f'Device {self.state.entity_id} probably turned off' ) raise SmartHomeError ( ERR_INVALID_VALUE , f'Unable to get current value or {self.instance} instance of {self.state.entity_id}' ) return max ( min ( value + relative_value , self . range [ 1 ] ) , self . range [ 0 ] )