]> git.basschouten.com Git - openhab-addons.git/blob
aa31f46c79661b94992efd4d388c5bf9c2470a3d
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.solarwatt.internal.domain.model;
14
15 import static org.openhab.binding.solarwatt.internal.SolarwattBindingConstants.*;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.binding.solarwatt.internal.domain.dto.DeviceDTO;
19
20 /**
21  * The energy manager itself which aggregates all other devices.
22  *
23  * This fields have been identified to exist:
24  * com.kiwigrid.devices.em.EnergyManager=[
25  * IdInterfacesMap,
26  * DateCloudLastSeen,
27  * IdBootLoaderVersion,
28  * URLProxy,
29  * IdTimezone,
30  * FractionCPULoadAverageLastFifteenMinutes,
31  * FractionCPULoadAverageLastFiveMinutes,
32  * IdSystemImageVersion,
33  * VersionPackagesMap,
34  * IdNotInstalledDevicesMap,
35  * StatusMonitoringMap,
36  * FractionCPULoadUser,
37  * VersionExtensionsMap,
38  * InstallConfiguration,
39  * URLCloud,
40  * SettingsProxyMap,
41  * IdDevicesMap,
42  * SettingsMap,
43  * ReasonReboots,
44  * IdDriverList,
45  * TimeSinceStart,
46  * ExchangeDevice,
47  * SettingsPrivacyMap,
48  * FractionTopFiveProcessesMap,
49  * StateAction,
50  * FractionCPULoadAverageLastMinute,
51  * SettingsNetworkMap,
52  * SettingsDatetimeMap,
53  * FractionCPULoadKernel,
54  * FractionCPULoadTotal,
55  * IdRemoteAppSet,
56  * IdOwner,
57  * VersionLocalApplicationsMap,
58  * AddressLocation,
59  * Command,
60  * DriverMap,
61  * DateTagCollectorWatchdogEvents,
62  * LocationGeographical
63  * ]
64  *
65  * @author Sven Carstens - Initial contribution
66  */
67 @NonNullByDefault
68 public class EnergyManager extends Device {
69     public static final String SOLAR_WATT_CLASSNAME = "com.kiwigrid.devices.em.EnergyManager";
70
71     public EnergyManager(DeviceDTO deviceDTO) {
72         super(deviceDTO);
73     }
74
75     @Override
76     public void update(DeviceDTO deviceDTO) {
77         super.update(deviceDTO);
78
79         this.addSecondsQuantity(CHANNEL_TIMESTAMP.getChannelName(), "SettingsDatetimeMap", ".timestamp", deviceDTO);
80         this.addStringState(CHANNEL_IDTIMEZONE, deviceDTO);
81         this.addPercentQuantity(CHANNEL_FRACTION_CPU_LOAD_TOTAL, deviceDTO);
82         this.addPercentQuantity(CHANNEL_FRACTION_CPU_LOAD_USER, deviceDTO);
83         this.addPercentQuantity(CHANNEL_FRACTION_CPU_LOAD_KERNEL, deviceDTO);
84         this.addPercentQuantity(CHANNEL_FRACTION_CPU_LOAD_AVERAGE_LAST_MINUTE, deviceDTO);
85         this.addPercentQuantity(CHANNEL_FRACTION_CPU_LOAD_AVERAGE_LAST_FIVE_MINUTES, deviceDTO);
86         this.addPercentQuantity(CHANNEL_FRACTION_CPU_LOAD_AVERAGE_LAST_FIFTEEN_MINUTES, deviceDTO);
87     }
88 }