Search in sources :

Example 11 with Device

use of org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.Device in project smarthome by eclipse.

the class DsAPIImpl method getApartmentDevices.

@Override
public List<Device> getApartmentDevices(String token) {
    String response = transport.execute(SimpleRequestBuilder.buildNewJsonRequest(ClassKeys.APARTMENT).addFunction(FunctionKeys.GET_DEVICES).addParameter(ParameterKeys.TOKEN, token).buildRequestString());
    JsonObject responseObj = JSONResponseHandler.toJsonObject(response);
    if (JSONResponseHandler.checkResponse(responseObj) && responseObj.get(JSONApiResponseKeysEnum.RESULT.getKey()) instanceof JsonArray) {
        JsonArray array = (JsonArray) responseObj.get(JSONApiResponseKeysEnum.RESULT.getKey());
        List<Device> deviceList = new LinkedList<Device>();
        for (int i = 0; i < array.size(); i++) {
            if (array.get(i) instanceof JsonObject) {
                deviceList.add(new DeviceImpl((JsonObject) array.get(i)));
            }
        }
        return deviceList;
    }
    return new LinkedList<Device>();
}
Also used : JsonArray(com.google.gson.JsonArray) Device(org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.Device) JsonObject(com.google.gson.JsonObject) DeviceImpl(org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.impl.DeviceImpl) LinkedList(java.util.LinkedList)

Example 12 with Device

use of org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.Device in project smarthome by eclipse.

the class InternalScene method activateScene.

/**
 * Activates this Scene.
 */
public void activateScene() {
    if (!active) {
        this.active = true;
        deviceHasChanged = false;
        informListener();
        if (this.devices != null) {
            for (Device device : this.devices) {
                device.callInternalScene(this);
            }
        }
    }
}
Also used : Device(org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.Device)

Example 13 with Device

use of org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.Device in project smarthome by eclipse.

the class InternalScene method deactivateScene.

/**
 * Deactivates this Scene.
 */
public void deactivateScene() {
    if (active) {
        this.active = false;
        deviceHasChanged = false;
        informListener();
        if (this.devices != null) {
            for (Device device : this.devices) {
                device.undoInternalScene(this);
            }
        }
    }
}
Also used : Device(org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.Device)

Aggregations

Device (org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.Device)13 Circuit (org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.Circuit)3 HashMap (java.util.HashMap)2 LinkedList (java.util.LinkedList)2 DSID (org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.impl.DSID)2 ThingUID (org.eclipse.smarthome.core.thing.ThingUID)2 JsonArray (com.google.gson.JsonArray)1 JsonObject (com.google.gson.JsonObject)1 List (java.util.List)1 DeviceBinarayInputEnum (org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.DeviceBinarayInputEnum)1 DeviceImpl (org.eclipse.smarthome.binding.digitalstrom.internal.lib.structure.devices.impl.DeviceImpl)1 DiscoveryResult (org.eclipse.smarthome.config.discovery.DiscoveryResult)1 ThingStatusInfo (org.eclipse.smarthome.core.thing.ThingStatusInfo)1 ThingTypeUID (org.eclipse.smarthome.core.thing.ThingTypeUID)1 ChannelTypeUID (org.eclipse.smarthome.core.thing.type.ChannelTypeUID)1