def _stringify_state(self, available: bool) -> str:
    'Convert state to string.'
    if (not available):
        return STATE_UNAVAILABLE
    if ((state := self.state) is None):
        return STATE_UNKNOWN
    if isinstance(state, float):
        return f'{state:.{FLOAT_PRECISION}}'
    return str(state)
Convert state to string.
def _stringify_state(self, available: bool) -> str:
    
    if (not available):
        return STATE_UNAVAILABLE
    if ((state := self.state) is None):
        return STATE_UNKNOWN
    if isinstance(state, float):
        return f'{state:.{FLOAT_PRECISION}}'
    return str(state)