Set device state via local API, and fall back to 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

def local_set_state(self, device, state, id_override=None, type_override=None):
        """
        Set device state via local API, and fall back to 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
        """
        if ALLOW_LOCAL_CONTROL:
            if device.local_id() is not None:
                hub = HUBS.get(device.hub_id())
                if hub is None or hub["token"] is None:
                    return self.set_device_state(device, state, id_override, type_override)
            else:
                return self.set_device_state(device, state, id_override, type_override)
            _LOGGER.info("Setting local state")
            local_id = id_override or device.local_id().split(".")[0]
            object_type = type_override or device.object_type()
            LOCAL_API_HEADERS['Authorization'] = "Bearer " + hub["token"]
            url_string = "https://{}:8888/{}s/{}".format(hub["ip"],
                                                         object_type,
                                                         local_id)
            try:
                arequest = requests.put(url_string,
                                        data=json.dumps(state),
                                        headers=LOCAL_API_HEADERS,
                                        verify=False, timeout=3)
            except requests.exceptions.RequestException:
                _LOGGER.error("Error sending local control request. Sending request online")
                return self.set_device_state(device, state, id_override, type_override)
            response_json = arequest.json()
            _LOGGER.debug('%s', response_json)
            temp_state = device.json_state
            for key, value in response_json["data"]["last_reading"].items():
                temp_state["last_reading"][key] = value
            return temp_state
        else:
            return self.set_device_state(device, state, id_override, type_override)