2 * Copyright (c) 2010-2022 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.tplinksmarthome.internal.device;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.tplinksmarthome.internal.Commands;
17 import org.openhab.binding.tplinksmarthome.internal.model.Realtime;
18 import org.openhab.binding.tplinksmarthome.internal.model.Sysinfo;
21 * Data class to store device state.
23 * @author Hilbrand Bouwkamp - Initial contribution
26 public class DeviceState {
28 private final Commands commands = new Commands();
29 private final Realtime realtime;
30 private final Sysinfo sysinfo;
33 * Initializes the device state given the json response from the device.
35 * @param state device state as json string
37 public DeviceState(String state) {
38 sysinfo = commands.getSysinfoReponse(state);
39 realtime = commands.getRealtimeResponse(state);
43 * @return returns the device energy data (if present)
45 public Realtime getRealtime() {
50 * @return returns the device state
52 public Sysinfo getSysinfo() {