Search in sources :

Example 1 with HmVariable

use of org.openhab.binding.homematic.internal.model.HmVariable in project openhab1-addons by openhab.

the class ConverterTest method getValueListVariable.

private HmVariable getValueListVariable(Object value, String valueList) throws Exception {
    HmVariable var = new HmVariable();
    FieldUtils.writeField(var, "name", "Var", true);
    FieldUtils.writeField(var, "valueType", 16, true);
    FieldUtils.writeField(var, "subType", 29, true);
    Object convertedValueList = new ValueListAdapter().unmarshal(valueList == null ? null : valueList.toString());
    FieldUtils.writeField(var, "valueList", convertedValueList, true);
    var.setValue(value);
    return var;
}
Also used : HmVariable(org.openhab.binding.homematic.internal.model.HmVariable) ValueListAdapter(org.openhab.binding.homematic.internal.model.adapter.ValueListAdapter)

Example 2 with HmVariable

use of org.openhab.binding.homematic.internal.model.HmVariable in project openhab1-addons by openhab.

the class HomegearClient method createVariable.

/**
     * Creates a writeable HmVariable object.
     */
private HmVariable createVariable(String name, Object value) {
    HmVariable var = new HmVariable();
    var.setName(name);
    var.setWriteable(true);
    var.setValueType(guessType(value));
    var.setValue(value);
    return var;
}
Also used : HmVariable(org.openhab.binding.homematic.internal.model.HmVariable)

Example 3 with HmVariable

use of org.openhab.binding.homematic.internal.model.HmVariable in project openhab1-addons by openhab.

the class CcuClient method iterateAllVariables.

/**
     * {@inheritDoc}
     */
@Override
public void iterateAllVariables(HmValueItemIteratorCallback callback) throws HomematicClientException {
    List<HmVariable> variables = sendScriptByName("getAllVariables", HmVariableList.class).getVariables();
    for (HmVariable variable : variables) {
        VariableConfig bindingConfig = new VariableConfig(variable.getName());
        callback.iterate(bindingConfig, variable);
    }
}
Also used : VariableConfig(org.openhab.binding.homematic.internal.config.binding.VariableConfig) HmVariableList(org.openhab.binding.homematic.internal.model.HmVariableList) HmVariable(org.openhab.binding.homematic.internal.model.HmVariable)

Example 4 with HmVariable

use of org.openhab.binding.homematic.internal.model.HmVariable in project openhab1-addons by openhab.

the class HomegearClient method iterateAllVariables.

/**
     * {@inheritDoc}
     */
@Override
public void iterateAllVariables(HmValueItemIteratorCallback callback) throws HomematicClientException {
    Map<String, ?> result = rpcClient.getAllSystemVariables(getDefaultInterface());
    for (String variableName : result.keySet()) {
        HmVariable variable = createVariable(variableName, result.get(variableName));
        VariableConfig bindingConfig = new VariableConfig(variable.getName());
        callback.iterate(bindingConfig, variable);
    }
}
Also used : VariableConfig(org.openhab.binding.homematic.internal.config.binding.VariableConfig) HmVariable(org.openhab.binding.homematic.internal.model.HmVariable)

Aggregations

HmVariable (org.openhab.binding.homematic.internal.model.HmVariable)4 VariableConfig (org.openhab.binding.homematic.internal.config.binding.VariableConfig)2 HmVariableList (org.openhab.binding.homematic.internal.model.HmVariableList)1 ValueListAdapter (org.openhab.binding.homematic.internal.model.adapter.ValueListAdapter)1