2 * Copyright (c) 2010-2021 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.semsportal.internal.dto;
15 import java.time.ZoneId;
16 import java.time.ZonedDateTime;
17 import java.util.List;
19 import com.google.gson.annotations.SerializedName;
22 * Facade for easy access to the SEMS portal data response. Data is distributed over different parts of the response
25 * @author Iwan Bron - Initial contribution
27 public class StationStatus {
28 @SerializedName("kpi")
29 private KeyPerformanceIndicators keyPerformanceIndicators;
30 @SerializedName("inverter")
31 private List<Station> stations;
33 public Double getCurrentOutput() {
34 return keyPerformanceIndicators.getCurrentOutput();
37 public Double getDayTotal() {
38 return stations.isEmpty() ? null : stations.get(0).getDayTotal();
41 public Double getMonthTotal() {
42 return stations.isEmpty() ? null : stations.get(0).getMonthTotal();
45 public Double getOverallTotal() {
46 return stations.isEmpty() ? null : stations.get(0).getOverallTotal();
49 public Double getDayIncome() {
50 return keyPerformanceIndicators.getDayIncome();
53 public Double getTotalIncome() {
54 return keyPerformanceIndicators.getTotalIncome();
57 public boolean isOperational() {
58 return stations.isEmpty() ? false : stations.get(0).getStatus() == 1;
61 public ZonedDateTime getLastUpdate() {
62 if (stations.isEmpty()) {
65 return ZonedDateTime.ofInstant(stations.get(0).getDetails().getLastUpdate().toInstant(),
66 ZoneId.systemDefault());