docs: def set_device_state(self, device, state, id_override=None, type_override=None):
          """
          Set device state via online API.
  
          Args:
              device (WinkDevice): The device the change is being requested for.
              state (Dict): The state being requested.
              id_override (String, optional): A device ID used to override the
                  passed in device's ID. Used to make changes on sub-devices.
                  i.e. Outlet in a Powerstrip. The Parent device's ID.
              type_override (String, optional): Used to override the device type
                  when a device inherits from a device other than WinkDevice.
          Returns:
              response_json (Dict): The API's response in dictionary format
          """
          _LOGGER.info("Setting state via online API")
          object_id = id_override or device.object_id()
          object_type = type_override or device.object_type()
          url_string = "{}/{}s/{}".format(self.BASE_URL,
                                          object_type,
                                          object_id)
          if state is None or object_type == "group":
              url_string += "/activate"
              if state is None:
                  arequest = requests.post(url_string,
                                           headers=API_HEADERS)
              else:
                  arequest = requests.post(url_string,
                                           data=json.dumps(state),
                                           headers=API_HEADERS)
          else:
              arequest = requests.put(url_string,
                                      data=json.dumps(state),
                                      headers=API_HEADERS)
          if arequest.status_code == 401:
              new_token = refresh_access_token()
              if new_token:
                  arequest = requests.put(url_string,
                                          data=json.dumps(state),
                                          headers=API_HEADERS)
              else:
                  raise WinkAPIException("Failed to refresh access token.")
          response_json = arequest.json()
          _LOGGER.debug('%s', response_json)
          return response_json