Search in sources :

Example 1 with HmDatapoint

use of org.eclipse.smarthome.binding.homematic.internal.model.HmDatapoint in project smarthome by eclipse.

the class CcuValueParser method parse.

@Override
public Void parse(TclScriptDataList resultList) throws IOException {
    if (resultList.getEntries() != null) {
        for (TclScriptDataEntry entry : resultList.getEntries()) {
            HmDatapointInfo dpInfo = HmDatapointInfo.createValuesInfo(channel, entry.name);
            HmDatapoint dp = channel.getDatapoint(dpInfo);
            if (dp != null) {
                dp.setValue(convertToType(dp, entry.value));
                adjustRssiValue(dp);
            } else {
                // should never happen, but in case ...
                logger.warn("Can't set value for datapoint '{}'", dpInfo);
            }
        }
    }
    return null;
}
Also used : TclScriptDataEntry(org.eclipse.smarthome.binding.homematic.internal.model.TclScriptDataEntry) HmDatapointInfo(org.eclipse.smarthome.binding.homematic.internal.model.HmDatapointInfo) HmDatapoint(org.eclipse.smarthome.binding.homematic.internal.model.HmDatapoint)

Example 2 with HmDatapoint

use of org.eclipse.smarthome.binding.homematic.internal.model.HmDatapoint in project smarthome by eclipse.

the class GetParamsetDescriptionParser method parse.

@Override
@SuppressWarnings("unchecked")
public Void parse(Object[] message) throws IOException {
    if (!(message[0] instanceof Map)) {
        logger.debug("Unexpected datatype '{}',  ignoring message", message[0].getClass());
        return null;
    }
    Map<String, Map<String, Object>> dpNames = (Map<String, Map<String, Object>>) message[0];
    for (String datapointName : dpNames.keySet()) {
        Map<String, Object> dpMeta = dpNames.get(datapointName);
        HmDatapoint dp = assembleDatapoint(datapointName, toString(dpMeta.get("UNIT")), toString(dpMeta.get("TYPE")), toOptionList(dpMeta.get("VALUE_LIST")), dpMeta.get("MIN"), dpMeta.get("MAX"), toInteger(dpMeta.get("OPERATIONS")), dpMeta.get("DEFAULT"), paramsetType, isHmIpDevice);
        channel.addDatapoint(dp);
    }
    return null;
}
Also used : Map(java.util.Map) HmDatapoint(org.eclipse.smarthome.binding.homematic.internal.model.HmDatapoint)

Example 3 with HmDatapoint

use of org.eclipse.smarthome.binding.homematic.internal.model.HmDatapoint in project smarthome by eclipse.

the class AbstractVirtualDatapointHandler method addDatapoint.

/**
 * Creates a new datapoint with the given parameters and adds it to the channel.
 */
protected HmDatapoint addDatapoint(HmDevice device, Integer channelNumber, String datapointName, HmValueType valueType, Object value, boolean readOnly) {
    HmChannel channel = device.getChannel(channelNumber);
    HmDatapoint dp = new HmDatapoint(datapointName, datapointName, valueType, value, readOnly, HmParamsetType.VALUES);
    return addDatapoint(channel, dp);
}
Also used : HmChannel(org.eclipse.smarthome.binding.homematic.internal.model.HmChannel) HmDatapoint(org.eclipse.smarthome.binding.homematic.internal.model.HmDatapoint)

Example 4 with HmDatapoint

use of org.eclipse.smarthome.binding.homematic.internal.model.HmDatapoint in project smarthome by eclipse.

the class DisplayOptionsVirtualDatapointHandler method sendDatapoint.

private void sendDatapoint(VirtualGateway gateway, HmChannel channel, String dpName, Object newValue) throws IOException, HomematicClientException {
    HmDatapointInfo dpInfo = HmDatapointInfo.createValuesInfo(channel, dpName);
    HmDatapoint dp = gateway.getDatapoint(dpInfo);
    gateway.sendDatapoint(dp, new HmDatapointConfig(), newValue, null);
}
Also used : HmDatapointConfig(org.eclipse.smarthome.binding.homematic.internal.model.HmDatapointConfig) HmDatapointInfo(org.eclipse.smarthome.binding.homematic.internal.model.HmDatapointInfo) HmDatapoint(org.eclipse.smarthome.binding.homematic.internal.model.HmDatapoint)

Example 5 with HmDatapoint

use of org.eclipse.smarthome.binding.homematic.internal.model.HmDatapoint in project smarthome by eclipse.

the class InstallModeDurationVirtualDatapoint method initialize.

@Override
public void initialize(HmDevice device) {
    if (device.isGatewayExtras()) {
        HmDatapoint dp = addDatapoint(device, 0, getName(), HmValueType.INTEGER, 60, false);
        dp.setMinValue(10);
        dp.setMaxValue(300);
    }
}
Also used : HmDatapoint(org.eclipse.smarthome.binding.homematic.internal.model.HmDatapoint)

Aggregations

HmDatapoint (org.eclipse.smarthome.binding.homematic.internal.model.HmDatapoint)55 HmChannel (org.eclipse.smarthome.binding.homematic.internal.model.HmChannel)21 HmDatapointInfo (org.eclipse.smarthome.binding.homematic.internal.model.HmDatapointInfo)12 HmDatapointConfig (org.eclipse.smarthome.binding.homematic.internal.model.HmDatapointConfig)7 HmDevice (org.eclipse.smarthome.binding.homematic.internal.model.HmDevice)7 Test (org.junit.Test)6 IOException (java.io.IOException)5 HomematicClientException (org.eclipse.smarthome.binding.homematic.internal.misc.HomematicClientException)5 ArrayList (java.util.ArrayList)4 HomematicGateway (org.eclipse.smarthome.binding.homematic.internal.communicator.HomematicGateway)4 Channel (org.eclipse.smarthome.core.thing.Channel)4 JavaTest (org.eclipse.smarthome.test.java.JavaTest)4 Map (java.util.Map)3 TclScriptDataEntry (org.eclipse.smarthome.binding.homematic.internal.model.TclScriptDataEntry)3 ChannelUID (org.eclipse.smarthome.core.thing.ChannelUID)3 HashMap (java.util.HashMap)2 BatteryTypeVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.BatteryTypeVirtualDatapointHandler)2 ButtonVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.ButtonVirtualDatapointHandler)2 DeleteDeviceModeVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.DeleteDeviceModeVirtualDatapointHandler)2 DeleteDeviceVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.DeleteDeviceVirtualDatapointHandler)2