Search in sources :

Example 11 with HmDatapointInfo

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

the class DisplayTextVirtualDatapoint method initialize.

@Override
public void initialize(HmDevice device) {
    if (isDisplay(device)) {
        for (HmChannel channel : device.getChannels()) {
            if (channel.hasDatapoint(new HmDatapointInfo(HmParamsetType.VALUES, channel, DATAPOINT_NAME_SUBMIT))) {
                for (int i = 1; i <= getLineCount(device); i++) {
                    addDatapoint(device, channel.getNumber(), DATAPOINT_NAME_DISPLAY_LINE + i, HmValueType.STRING, null, false);
                    addEnumDisplayDatapoint(device, channel.getNumber(), DATAPOINT_NAME_DISPLAY_ICON + i, Icon.class);
                    if (!isEpDisplay(device)) {
                        addEnumDisplayDatapoint(device, channel.getNumber(), DATAPOINT_NAME_DISPLAY_COLOR + i, Color.class);
                    }
                }
                if (isEpDisplay(device)) {
                    addEnumDisplayDatapoint(device, channel.getNumber(), DATAPOINT_NAME_DISPLAY_BEEPER, Beeper.class);
                    HmDatapoint bc = addDatapoint(device, channel.getNumber(), DATAPOINT_NAME_DISPLAY_BEEPCOUNT, HmValueType.INTEGER, 1, false);
                    bc.setMinValue(0);
                    bc.setMaxValue(15);
                    HmDatapoint bd = addDatapoint(device, channel.getNumber(), DATAPOINT_NAME_DISPLAY_BEEPINTERVAL, HmValueType.INTEGER, 1, false);
                    bd.setMinValue(10);
                    bd.setMaxValue(160);
                    bd.setStep(10);
                    addEnumDisplayDatapoint(device, channel.getNumber(), DATAPOINT_NAME_DISPLAY_LED, Led.class);
                }
                addDatapoint(device, channel.getNumber(), DATAPOINT_NAME_DISPLAY_SUBMIT, HmValueType.BOOL, false, false);
            }
        }
    }
}
Also used : HmChannel(org.eclipse.smarthome.binding.homematic.internal.model.HmChannel) HmDatapointInfo(org.eclipse.smarthome.binding.homematic.internal.model.HmDatapointInfo) HmDatapoint(org.eclipse.smarthome.binding.homematic.internal.model.HmDatapoint) HmDatapoint(org.eclipse.smarthome.binding.homematic.internal.model.HmDatapoint)

Example 12 with HmDatapointInfo

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

the class HmwIoModuleVirtualDatapointHandler method initialize.

@Override
public void initialize(HmDevice device) {
    if (device.getType().startsWith(DEVICE_TYPE_WIRED_IO_MODULE)) {
        for (HmChannel channel : device.getChannels()) {
            if (channel.getNumber() >= 7) {
                HmDatapointInfo dpInfoState = HmDatapointInfo.createValuesInfo(channel, DATAPOINT_NAME_STATE);
                HmDatapointInfo dpInfoValue = HmDatapointInfo.createValuesInfo(channel, DATAPOINT_NAME_VALUE);
                boolean hasStateDatapoint = channel.hasDatapoint(dpInfoState);
                boolean hasValueDatapoint = channel.hasDatapoint(dpInfoValue);
                if (hasStateDatapoint && !hasValueDatapoint) {
                    HmDatapoint dp = addDatapoint(channel.getDevice(), channel.getNumber(), DATAPOINT_NAME_VALUE, HmValueType.FLOAT, 0.0, false);
                    dp.setMinValue(0.0);
                    dp.setMaxValue(1000.0);
                    dp.setVirtual(false);
                } else if (hasValueDatapoint && !hasStateDatapoint) {
                    HmDatapoint dp = addDatapoint(channel.getDevice(), channel.getNumber(), DATAPOINT_NAME_STATE, HmValueType.BOOL, false, false);
                    dp.setVirtual(false);
                }
            }
            if (channel.getNumber() >= 21) {
                HmDatapointInfo dpInfoCalibration = new HmDatapointInfo(HmParamsetType.MASTER, channel, DATAPOINT_NAME_CALIBRATION);
                if (!channel.hasDatapoint(dpInfoCalibration)) {
                    HmDatapoint dp = new HmDatapoint(DATAPOINT_NAME_CALIBRATION, DATAPOINT_NAME_CALIBRATION, HmValueType.INTEGER, 0, false, HmParamsetType.MASTER);
                    dp.setMinValue(-127);
                    dp.setMaxValue(127);
                    addDatapoint(channel, dp);
                    dp.setVirtual(false);
                }
            }
        }
    }
}
Also used : HmChannel(org.eclipse.smarthome.binding.homematic.internal.model.HmChannel) HmDatapointInfo(org.eclipse.smarthome.binding.homematic.internal.model.HmDatapointInfo) HmDatapoint(org.eclipse.smarthome.binding.homematic.internal.model.HmDatapoint)

Example 13 with HmDatapointInfo

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

the class GetParamsetParser method parse.

@Override
@SuppressWarnings("unchecked")
public Void parse(Object[] message) throws IOException {
    Map<String, ?> mapMessage = (Map<String, ?>) message[0];
    for (String dpName : mapMessage.keySet()) {
        HmDatapointInfo dpInfo = new HmDatapointInfo(paramsetType, channel, dpName);
        HmDatapoint dp = channel.getDatapoint(dpInfo);
        if (dp != null) {
            dp.setValue(convertToType(dp, mapMessage.get(dpName)));
            adjustRssiValue(dp);
        } else {
            // should never happen, but in case ...
            // suppress warning for this datapoint due wrong CCU metadata
            String deviceType = channel.getDevice().getType();
            boolean isHmSenMdirNextTrans = dpInfo.getName().equals("NEXT_TRANSMISSION") && (deviceType.startsWith("HM-Sen-MDIR-O") || deviceType.startsWith("HM-Sen-MDIR-WM55"));
            if (!isHmSenMdirNextTrans) {
                logger.warn("Can't set value for datapoint '{}'", dpInfo);
            }
        }
    }
    return null;
}
Also used : Map(java.util.Map) HmDatapointInfo(org.eclipse.smarthome.binding.homematic.internal.model.HmDatapointInfo) HmDatapoint(org.eclipse.smarthome.binding.homematic.internal.model.HmDatapoint)

Example 14 with HmDatapointInfo

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

the class RpcResponseHandler method handleEvent.

/**
 * Populates the extracted event to the listener.
 */
private T handleEvent(Object[] message) throws IOException {
    EventParser eventParser = new EventParser();
    HmDatapointInfo dpInfo = eventParser.parse(message);
    listener.eventReceived(dpInfo, eventParser.getValue());
    return getEmptyStringResult();
}
Also used : EventParser(org.eclipse.smarthome.binding.homematic.internal.communicator.parser.EventParser) HmDatapointInfo(org.eclipse.smarthome.binding.homematic.internal.model.HmDatapointInfo)

Example 15 with HmDatapointInfo

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

the class HomematicThingHandler method updateChannelState.

/**
 * Evaluates the channel and datapoint for this channelUID and updates the state of the channel.
 */
private void updateChannelState(ChannelUID channelUID) throws GatewayNotAvailableException, HomematicClientException, IOException, ConverterException {
    HomematicGateway gateway = getHomematicGateway();
    HmDatapointInfo dpInfo = UidUtils.createHmDatapointInfo(channelUID);
    HmDatapoint dp = gateway.getDatapoint(dpInfo);
    Channel channel = getThing().getChannel(channelUID.getId());
    updateChannelState(dp, channel);
}
Also used : Channel(org.eclipse.smarthome.core.thing.Channel) HmChannel(org.eclipse.smarthome.binding.homematic.internal.model.HmChannel) HomematicGateway(org.eclipse.smarthome.binding.homematic.internal.communicator.HomematicGateway) HmDatapointInfo(org.eclipse.smarthome.binding.homematic.internal.model.HmDatapointInfo) HmDatapoint(org.eclipse.smarthome.binding.homematic.internal.model.HmDatapoint)

Aggregations

HmDatapointInfo (org.eclipse.smarthome.binding.homematic.internal.model.HmDatapointInfo)18 HmDatapoint (org.eclipse.smarthome.binding.homematic.internal.model.HmDatapoint)12 HmChannel (org.eclipse.smarthome.binding.homematic.internal.model.HmChannel)9 HomematicClientException (org.eclipse.smarthome.binding.homematic.internal.misc.HomematicClientException)6 IOException (java.io.IOException)4 HmDatapointConfig (org.eclipse.smarthome.binding.homematic.internal.model.HmDatapointConfig)4 HomematicGateway (org.eclipse.smarthome.binding.homematic.internal.communicator.HomematicGateway)3 Channel (org.eclipse.smarthome.core.thing.Channel)3 ChannelUID (org.eclipse.smarthome.core.thing.ChannelUID)3 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 DisplayOptionsVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.DisplayOptionsVirtualDatapointHandler)2 FirmwareVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.FirmwareVirtualDatapointHandler)2 HmwIoModuleVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.HmwIoModuleVirtualDatapointHandler)2 OnTimeAutomaticVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.OnTimeAutomaticVirtualDatapointHandler)2 ReloadAllFromGatewayVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.ReloadAllFromGatewayVirtualDatapointHandler)2 ReloadFromGatewayVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.ReloadFromGatewayVirtualDatapointHandler)2 ReloadRssiVirtualDatapointHandler (org.eclipse.smarthome.binding.homematic.internal.communicator.virtual.ReloadRssiVirtualDatapointHandler)2