2 * Copyright (c) 2010-2023 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.mielecloud.internal.webservice.api.json;
15 import java.util.Objects;
16 import java.util.Optional;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
22 * Immutable POJO representing the amount of water and energy used by the current running program up to the present
23 * moment. Queried from the Miele REST API.
25 * @author Björn Lange - Initial contribution
28 public class EcoFeedback {
30 private WaterConsumption currentWaterConsumption;
32 private EnergyConsumption currentEnergyConsumption;
34 private Double waterForecast;
36 private Double energyForecast;
38 public Optional<WaterConsumption> getCurrentWaterConsumption() {
39 return Optional.ofNullable(currentWaterConsumption);
42 public Optional<EnergyConsumption> getCurrentEnergyConsumption() {
43 return Optional.ofNullable(currentEnergyConsumption);
47 * Gets the relative water usage for the selected program from 0 to 1.
49 public Optional<Double> getWaterForecast() {
50 return Optional.ofNullable(waterForecast);
54 * Gets the relative energy usage for the selected program from 0 to 1.
56 public Optional<Double> getEnergyForecast() {
57 return Optional.ofNullable(energyForecast);
61 public int hashCode() {
62 return Objects.hash(currentWaterConsumption, currentEnergyConsumption, waterForecast, energyForecast);
66 public boolean equals(@Nullable Object obj) {
73 if (getClass() != obj.getClass()) {
76 EcoFeedback other = (EcoFeedback) obj;
77 return Objects.equals(currentWaterConsumption, other.currentWaterConsumption)
78 && Objects.equals(currentEnergyConsumption, other.currentEnergyConsumption)
79 && Objects.equals(waterForecast, other.waterForecast)
80 && Objects.equals(energyForecast, other.energyForecast);
84 public String toString() {
85 return "EcoFeedback [currentWaterConsumption=" + currentWaterConsumption + ", currentEnergyConsumption="
86 + currentEnergyConsumption + ", waterForecast=" + waterForecast + ", energyForecast=" + energyForecast