Search in sources :

Example 1 with TclScriptDataEntry

use of org.eclipse.smarthome.binding.homematic.internal.model.TclScriptDataEntry 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 TclScriptDataEntry

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

the class CcuParamsetDescriptionParser method parse.

@Override
public Void parse(TclScriptDataList resultList) throws IOException {
    if (resultList.getEntries() != null) {
        for (TclScriptDataEntry entry : resultList.getEntries()) {
            HmDatapoint dp = assembleDatapoint(entry.name, entry.unit, entry.valueType, this.toOptionList(entry.options), convertToType(entry.minValue), convertToType(entry.maxValue), toInteger(entry.operations), convertToType(entry.value), paramsetType, isHmIpDevice);
            channel.addDatapoint(dp);
        }
    }
    return null;
}
Also used : TclScriptDataEntry(org.eclipse.smarthome.binding.homematic.internal.model.TclScriptDataEntry) HmDatapoint(org.eclipse.smarthome.binding.homematic.internal.model.HmDatapoint)

Example 3 with TclScriptDataEntry

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

the class CcuVariablesAndScriptsParser method parse.

@Override
public Void parse(TclScriptDataList resultList) throws IOException {
    if (resultList.getEntries() != null) {
        for (TclScriptDataEntry entry : resultList.getEntries()) {
            HmDatapoint dp = channel.getDatapoint(HmParamsetType.VALUES, entry.name);
            if (dp != null) {
                dp.setValue(convertToType(entry.value));
            } else {
                dp = new HmDatapoint();
                dp.setName(entry.name);
                dp.setInfo(entry.name);
                dp.setDescription(entry.description);
                dp.setType(HmValueType.parse(entry.valueType));
                dp.setValue(convertToType(entry.value));
                if (dp.isIntegerType()) {
                    dp.setMinValue(toInteger(entry.minValue));
                    dp.setMaxValue(toInteger(entry.maxValue));
                } else {
                    dp.setMinValue(toDouble(entry.minValue));
                    dp.setMaxValue(toDouble(entry.maxValue));
                }
                dp.setReadOnly(entry.readOnly);
                dp.setUnit(entry.unit);
                String[] result = StringUtils.splitByWholeSeparatorPreserveAllTokens(entry.options, ";");
                dp.setOptions(result == null || result.length == 0 ? null : result);
                if (dp.getOptions() != null) {
                    dp.setMinValue(0);
                    dp.setMaxValue(dp.getOptions().length - 1);
                }
                dp.setParamsetType(HmParamsetType.VALUES);
                channel.addDatapoint(dp);
            }
        }
    }
    return null;
}
Also used : TclScriptDataEntry(org.eclipse.smarthome.binding.homematic.internal.model.TclScriptDataEntry) HmDatapoint(org.eclipse.smarthome.binding.homematic.internal.model.HmDatapoint)

Aggregations

HmDatapoint (org.eclipse.smarthome.binding.homematic.internal.model.HmDatapoint)3 TclScriptDataEntry (org.eclipse.smarthome.binding.homematic.internal.model.TclScriptDataEntry)3 HmDatapointInfo (org.eclipse.smarthome.binding.homematic.internal.model.HmDatapointInfo)1