forked from openhab/openhab-addons
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mielecloud] Add channels energy and water consumption (openhab#14456)
* Add POJOs for ecoFeedback from Miele REST API * DeviceState offers water and energy consumption * Convert Quantity to State for channel population * Add eco feedback channels to devices * Fix item types and categories * Add update instructions for eco feedback channels Signed-off-by: Björn Lange <[email protected]>
- Loading branch information
1 parent
8108c0f
commit e3b9cd1
Showing
37 changed files
with
1,133 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
...ecloud/src/main/java/org/openhab/binding/mielecloud/internal/webservice/api/Quantity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/** | ||
* Copyright (c) 2010-2023 Contributors to the openHAB project | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
|
||
package org.openhab.binding.mielecloud.internal.webservice.api; | ||
|
||
import java.util.Objects; | ||
import java.util.Optional; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
|
||
/** | ||
* A physical quantity as obtained from the Miele REST API. | ||
* | ||
* @author Björn Lange - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class Quantity { | ||
double value; | ||
Optional<String> unit; | ||
|
||
public Quantity(double value, @Nullable String unit) { | ||
this.value = value; | ||
this.unit = Optional.ofNullable(unit); | ||
} | ||
|
||
public double getValue() { | ||
return value; | ||
} | ||
|
||
public Optional<String> getUnit() { | ||
return unit; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(value, unit); | ||
} | ||
|
||
@Override | ||
public boolean equals(@Nullable Object obj) { | ||
if (this == obj) { | ||
return true; | ||
} | ||
if (obj == null) { | ||
return false; | ||
} | ||
if (getClass() != obj.getClass()) { | ||
return false; | ||
} | ||
Quantity other = (Quantity) obj; | ||
return Double.doubleToLongBits(value) == Double.doubleToLongBits(other.value) | ||
&& Objects.equals(unit, other.unit); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Quantity [value=" + value + ", unit=" + unit + "]"; | ||
} | ||
} |
Oops, something went wrong.