]> git.basschouten.com Git - openhab-addons.git/blob
536dfe0a72c6e4dae0be9f0f60138c94fde2c857
[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.deconz.internal.dto;
14
15 import java.util.Collections;
16 import java.util.Map;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20 import org.openhab.binding.deconz.internal.types.ResourceType;
21
22 /**
23  * http://dresden-elektronik.github.io/deconz-rest-doc/configuration/
24  * # Get full state
25  * GET /api/<apikey>
26  *
27  * @author David Graeff - Initial contribution
28  */
29 @NonNullByDefault
30 public class BridgeFullState {
31     public Config config = new Config();
32
33     public static class Config {
34         public String apiversion = ""; // "1.0.0"
35         public String ipaddress = ""; // "192.168.80.142",
36         public String name = ""; // "deCONZ-GW",
37         public String swversion = ""; // "20405"
38         public String fwversion = ""; // "0x262e0500"
39         public String uuid = ""; // "a65d80a1-975a-4598-8d5a-2547bc18d63b",
40         public int websocketport = 0; // 8088
41         public int zigbeechannel = 0;
42     }
43
44     public Map<String, SensorMessage> sensors = Collections.emptyMap();
45     public Map<String, LightMessage> lights = Collections.emptyMap();
46     public Map<String, GroupMessage> groups = Collections.emptyMap();
47
48     public @Nullable DeconzBaseMessage getMessage(ResourceType resourceType, String id) {
49         switch (resourceType) {
50             case LIGHTS:
51                 return lights.get(id);
52             case SENSORS:
53                 return sensors.get(id);
54             case GROUPS:
55                 return groups.get(id);
56             default:
57                 return null;
58         }
59     }
60 }