-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
- Loading branch information
Showing
12 changed files
with
399 additions
and
61 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
39 changes: 39 additions & 0 deletions
39
...dataservice/src/main/java/org/openhab/binding/energidataservice/internal/api/Dataset.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,39 @@ | ||
/** | ||
* Copyright (c) 2010-2024 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.energidataservice.internal.api; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
|
||
/** | ||
* Energi Data Service dataset. | ||
* | ||
* @author Jacob Laursen - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public enum Dataset { | ||
SpotPrices("Elspotprices"), | ||
DatahubPricelist("DatahubPricelist"), | ||
CO2Emission("CO2Emis"), | ||
CO2EmissionPrognosis("CO2EmisProg"); | ||
|
||
private final String name; | ||
|
||
Dataset(String name) { | ||
this.name = name; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return name; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...c/main/java/org/openhab/binding/energidataservice/internal/api/dto/CO2EmissionRecord.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,35 @@ | ||
/** | ||
* Copyright (c) 2010-2024 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.energidataservice.internal.api.dto; | ||
|
||
import java.math.BigDecimal; | ||
import java.time.Instant; | ||
import java.time.temporal.ChronoUnit; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
|
||
/** | ||
* Record as part of {@link CO2EmissionRecords} from Energi Data Service. | ||
* | ||
* @author Jacob Laursen - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public record CO2EmissionRecord(@SerializedName("Minutes5UTC") Instant start, | ||
@SerializedName("CO2Emission") BigDecimal emission) { | ||
|
||
public Instant end() { | ||
return start.plus(5, ChronoUnit.MINUTES); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
.../main/java/org/openhab/binding/energidataservice/internal/api/dto/CO2EmissionRecords.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,24 @@ | ||
/** | ||
* Copyright (c) 2010-2024 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.energidataservice.internal.api.dto; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
|
||
/** | ||
* Received {@link CO2EmissionRecords} from Energi Data Service. | ||
* | ||
* @author Jacob Laursen - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public record CO2EmissionRecords(int total, String filters, int limit, String dataset, CO2EmissionRecord[] records) { | ||
} |
Oops, something went wrong.