]> git.basschouten.com Git - openhab-addons.git/blob
ba2ed860ee07a83a69eb1d2b429cac86619259c9
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.homematic.internal.communicator.virtual;
14
15 import static org.openhab.binding.homematic.internal.misc.HomematicConstants.VIRTUAL_DATAPOINT_NAME_FIRMWARE;
16
17 import org.openhab.binding.homematic.internal.model.HmDevice;
18 import org.openhab.binding.homematic.internal.model.HmValueType;
19
20 /**
21  * A virtual String datapoint which adds the firmware version to the device.
22  *
23  * @author Gerhard Riegler - Initial contribution
24  */
25 public class FirmwareVirtualDatapointHandler extends AbstractVirtualDatapointHandler {
26     @Override
27     public String getName() {
28         return VIRTUAL_DATAPOINT_NAME_FIRMWARE;
29     }
30
31     @Override
32     public void initialize(HmDevice device) {
33         if (!device.isGatewayExtras()) {
34             addDatapoint(device, 0, getName(), HmValueType.STRING, device.getFirmware(), true);
35         }
36     }
37 }