docs: def _aha_request(self, cmd, ain=None, param=None, rf=str):
          """Send an AHA request."""
          url = 'http://' + self._host + '/webservices/homeautoswitch.lua'
          params = {
              'switchcmd': cmd,
              'sid': self._sid
          }
          if param:
              params['param'] = param
          if ain:
              params['ain'] = ain
  
          plain = self._request(url, params)
          if plain == 'inval':
              raise InvalidError
  
          if rf == bool:
              return bool(int(plain))
          return rf(plain)