2 * Copyright (c) 2010-2024 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.homewizard.internal;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.core.library.types.QuantityType;
17 import org.openhab.core.library.unit.SIUnits;
18 import org.openhab.core.library.unit.Units;
19 import org.openhab.core.thing.ChannelUID;
20 import org.openhab.core.thing.Thing;
21 import org.openhab.core.types.Command;
24 * The {@link HomeWizardWaterMeterHandler} implements functionality to handle a HomeWizard Watermeter.
26 * @author Daniƫl van Os - Initial contribution
29 public class HomeWizardWaterMeterHandler extends HomeWizardDeviceHandler {
34 * @param thing The thing to handle
36 public HomeWizardWaterMeterHandler(Thing thing) {
41 * Not listening to any commands.
44 public void handleCommand(ChannelUID channelUID, Command command) {
48 * Device specific handling of the returned payload.
50 * @param payload The data parsed from the Json file
53 protected void handleDataPayload(DataPayload payload) {
54 updateState(HomeWizardBindingConstants.CHANNEL_CURRENT_WATER,
55 new QuantityType<>(payload.getCurrentWaterLPM(), Units.LITRE_PER_MINUTE));
56 updateState(HomeWizardBindingConstants.CHANNEL_TOTAL_WATER,
57 new QuantityType<>(payload.getTotalWaterM3(), SIUnits.CUBIC_METRE));