code: def _coerce_state_from_string(value: Union[int, str]) -> str:
          
          try:
              return STATE_MAP[int(value)]
          except KeyError:
              _LOGGER.error('Unknown state: %s', value)
              return STATE_UNKNOWN
docs: Return a proper state from a string input.