├── .vscode ├── launch.json └── tasks.json ├── .gitignore ├── src └── main │ ├── resources │ └── ESH-INF │ │ ├── binding │ │ └── binding.xml │ │ └── thing │ │ ├── melCloudAccount.xml │ │ └── acDevice.xml │ └── java │ └── org │ └── openhab │ └── binding │ └── melcloud │ └── internal │ ├── config │ ├── AccountConfig.java │ └── AcDeviceConfig.java │ ├── exceptions │ ├── MelCloudCommException.java │ └── MelCloudLoginException.java │ ├── api │ ├── json │ │ ├── QuantizedCoordinates.java │ │ ├── Structure.java │ │ ├── WeatherObservation.java │ │ ├── Area.java │ │ ├── Floor.java │ │ ├── Preset.java │ │ ├── LoginClientResponse.java │ │ ├── DeviceStatus.java │ │ ├── ListDevicesResponse.java │ │ ├── LoginData.java │ │ ├── Device.java │ │ └── DeviceProps.java │ └── MelCloudConnection.java │ ├── MelCloudBindingConstants.java │ ├── MelCloudHandlerFactory.java │ ├── discovery │ └── MelCloudDiscoveryService.java │ └── handler │ ├── MelCloudAccountHandler.java │ └── MelCloudDeviceHandler.java ├── NOTICE ├── pom.xml ├── .project ├── .classpath └── README.md /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "type": "java", 6 | "name": "Debug (Attach) - openHAB", 7 | "request": "attach", 8 | "hostName": "localhost", 9 | "port": 5005, 10 | "preLaunchTask": "Build" 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .antlr* 2 | .idea 3 | .DS_Store 4 | *.iml 5 | npm-debug.log 6 | 7 | .metadata/ 8 | bin/ 9 | target/ 10 | src-gen/ 11 | xtend-gen/ 12 | 13 | */plugin.xml_gen 14 | **/.settings/org.eclipse.* 15 | 16 | bundles/**/src/main/history 17 | features/**/src/main/history 18 | features/**/src/main/feature 19 | 20 | <<<<<<< HEAD 21 | #.vscode 22 | ======= 23 | .vscode 24 | >>>>>>> b2ba5afe65f465d4bcac9a664cd559bb5564c399 25 | .factorypath 26 | 27 | dependencies.xml 28 | -------------------------------------------------------------------------------- /src/main/resources/ESH-INF/binding/binding.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | MELCloud Binding 7 | Binding for Mitsubishi MELCloud connected A.C. devices. 8 | LucaCalcaterra, Pauli Anttila 9 | 10 | 11 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | This content is produced and maintained by the openHAB project. 2 | 3 | * Project home: https://www.openhab.org 4 | 5 | == Declared Project Licenses 6 | 7 | This program and the accompanying materials are made available under the terms 8 | of the Eclipse Public License 2.0 which is available at 9 | https://www.eclipse.org/legal/epl-2.0/. 10 | 11 | == Source Code 12 | 13 | https://github.com/openhab/openhab2-addons 14 | 15 | == Third-party Content 16 | 17 | Gson 18 | * License: Apache 2.0 license 19 | * Project: https://github.com/google/gson 20 | * Source: https://github.com/google/gson -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 4.0.0 6 | 7 | 8 | org.openhab.addons.bundles 9 | org.openhab.addons.reactor.bundles 10 | 2.5.0-SNAPSHOT 11 | 12 | 13 | org.openhab.binding.melcloud 14 | 15 | openHAB Add-ons :: Bundles :: MELCloud Binding 16 | 17 | 18 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.openhab.binding.melcloud 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/melcloud/internal/config/AccountConfig.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2019 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.melcloud.internal.config; 14 | 15 | /** 16 | * Config class for MELCloud account parameters. 17 | * 18 | * @author Pauli Anttila - Initial Contribution 19 | * 20 | */ 21 | public class AccountConfig { 22 | 23 | public String username; 24 | public String password; 25 | public int language; 26 | 27 | @Override 28 | public String toString() { 29 | return "[username=" + username + ", password=" + password + ", languageId=" + language + "]"; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/melcloud/internal/config/AcDeviceConfig.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2019 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.melcloud.internal.config; 14 | 15 | /** 16 | * Config class for a A.C. device. 17 | * 18 | * @author Pauli Anttila - Initial Contribution 19 | * 20 | */ 21 | public class AcDeviceConfig { 22 | 23 | public Integer deviceID; 24 | public Integer buildingID; 25 | public Integer pollingInterval; 26 | 27 | @Override 28 | public String toString() { 29 | return "[deviceID=" + deviceID + ", buildingID=" + buildingID + ", pollingInterval=" + pollingInterval + "]"; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/melcloud/internal/exceptions/MelCloudCommException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2019 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.melcloud.internal.exceptions; 14 | 15 | /** 16 | * Exception to encapsulate any issues communicating with MELCloud. 17 | * 18 | * @author Pauli Anttila - Initial Contribution 19 | */ 20 | public class MelCloudCommException extends Exception { 21 | private static final long serialVersionUID = 1L; 22 | 23 | public MelCloudCommException(Throwable cause) { 24 | super("Error occured when communicating with MELCloud", cause); 25 | } 26 | 27 | public MelCloudCommException(String message) { 28 | super(message); 29 | } 30 | 31 | public MelCloudCommException(String message, Throwable cause) { 32 | super(message, cause); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/melcloud/internal/exceptions/MelCloudLoginException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2019 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.melcloud.internal.exceptions; 14 | 15 | /** 16 | * Exception to encapsulate any login issues with MELCloud. 17 | * 18 | * @author Pauli Anttila - Initial Contribution 19 | */ 20 | public class MelCloudLoginException extends MelCloudCommException { 21 | private static final long serialVersionUID = 1L; 22 | 23 | public MelCloudLoginException(Throwable cause) { 24 | super("Error occured during login to MELCloud", cause); 25 | } 26 | 27 | public MelCloudLoginException(String message) { 28 | super(message); 29 | } 30 | 31 | public MelCloudLoginException(String message, Throwable cause) { 32 | super(message, cause); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/melcloud/internal/api/json/QuantizedCoordinates.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2019 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.melcloud.internal.api.json; 14 | 15 | import com.google.gson.annotations.Expose; 16 | import com.google.gson.annotations.SerializedName; 17 | 18 | /** 19 | * The {@link QuantizedCoordinates} is responsible of JSON data For MELCloud API 20 | * QuantizedCoordinates data 21 | * Generated with jsonschema2pojo 22 | * 23 | * @author LucaCalcaterra - Initial contribution 24 | */ 25 | public class QuantizedCoordinates { 26 | 27 | @SerializedName("Latitude") 28 | @Expose 29 | private Double latitude; 30 | @SerializedName("Longitude") 31 | @Expose 32 | private Double longitude; 33 | 34 | public Double getLatitude() { 35 | return latitude; 36 | } 37 | 38 | public void setLatitude(Double latitude) { 39 | this.latitude = latitude; 40 | } 41 | 42 | public Double getLongitude() { 43 | return longitude; 44 | } 45 | 46 | public void setLongitude(Double longitude) { 47 | this.longitude = longitude; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/melcloud/internal/api/json/Structure.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2019 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.melcloud.internal.api.json; 14 | 15 | import java.util.List; 16 | 17 | import com.google.gson.annotations.Expose; 18 | import com.google.gson.annotations.SerializedName; 19 | 20 | /** 21 | * The {@link Structure} is responsible of JSON data For MELCloud API 22 | * Structure Data 23 | * Generated with jsonschema2pojo 24 | * 25 | * @author LucaCalcaterra - Initial contribution 26 | * @author Wietse van Buitenen - Add Floor and Area 27 | */ 28 | public class Structure { 29 | 30 | @SerializedName("Floors") 31 | @Expose 32 | private List floors = null; 33 | @SerializedName("Areas") 34 | @Expose 35 | private List areas = null; 36 | @SerializedName("Devices") 37 | @Expose 38 | private List devices = null; 39 | @SerializedName("Clients") 40 | @Expose 41 | private List clients = null; 42 | 43 | public List getFloors() { 44 | return floors; 45 | } 46 | 47 | public void setFloors(List floors) { 48 | this.floors = floors; 49 | } 50 | 51 | public List getAreas() { 52 | return areas; 53 | } 54 | 55 | public void setAreas(List areas) { 56 | this.areas = areas; 57 | } 58 | 59 | public List getDevices() { 60 | return devices; 61 | } 62 | 63 | public void setDevices(List devices) { 64 | this.devices = devices; 65 | } 66 | 67 | public List getClients() { 68 | return clients; 69 | } 70 | 71 | public void setClients(List clients) { 72 | this.clients = clients; 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /src/main/resources/ESH-INF/thing/melCloudAccount.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | MELCloud cloud service account 10 | 11 | 12 | 13 | 14 | MELCloud email address 15 | 16 | 17 | password 18 | 19 | MELCloud password 20 | 21 | 22 | 23 | Language 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 0 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/melcloud/internal/MelCloudBindingConstants.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2019 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.melcloud.internal; 14 | 15 | import java.util.Collections; 16 | import java.util.Set; 17 | import java.util.stream.Collectors; 18 | import java.util.stream.Stream; 19 | 20 | import org.eclipse.smarthome.core.thing.ThingTypeUID; 21 | 22 | /** 23 | * The {@link MelCloudBindingConstants} class defines common constants, which are 24 | * used across the whole binding. 25 | * 26 | * @author LucaCalcaterra - Initial contribution 27 | */ 28 | public class MelCloudBindingConstants { 29 | 30 | private static final String BINDING_ID = "melcloud"; 31 | 32 | // List of Bridge Type UIDs 33 | public static final ThingTypeUID THING_TYPE_MELCLOUD_ACCOUNT = new ThingTypeUID(BINDING_ID, "melcloudaccount"); 34 | 35 | // List of all Thing Type UIDs 36 | public static final ThingTypeUID THING_TYPE_ACDEVICE = new ThingTypeUID(BINDING_ID, "acdevice"); 37 | 38 | // List of all Channel ids 39 | public static final String CHANNEL_POWER = "power"; 40 | public static final String CHANNEL_OPERATION_MODE = "operationMode"; 41 | public static final String CHANNEL_SET_TEMPERATURE = "setTemperature"; 42 | public static final String CHANNEL_FAN_SPEED = "fanSpeed"; 43 | public static final String CHANNEL_VANE_HORIZONTAL = "vaneHorizontal"; 44 | public static final String CHANNEL_VANE_VERTICAL = "vaneVertical"; 45 | 46 | // Read Only Channels 47 | public static final String CHANNEL_ROOM_TEMPERATURE = "roomTemperature"; 48 | public static final String CHANNEL_LAST_COMMUNICATION = "lastCommunication"; 49 | public static final String CHANNEL_NEXT_COMMUNICATION = "nextCommunication"; 50 | public static final String CHANNEL_HAS_PENDING_COMMAND = "hasPendingCommand"; 51 | public static final String CHANNEL_OFFLINE = "offline"; 52 | 53 | public static final Set SUPPORTED_THING_TYPE_UIDS = Collections 54 | .unmodifiableSet(Stream.of(THING_TYPE_MELCLOUD_ACCOUNT, THING_TYPE_ACDEVICE).collect(Collectors.toSet())); 55 | 56 | public static final Set DISCOVERABLE_THING_TYPE_UIDS = Collections.singleton(THING_TYPE_ACDEVICE); 57 | } 58 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "options": { 4 | "env": { 5 | "openhab_home": "c://openhab2", 6 | "openhab_runtime": "c://openhab2/runtime", 7 | "openhab_addons": "c://openhab2/addons", 8 | "openhab_logs": "C://openhab2/userdata/logs", 9 | "dist": "org.openhab.binding.melcloud-2.5.0-SNAPSHOT.jar" 10 | } 11 | }, 12 | "tasks": [ 13 | { 14 | "label": "Start openHAB (Debug)", 15 | "type": "shell", 16 | "isBackground": true, 17 | "command": "$openhab_home/start.sh debug", 18 | "windows": { 19 | "command": "& $env:openhab_home/start.bat debug" 20 | }, 21 | "presentation": { 22 | "reveal": "always", 23 | "panel": "new" 24 | }, 25 | "problemMatcher": [] 26 | }, 27 | { 28 | "label": "Stop openHAB", 29 | "type": "shell", 30 | "command": "$openhab_runtime/bin/stop", 31 | "windows": { 32 | "command": "& $env:openhab_runtime/bin/stop.bat" 33 | }, 34 | "problemMatcher": [] 35 | }, 36 | { 37 | "label": "mvn Compile (Release)", 38 | "type": "shell", 39 | "command": "mvn", 40 | "args": ["clean", "install"], 41 | "problemMatcher": [] 42 | }, 43 | { 44 | "label": "mvn Compile (Online)", 45 | "type": "shell", 46 | "command": "mvn", 47 | "args": ["clean", "install", "-DskipChecks"], 48 | "problemMatcher": [] 49 | }, 50 | { 51 | "label": "mvn Compile (Offline)", 52 | "type": "shell", 53 | "command": "mvn", 54 | "args": ["-o", "clean", "install", "-DskipChecks"], 55 | "problemMatcher": [] 56 | }, 57 | { 58 | "label": "Copy Distribution to Addons", 59 | "type": "shell", 60 | "command": "cp", 61 | "args": ["${workspaceFolder}/target/$dist", "$openhab_addons"], 62 | "windows": { 63 | "command": "copy", 64 | "args": ["${workspaceFolder}/target/$env:dist", "$env:openhab_addons"] 65 | }, 66 | "dependsOn": ["mvn Compile (Offline)"], 67 | "problemMatcher": [] 68 | }, 69 | { 70 | "label": "Build", 71 | "dependsOn": ["Copy Distribution to Addons"], 72 | "problemMatcher": [] 73 | }, 74 | { 75 | "label": "Tail events.log", 76 | "type": "shell", 77 | "command": "tail", 78 | "args": ["-n", "50", "-f", "$openhab_logs/events.log"], 79 | "windows": { 80 | "command": "Get-Content", 81 | "args": [ 82 | "-Last", 83 | "50", 84 | "-Path", 85 | "$env:openhab_logs/events.log", 86 | "-Wait" 87 | ] 88 | }, 89 | "presentation": { 90 | "reveal": "always", 91 | "panel": "new" 92 | }, 93 | "problemMatcher": [] 94 | }, 95 | { 96 | "label": "Tail openhab.log", 97 | "type": "shell", 98 | "command": "tail", 99 | "args": ["-n", "50", "-f", "$openhab_logs/openhab.log"], 100 | "windows": { 101 | "command": "Get-Content", 102 | "args": [ 103 | "-Last", 104 | "50", 105 | "-Path", 106 | "$env:openhab_logs/openhab.log", 107 | "-Wait" 108 | ] 109 | }, 110 | "presentation": { 111 | "reveal": "always", 112 | "panel": "new" 113 | }, 114 | "problemMatcher": [] 115 | } 116 | ] 117 | } 118 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/melcloud/internal/MelCloudHandlerFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2019 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.melcloud.internal; 14 | 15 | import static org.openhab.binding.melcloud.internal.MelCloudBindingConstants.*; 16 | 17 | import java.util.HashMap; 18 | import java.util.Map; 19 | 20 | import org.eclipse.jdt.annotation.NonNull; 21 | import org.eclipse.jdt.annotation.Nullable; 22 | import org.eclipse.smarthome.config.discovery.DiscoveryService; 23 | import org.eclipse.smarthome.core.thing.Bridge; 24 | import org.eclipse.smarthome.core.thing.Thing; 25 | import org.eclipse.smarthome.core.thing.ThingTypeUID; 26 | import org.eclipse.smarthome.core.thing.ThingUID; 27 | import org.eclipse.smarthome.core.thing.binding.BaseThingHandlerFactory; 28 | import org.eclipse.smarthome.core.thing.binding.ThingHandler; 29 | import org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory; 30 | import org.openhab.binding.melcloud.internal.discovery.MelCloudDiscoveryService; 31 | import org.openhab.binding.melcloud.internal.handler.MelCloudAccountHandler; 32 | import org.openhab.binding.melcloud.internal.handler.MelCloudDeviceHandler; 33 | import org.osgi.framework.ServiceRegistration; 34 | import org.osgi.service.component.annotations.Component; 35 | 36 | /** 37 | * The {@link MelCloudHandlerFactory} is responsible for creating things and thing 38 | * handlers. 39 | * 40 | * @author LucaCalcaterra - Initial contribution 41 | */ 42 | @Component(configurationPid = "binding.melcloud", service = ThingHandlerFactory.class) 43 | public class MelCloudHandlerFactory extends BaseThingHandlerFactory { 44 | private Map> discoveryServiceRegistrations = new HashMap<>(); 45 | 46 | @Override 47 | public boolean supportsThingType(ThingTypeUID thingTypeUID) { 48 | return SUPPORTED_THING_TYPE_UIDS.contains(thingTypeUID); 49 | } 50 | 51 | @Override 52 | protected @Nullable ThingHandler createHandler(Thing thing) { 53 | ThingTypeUID thingTypeUID = thing.getThingTypeUID(); 54 | 55 | if (THING_TYPE_MELCLOUD_ACCOUNT.equals(thingTypeUID)) { 56 | MelCloudAccountHandler handler = new MelCloudAccountHandler((Bridge) thing); 57 | registerDiscoveryService(handler); 58 | return handler; 59 | } else if (THING_TYPE_ACDEVICE.equals(thingTypeUID)) { 60 | MelCloudDeviceHandler handler = new MelCloudDeviceHandler(thing); 61 | return handler; 62 | } 63 | 64 | return null; 65 | } 66 | 67 | @Override 68 | protected void removeHandler(@NonNull ThingHandler thingHandler) { 69 | ServiceRegistration serviceRegistration = discoveryServiceRegistrations 70 | .get(thingHandler.getThing().getUID()); 71 | 72 | if (serviceRegistration != null) { 73 | serviceRegistration.unregister(); 74 | } 75 | } 76 | 77 | private void registerDiscoveryService(MelCloudAccountHandler handler) { 78 | MelCloudDiscoveryService discoveryService = new MelCloudDiscoveryService(handler); 79 | 80 | ServiceRegistration serviceRegistration = this.bundleContext 81 | .registerService(DiscoveryService.class, discoveryService, null); 82 | 83 | discoveryServiceRegistrations.put(handler.getThing().getUID(), serviceRegistration); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/melcloud/internal/api/json/WeatherObservation.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2019 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.melcloud.internal.api.json; 14 | 15 | import com.google.gson.annotations.Expose; 16 | import com.google.gson.annotations.SerializedName; 17 | 18 | /** 19 | * The {@link Structure} is responsible of JSON data For MELCloud API 20 | * WeatherObservation Data 21 | * Generated with jsonschema2pojo 22 | * 23 | * @author LucaCalcaterra - Initial contribution 24 | */ 25 | public class WeatherObservation { 26 | 27 | @SerializedName("Date") 28 | @Expose 29 | private String date; 30 | @SerializedName("Sunrise") 31 | @Expose 32 | private String sunrise; 33 | @SerializedName("Sunset") 34 | @Expose 35 | private String sunset; 36 | @SerializedName("Condition") 37 | @Expose 38 | private Integer condition; 39 | @SerializedName("ID") 40 | @Expose 41 | private Integer iD; 42 | @SerializedName("Humidity") 43 | @Expose 44 | private Integer humidity; 45 | @SerializedName("Temperature") 46 | @Expose 47 | private Integer temperature; 48 | @SerializedName("Icon") 49 | @Expose 50 | private String icon; 51 | @SerializedName("ConditionName") 52 | @Expose 53 | private String conditionName; 54 | @SerializedName("Day") 55 | @Expose 56 | private Integer day; 57 | @SerializedName("WeatherType") 58 | @Expose 59 | private Integer weatherType; 60 | 61 | public String getDate() { 62 | return date; 63 | } 64 | 65 | public void setDate(String date) { 66 | this.date = date; 67 | } 68 | 69 | public String getSunrise() { 70 | return sunrise; 71 | } 72 | 73 | public void setSunrise(String sunrise) { 74 | this.sunrise = sunrise; 75 | } 76 | 77 | public String getSunset() { 78 | return sunset; 79 | } 80 | 81 | public void setSunset(String sunset) { 82 | this.sunset = sunset; 83 | } 84 | 85 | public Integer getCondition() { 86 | return condition; 87 | } 88 | 89 | public void setCondition(Integer condition) { 90 | this.condition = condition; 91 | } 92 | 93 | public Integer getID() { 94 | return iD; 95 | } 96 | 97 | public void setID(Integer iD) { 98 | this.iD = iD; 99 | } 100 | 101 | public Integer getHumidity() { 102 | return humidity; 103 | } 104 | 105 | public void setHumidity(Integer humidity) { 106 | this.humidity = humidity; 107 | } 108 | 109 | public Integer getTemperature() { 110 | return temperature; 111 | } 112 | 113 | public void setTemperature(Integer temperature) { 114 | this.temperature = temperature; 115 | } 116 | 117 | public String getIcon() { 118 | return icon; 119 | } 120 | 121 | public void setIcon(String icon) { 122 | this.icon = icon; 123 | } 124 | 125 | public String getConditionName() { 126 | return conditionName; 127 | } 128 | 129 | public void setConditionName(String conditionName) { 130 | this.conditionName = conditionName; 131 | } 132 | 133 | public Integer getDay() { 134 | return day; 135 | } 136 | 137 | public void setDay(Integer day) { 138 | this.day = day; 139 | } 140 | 141 | public Integer getWeatherType() { 142 | return weatherType; 143 | } 144 | 145 | public void setWeatherType(Integer weatherType) { 146 | this.weatherType = weatherType; 147 | } 148 | 149 | } 150 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/melcloud/internal/api/json/Area.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2019 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.melcloud.internal.api.json; 14 | 15 | import java.util.List; 16 | 17 | import com.google.gson.annotations.Expose; 18 | import com.google.gson.annotations.SerializedName; 19 | 20 | /** 21 | * {@link Area} provides area specific information for JSON data returned from MELCloud API 22 | * Area Data 23 | * Generated with jsonschema2pojo 24 | * 25 | * @author Wietse van Buitenen - Initial contribution 26 | */ 27 | public class Area { 28 | 29 | @SerializedName("ID") 30 | @Expose 31 | private Integer iD; 32 | @SerializedName("Name") 33 | @Expose 34 | private String name; 35 | @SerializedName("BuildingId") 36 | @Expose 37 | private Integer buildingId; 38 | @SerializedName("FloorId") 39 | @Expose 40 | private Integer floorId; 41 | @SerializedName("AccessLevel") 42 | @Expose 43 | private Integer accessLevel; 44 | @SerializedName("DirectAccess") 45 | @Expose 46 | private Boolean directAccess; 47 | @SerializedName("EndDate") 48 | @Expose 49 | private Object endDate; 50 | @SerializedName("MinTemperature") 51 | @Expose 52 | private Integer minTemperature; 53 | @SerializedName("MaxTemperature") 54 | @Expose 55 | private Integer maxTemperature; 56 | @SerializedName("Expanded") 57 | @Expose 58 | private Boolean expanded; 59 | @SerializedName("Devices") 60 | @Expose 61 | private List devices = null; 62 | 63 | public Integer getID() { 64 | return iD; 65 | } 66 | 67 | public void setID(Integer iD) { 68 | this.iD = iD; 69 | } 70 | 71 | public Integer getBuildingId() { 72 | return buildingId; 73 | } 74 | 75 | public void setBuildingId(Integer buildingId) { 76 | this.buildingId = buildingId; 77 | } 78 | 79 | public Integer getFloorId() { 80 | return floorId; 81 | } 82 | 83 | public void setFloorId(Integer floorId) { 84 | this.floorId = floorId; 85 | } 86 | 87 | public Integer getAccessLevel() { 88 | return accessLevel; 89 | } 90 | 91 | public void setAccessLevel(Integer accessLevel) { 92 | this.accessLevel = accessLevel; 93 | } 94 | 95 | public Boolean getDirectAccess() { 96 | return directAccess; 97 | } 98 | 99 | public void setDirectAccess(Boolean directAccess) { 100 | this.directAccess = directAccess; 101 | } 102 | 103 | public Object getEndDate() { 104 | return endDate; 105 | } 106 | 107 | public void setEndDate(Object endDate) { 108 | this.endDate = endDate; 109 | } 110 | 111 | public String getName() { 112 | return name; 113 | } 114 | 115 | public void setName(String name) { 116 | this.name = name; 117 | } 118 | 119 | public List getDevices() { 120 | return devices; 121 | } 122 | 123 | public void setDevices(List devices) { 124 | this.devices = devices; 125 | } 126 | 127 | public Integer getMinTemperature() { 128 | return minTemperature; 129 | } 130 | 131 | public void setMinTemperature(Integer minTemperature) { 132 | this.minTemperature = minTemperature; 133 | } 134 | 135 | public Integer getMaxTemperature() { 136 | return maxTemperature; 137 | } 138 | 139 | public void setMaxTemperature(Integer maxTemperature) { 140 | this.maxTemperature = maxTemperature; 141 | } 142 | 143 | public Boolean getExpanded() { 144 | return expanded; 145 | } 146 | 147 | public void setExpanded(Boolean expanded) { 148 | this.expanded = expanded; 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/melcloud/internal/api/json/Floor.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2019 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.melcloud.internal.api.json; 14 | 15 | import java.util.List; 16 | 17 | import com.google.gson.annotations.Expose; 18 | import com.google.gson.annotations.SerializedName; 19 | 20 | /** 21 | * {@link Floor} provides floor specific information for JSON data returned from MELCloud API 22 | * Floor Data 23 | * Generated with jsonschema2pojo 24 | * 25 | * @author Wietse van Buitenen - Initial contribution 26 | */ 27 | public class Floor { 28 | 29 | @SerializedName("ID") 30 | @Expose 31 | private Integer iD; 32 | @SerializedName("Name") 33 | @Expose 34 | private String name; 35 | @SerializedName("BuildingId") 36 | @Expose 37 | private Integer buildingId; 38 | @SerializedName("AccessLevel") 39 | @Expose 40 | private Integer accessLevel; 41 | @SerializedName("DirectAccess") 42 | @Expose 43 | private Boolean directAccess; 44 | @SerializedName("EndDate") 45 | @Expose 46 | private Object endDate; 47 | @SerializedName("Areas") 48 | @Expose 49 | private List areas = null; 50 | @SerializedName("Devices") 51 | @Expose 52 | private List devices = null; 53 | @SerializedName("MinTemperature") 54 | @Expose 55 | private Integer minTemperature; 56 | @SerializedName("MaxTemperature") 57 | @Expose 58 | private Integer maxTemperature; 59 | @SerializedName("Expanded") 60 | @Expose 61 | private Boolean expanded; 62 | 63 | public Integer getID() { 64 | return iD; 65 | } 66 | 67 | public void setID(Integer iD) { 68 | this.iD = iD; 69 | } 70 | 71 | public Integer getBuildingId() { 72 | return buildingId; 73 | } 74 | 75 | public void setBuildingId(Integer buildingId) { 76 | this.buildingId = buildingId; 77 | } 78 | 79 | public Integer getAccessLevel() { 80 | return accessLevel; 81 | } 82 | 83 | public void setAccessLevel(Integer accessLevel) { 84 | this.accessLevel = accessLevel; 85 | } 86 | 87 | public Boolean getDirectAccess() { 88 | return directAccess; 89 | } 90 | 91 | public void setDirectAccess(Boolean directAccess) { 92 | this.directAccess = directAccess; 93 | } 94 | 95 | public Object getEndDate() { 96 | return endDate; 97 | } 98 | 99 | public void setEndDate(Object endDate) { 100 | this.endDate = endDate; 101 | } 102 | 103 | public String getName() { 104 | return name; 105 | } 106 | 107 | public void setName(String name) { 108 | this.name = name; 109 | } 110 | 111 | public List getAreas() { 112 | return areas; 113 | } 114 | 115 | public void setAreas(List areas) { 116 | this.areas = areas; 117 | } 118 | 119 | public List getDevices() { 120 | return devices; 121 | } 122 | 123 | public void setDevices(List devices) { 124 | this.devices = devices; 125 | } 126 | 127 | public Integer getMinTemperature() { 128 | return minTemperature; 129 | } 130 | 131 | public void setMinTemperature(Integer minTemperature) { 132 | this.minTemperature = minTemperature; 133 | } 134 | 135 | public Integer getMaxTemperature() { 136 | return maxTemperature; 137 | } 138 | 139 | public void setMaxTemperature(Integer maxTemperature) { 140 | this.maxTemperature = maxTemperature; 141 | } 142 | 143 | public Boolean getExpanded() { 144 | return expanded; 145 | } 146 | 147 | public void setExpanded(Boolean expanded) { 148 | this.expanded = expanded; 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/melcloud/internal/api/json/Preset.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2019 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.melcloud.internal.api.json; 14 | 15 | import com.google.gson.annotations.Expose; 16 | import com.google.gson.annotations.SerializedName; 17 | 18 | /** 19 | * The {@link Preset} is responsible of JSON data For MELCloud API 20 | * Preset data 21 | * Generated with jsonschema2pojo 22 | * 23 | * @author LucaCalcaterra - Initial contribution 24 | */ 25 | public class Preset { 26 | 27 | @SerializedName("SetTemperature") 28 | @Expose 29 | private Double setTemperature; 30 | @SerializedName("Power") 31 | @Expose 32 | private Boolean power; 33 | @SerializedName("OperationMode") 34 | @Expose 35 | private Integer operationMode; 36 | @SerializedName("VaneHorizontal") 37 | @Expose 38 | private Integer vaneHorizontal; 39 | @SerializedName("VaneVertical") 40 | @Expose 41 | private Integer vaneVertical; 42 | @SerializedName("FanSpeed") 43 | @Expose 44 | private Integer fanSpeed; 45 | @SerializedName("ID") 46 | @Expose 47 | private Integer iD; 48 | @SerializedName("Client") 49 | @Expose 50 | private Integer client; 51 | @SerializedName("D" + "eviceLocation") 52 | @Expose 53 | private Integer deviceLocation; 54 | @SerializedName("Number") 55 | @Expose 56 | private Integer number; 57 | @SerializedName("Configuration") 58 | @Expose 59 | private String configuration; 60 | @SerializedName("NumberDescription") 61 | @Expose 62 | private String numberDescription; 63 | 64 | public Double getSetTemperature() { 65 | return setTemperature; 66 | } 67 | 68 | public void setSetTemperature(Double setTemperature) { 69 | this.setTemperature = setTemperature; 70 | } 71 | 72 | public Boolean getPower() { 73 | return power; 74 | } 75 | 76 | public void setPower(Boolean power) { 77 | this.power = power; 78 | } 79 | 80 | public Integer getOperationMode() { 81 | return operationMode; 82 | } 83 | 84 | public void setOperationMode(Integer operationMode) { 85 | this.operationMode = operationMode; 86 | } 87 | 88 | public Integer getVaneHorizontal() { 89 | return vaneHorizontal; 90 | } 91 | 92 | public void setVaneHorizontal(Integer vaneHorizontal) { 93 | this.vaneHorizontal = vaneHorizontal; 94 | } 95 | 96 | public Integer getVaneVertical() { 97 | return vaneVertical; 98 | } 99 | 100 | public void setVaneVertical(Integer vaneVertical) { 101 | this.vaneVertical = vaneVertical; 102 | } 103 | 104 | public Integer getFanSpeed() { 105 | return fanSpeed; 106 | } 107 | 108 | public void setFanSpeed(Integer fanSpeed) { 109 | this.fanSpeed = fanSpeed; 110 | } 111 | 112 | public Integer getID() { 113 | return iD; 114 | } 115 | 116 | public void setID(Integer iD) { 117 | this.iD = iD; 118 | } 119 | 120 | public Integer getClient() { 121 | return client; 122 | } 123 | 124 | public void setClient(Integer client) { 125 | this.client = client; 126 | } 127 | 128 | public Integer getDeviceLocation() { 129 | return deviceLocation; 130 | } 131 | 132 | public void setDeviceLocation(Integer deviceLocation) { 133 | this.deviceLocation = deviceLocation; 134 | } 135 | 136 | public Integer getNumber() { 137 | return number; 138 | } 139 | 140 | public void setNumber(Integer number) { 141 | this.number = number; 142 | } 143 | 144 | public String getConfiguration() { 145 | return configuration; 146 | } 147 | 148 | public void setConfiguration(String configuration) { 149 | this.configuration = configuration; 150 | } 151 | 152 | public String getNumberDescription() { 153 | return numberDescription; 154 | } 155 | 156 | public void setNumberDescription(String numberDescription) { 157 | this.numberDescription = numberDescription; 158 | } 159 | 160 | } 161 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/melcloud/internal/api/json/LoginClientResponse.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2019 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.melcloud.internal.api.json; 14 | 15 | import java.util.List; 16 | 17 | import com.google.gson.annotations.Expose; 18 | import com.google.gson.annotations.SerializedName; 19 | 20 | /** 21 | * The {@link LoginClientResponse} is responsible of JSON data For MELCloud API 22 | * Response Data of Login. 23 | * Generated with jsonschema2pojo 24 | * 25 | * @author LucaCalcaterra - Initial contribution 26 | */ 27 | public class LoginClientResponse { 28 | 29 | @SerializedName("ErrorId") 30 | @Expose 31 | private Object errorId; 32 | @SerializedName("ErrorMessage") 33 | @Expose 34 | private Object errorMessage; 35 | @SerializedName("LoginStatus") 36 | @Expose 37 | private Integer loginStatus; 38 | @SerializedName("UserId") 39 | @Expose 40 | private Integer userId; 41 | @SerializedName("RandomKey") 42 | @Expose 43 | private Object randomKey; 44 | @SerializedName("AppVersionAnnouncement") 45 | @Expose 46 | private Object appVersionAnnouncement; 47 | @SerializedName("LoginData") 48 | @Expose 49 | private LoginData loginData; 50 | @SerializedName("ListPendingInvite") 51 | @Expose 52 | private List listPendingInvite = null; 53 | @SerializedName("ListOwnershipChangeRequest") 54 | @Expose 55 | private List listOwnershipChangeRequest = null; 56 | @SerializedName("ListPendingAnnouncement") 57 | @Expose 58 | private List listPendingAnnouncement = null; 59 | @SerializedName("LoginMinutes") 60 | @Expose 61 | private Integer loginMinutes; 62 | @SerializedName("LoginAttempts") 63 | @Expose 64 | private Integer loginAttempts; 65 | 66 | public Object getErrorId() { 67 | return errorId; 68 | } 69 | 70 | public void setErrorId(Object errorId) { 71 | this.errorId = errorId; 72 | } 73 | 74 | public Object getErrorMessage() { 75 | return errorMessage; 76 | } 77 | 78 | public void setErrorMessage(Object errorMessage) { 79 | this.errorMessage = errorMessage; 80 | } 81 | 82 | public Integer getLoginStatus() { 83 | return loginStatus; 84 | } 85 | 86 | public void setLoginStatus(Integer loginStatus) { 87 | this.loginStatus = loginStatus; 88 | } 89 | 90 | public Integer getUserId() { 91 | return userId; 92 | } 93 | 94 | public void setUserId(Integer userId) { 95 | this.userId = userId; 96 | } 97 | 98 | public Object getRandomKey() { 99 | return randomKey; 100 | } 101 | 102 | public void setRandomKey(Object randomKey) { 103 | this.randomKey = randomKey; 104 | } 105 | 106 | public Object getAppVersionAnnouncement() { 107 | return appVersionAnnouncement; 108 | } 109 | 110 | public void setAppVersionAnnouncement(Object appVersionAnnouncement) { 111 | this.appVersionAnnouncement = appVersionAnnouncement; 112 | } 113 | 114 | public LoginData getLoginData() { 115 | return loginData; 116 | } 117 | 118 | public void setLoginData(LoginData loginData) { 119 | this.loginData = loginData; 120 | } 121 | 122 | public List getListPendingInvite() { 123 | return listPendingInvite; 124 | } 125 | 126 | public void setListPendingInvite(List listPendingInvite) { 127 | this.listPendingInvite = listPendingInvite; 128 | } 129 | 130 | public List getListOwnershipChangeRequest() { 131 | return listOwnershipChangeRequest; 132 | } 133 | 134 | public void setListOwnershipChangeRequest(List listOwnershipChangeRequest) { 135 | this.listOwnershipChangeRequest = listOwnershipChangeRequest; 136 | } 137 | 138 | public List getListPendingAnnouncement() { 139 | return listPendingAnnouncement; 140 | } 141 | 142 | public void setListPendingAnnouncement(List listPendingAnnouncement) { 143 | this.listPendingAnnouncement = listPendingAnnouncement; 144 | } 145 | 146 | public Integer getLoginMinutes() { 147 | return loginMinutes; 148 | } 149 | 150 | public void setLoginMinutes(Integer loginMinutes) { 151 | this.loginMinutes = loginMinutes; 152 | } 153 | 154 | public Integer getLoginAttempts() { 155 | return loginAttempts; 156 | } 157 | 158 | public void setLoginAttempts(Integer loginAttempts) { 159 | this.loginAttempts = loginAttempts; 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/melcloud/internal/discovery/MelCloudDiscoveryService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2019 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.melcloud.internal.discovery; 14 | 15 | import static org.openhab.binding.melcloud.internal.MelCloudBindingConstants.THING_TYPE_ACDEVICE; 16 | 17 | import java.util.HashMap; 18 | import java.util.List; 19 | import java.util.Map; 20 | import java.util.concurrent.ScheduledFuture; 21 | import java.util.concurrent.TimeUnit; 22 | 23 | import org.eclipse.jdt.annotation.Nullable; 24 | import org.eclipse.smarthome.config.discovery.AbstractDiscoveryService; 25 | import org.eclipse.smarthome.config.discovery.DiscoveryResultBuilder; 26 | import org.eclipse.smarthome.core.thing.ThingUID; 27 | import org.openhab.binding.melcloud.internal.MelCloudBindingConstants; 28 | import org.openhab.binding.melcloud.internal.api.json.Device; 29 | import org.openhab.binding.melcloud.internal.exceptions.MelCloudCommException; 30 | import org.openhab.binding.melcloud.internal.handler.MelCloudAccountHandler; 31 | import org.osgi.service.component.annotations.Modified; 32 | import org.slf4j.Logger; 33 | import org.slf4j.LoggerFactory; 34 | 35 | /** 36 | * The {@link MelCloudDiscoveryService} creates things based on the configured location. 37 | * 38 | * @author Luca Calcaterra - Initial Contribution 39 | * @author Pauli Anttila - Refactoring 40 | */ 41 | public class MelCloudDiscoveryService extends AbstractDiscoveryService { 42 | private final Logger logger = LoggerFactory.getLogger(MelCloudDiscoveryService.class); 43 | 44 | private static final int DISCOVER_TIMEOUT_SECONDS = 10; 45 | 46 | private final MelCloudAccountHandler melCloudHandler; 47 | private ScheduledFuture scanTask; 48 | 49 | /** 50 | * Creates a MelCloudDiscoveryService with enabled autostart. 51 | */ 52 | public MelCloudDiscoveryService(MelCloudAccountHandler melCloudHandler) { 53 | super(MelCloudBindingConstants.DISCOVERABLE_THING_TYPE_UIDS, DISCOVER_TIMEOUT_SECONDS, true); 54 | this.melCloudHandler = melCloudHandler; 55 | } 56 | 57 | @Override 58 | protected void activate(Map configProperties) { 59 | super.activate(configProperties); 60 | } 61 | 62 | @Override 63 | @Modified 64 | protected void modified(Map configProperties) { 65 | super.modified(configProperties); 66 | } 67 | 68 | @Override 69 | protected void startBackgroundDiscovery() { 70 | discoverDevices(); 71 | } 72 | 73 | @Override 74 | protected void startScan() { 75 | if (this.scanTask != null) { 76 | scanTask.cancel(true); 77 | } 78 | this.scanTask = scheduler.schedule(() -> discoverDevices(), 0, TimeUnit.SECONDS); 79 | } 80 | 81 | @Override 82 | protected void stopScan() { 83 | super.stopScan(); 84 | 85 | if (this.scanTask != null) { 86 | this.scanTask.cancel(true); 87 | this.scanTask = null; 88 | } 89 | } 90 | 91 | private void discoverDevices() { 92 | logger.debug("Discover devices"); 93 | 94 | if (melCloudHandler != null) { 95 | try { 96 | List deviceList = melCloudHandler.getDeviceList(); 97 | 98 | if (deviceList == null) { 99 | logger.debug("No devices found"); 100 | } else { 101 | ThingUID bridgeUID = melCloudHandler.getThing().getUID(); 102 | 103 | deviceList.forEach(device -> { 104 | ThingUID deviceThing = new ThingUID(THING_TYPE_ACDEVICE, melCloudHandler.getThing().getUID(), 105 | device.getDeviceID().toString()); 106 | 107 | Map deviceProperties = new HashMap<>(); 108 | deviceProperties.put("deviceID", device.getDeviceID().toString()); 109 | deviceProperties.put("serialNumber", device.getSerialNumber().toString()); 110 | deviceProperties.put("macAddress", device.getMacAddress().toString()); 111 | deviceProperties.put("deviceName", device.getDeviceName().toString()); 112 | deviceProperties.put("buildingID", device.getBuildingID().toString()); 113 | 114 | String label = createLabel(device); 115 | logger.debug("Found device: {} : {}", label, deviceProperties); 116 | 117 | thingDiscovered(DiscoveryResultBuilder.create(deviceThing).withLabel(label) 118 | .withProperties(deviceProperties) 119 | .withRepresentationProperty(device.getDeviceID().toString()).withBridge(bridgeUID) 120 | .build()); 121 | }); 122 | } 123 | } catch (MelCloudCommException e) { 124 | logger.debug("Error occurred during device list fetch, reason {}. ", e.getMessage(), e); 125 | } 126 | } 127 | } 128 | 129 | private String createLabel(Device device) { 130 | StringBuilder sb = new StringBuilder(); 131 | sb.append("A.C. Device - "); 132 | if (device.getBuildingName() != null && device.getBuildingName() instanceof String) { 133 | sb.append(device.getBuildingName()).append(" - "); 134 | } 135 | sb.append(device.getDeviceName()); 136 | return sb.toString(); 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /src/main/resources/ESH-INF/thing/acDevice.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Air conditioning device 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | Device ID of the A.C. device 32 | 33 | 34 | 35 | Building ID of the A.C. device. 36 | 37 | 38 | 39 | Time interval how often poll data from MELCloud 40 | 60 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | Switch 50 | 51 | Power status of device 52 | 53 | 54 | Number 55 | 56 | Operation mode 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | Number:Temperature 69 | 70 | Set temperature 71 | 72 | 73 | 74 | Number 75 | 76 | Fan speed 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | Number 90 | 91 | Vane horizontal 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | Number 106 | 107 | Vane vertical 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | Number:Temperature 122 | 123 | Room temperature 124 | 125 | 126 | 127 | DateTime 128 | 129 | Last communication time between device and MELCloud 130 | 131 | 132 | 133 | DateTime 134 | 135 | Next communication time between device and MELCloud 136 | 137 | 138 | 139 | Switch 140 | 141 | Is device in offline state. 142 | 143 | 144 | 145 | Switch 146 | 147 | Device has a pending command(s) 148 | 149 | 150 | 151 | 152 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | ### N.B.: For developers who wants contribute not use this repo. Use Instead the openhab2-fork at https://github.com/lucacalcaterra/openhab2-addons 3 | # MELCloud Binding 4 | 5 | This is an openHAB binding for Mitsubishi MELCloud (https://www.melcloud.com/). 6 | Installing this binding you can control your Mitsubishi devices from openHAB without accessing the MELCloud App and benefiting from all openHAB automations. 7 | 8 | ## Supported Things 9 | 10 | Supported thing types 11 | 12 | * melcloudaccount (bridge) 13 | * acdevice 14 | 15 | A bridge is required to connect to your MELCloud account. 16 | 17 | 18 | ## Discovery 19 | 20 | Discovery is used _after_ a bridge has been created and configured with your login information. 21 | 22 | 1. Add the binding 23 | 2. Add a new thing of type melcloudaccount and configure with username and password 24 | 3. Go to Inbox and start discovery of A.C. devices using MELCloud Binding 25 | 4. A.C. devices should appear in your inbox 26 | 27 | Binding support also manual thing configuration by thing files. 28 | 29 | ## Thing Configuration 30 | 31 | In order to manually create a thing file and not use the discovery routine you will need to know device MELCloud device ID. 32 | This is a bit difficult to get. The easiest way of getting this is enable debug level logging of the binding or discovery devices by the binding (discovered device can be removed afterwards). 33 | 34 | MELCloud account configuration: 35 | 36 | | Config | Mandatory | Description | 37 | |----------|-----------|-----------------------------------------| 38 | | username | x | Email address tied to MELCloud account. | 39 | | password | x | Password to MELCloud account. | 40 | | language | | Language ID, see table below. | 41 | 42 | | LanguageId | Language | 43 | |-------------|-------------------| 44 | | 0 | English (default) | 45 | | 1 | Bulgarian | 46 | | 2 | Czech | 47 | | 3 | Danish | 48 | | 4 | German | 49 | | 5 | Estonian | 50 | | 6 | Spanish | 51 | | 7 | French | 52 | | 8 | Armenian | 53 | | 9 | Latvian | 54 | | 10 | Lithuanian | 55 | | 11 | Hungarian | 56 | | 12 | Dutch | 57 | | 13 | Norwegian | 58 | | 14 | Polish | 59 | | 15 | Portuguese | 60 | | 16 | Russian | 61 | | 17 | Finnish | 62 | | 18 | Swedish | 63 | | 19 | Italian | 64 | | 20 | Ukrainian | 65 | | 21 | Turkish | 66 | | 22 | Greek | 67 | | 23 | Croatian | 68 | | 24 | Romanian | 69 | | 25 | Slovenian | 70 | 71 | 72 | A.C. device configuration: 73 | 74 | | Config | Mandatory | Description | 75 | |-----------------|-----------|---------------------------------------------------------------------------------------| 76 | | deviceID | x | MELCloud device ID. | 77 | | buildingID | | MELCloud building ID. If not defined, binding tries to find matching id by device ID. | 78 | | pollingInterval | | Refresh time interval in seconds for updates from MELCloud. Defaults to 60 seconds. | 79 | 80 | 81 | 82 | ## Channels 83 | 84 | A.C. device channels 85 | 86 | | Channel | Type | Description | Read Only | 87 | |---------------------|----------|----------------------------------------------------------------------------|-----------| 88 | | power | Switch | Power Status of Device. | False | 89 | | operationMode | Number | Operation mode: 1 = Heat, 2 = Dry, 3 = Cool, 7 = Fan, 8 = Auto. | False | 90 | | setTemperature | Number | Set Temperature: Min = 10, Max = 40. | False | 91 | | fanSpeed | Number | Fan speed: 0 = Auto, 1 = 1, 2 = 2, 3 = 3, 4 = 4, 5 = 5. | False | 92 | | vaneHorizontal | Number | Vane Horizontal: 0 = Auto, 1 = 1, 2 = 2, 3 = 3, 4 = 4, 5 = 5, 12 = Swing. | False | 93 | | vaneVertical | Number | Vane Vertical: 0 = Auto, 1 = 1, 2 = 2, 3 = 3, 4 = 4, 5 = 5, 7 = Swing. | False | 94 | | roomTemperature | Number | Room temperature. | True | 95 | | lastCommunication | DateTime | Last Communication time when MELCloud communicated to the device. | True | 96 | | nextCommunication | DateTime | Next communication time when MELCloud will communicate to the device. | True | 97 | | offline | Switch | Is device in offline state. | True | 98 | | hasPendingCommand | Switch | Device has a pending command(s). | True | 99 | 100 | 101 | ## Full Example for items configuration 102 | 103 | **melcloud.things** 104 | 105 | ``` 106 | Bridge melcloud:melcloudaccount:myaccount "My MELCloud account" [ username="user.name@email.com", password="xxxxxx", language="0" ] { 107 | Thing acdevice livingroom "Livingroom A.C. device" [ deviceID=123456, pollingInterval=60 ] 108 | } 109 | ``` 110 | 111 | **melcloud.items** 112 | 113 | ``` 114 | Switch power { channel="melcloud:acdevice:myaccount:livingroom:power" } 115 | Number operationMode { channel="melcloud:acdevice:myaccount:livingroom:operationMode" } 116 | Number setTemperature { channel="melcloud:acdevice:myaccount:livingroom:setTemperature" } 117 | Number fanSpeed { channel="melcloud:acdevice:myaccount:livingroom:fanSpeed" } 118 | Number vaneHorizontal { channel="melcloud:acdevice:myaccount:livingroom:vaneHorizontal" } 119 | Number vaneVertical { channel="melcloud:acdevice:myaccount:livingroom:vaneVertical" } 120 | Number roomTemperature { channel="melcloud:acdevice:myaccount:livingroom:roomTemperature" } 121 | DateTime lastCommunication { channel="melcloud:acdevice:myaccount:livingroom:lastCommunication" } 122 | DateTime nextCommunication { channel="melcloud:acdevice:myaccount:livingroom:nextCommunication" } 123 | Switch offline { channel="melcloud:acdevice:myaccount:livingroom:offline" } 124 | Switch hasPendingCommand { channel="melcloud:acdevice:myaccount:livingroom:hasPendingCommand" } 125 | ``` 126 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/melcloud/internal/handler/MelCloudAccountHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2019 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.melcloud.internal.handler; 14 | 15 | import java.util.Collections; 16 | import java.util.List; 17 | import java.util.Optional; 18 | import java.util.concurrent.ScheduledFuture; 19 | import java.util.concurrent.TimeUnit; 20 | 21 | import org.eclipse.smarthome.core.thing.Bridge; 22 | import org.eclipse.smarthome.core.thing.ChannelUID; 23 | import org.eclipse.smarthome.core.thing.ThingStatus; 24 | import org.eclipse.smarthome.core.thing.ThingStatusDetail; 25 | import org.eclipse.smarthome.core.thing.ThingUID; 26 | import org.eclipse.smarthome.core.thing.binding.BaseBridgeHandler; 27 | import org.eclipse.smarthome.core.types.Command; 28 | import org.openhab.binding.melcloud.internal.api.MelCloudConnection; 29 | import org.openhab.binding.melcloud.internal.api.json.Device; 30 | import org.openhab.binding.melcloud.internal.api.json.DeviceStatus; 31 | import org.openhab.binding.melcloud.internal.config.AccountConfig; 32 | import org.openhab.binding.melcloud.internal.exceptions.MelCloudCommException; 33 | import org.openhab.binding.melcloud.internal.exceptions.MelCloudLoginException; 34 | import org.slf4j.Logger; 35 | import org.slf4j.LoggerFactory; 36 | 37 | /** 38 | * {@link MelCloudAccountHandler} is the handler for MELCloud API and connects it 39 | * to the webservice. 40 | * 41 | * @author Luca Calcaterra - Initial contribution 42 | * @author Pauli Anttila - Refactoring 43 | * @author Wietse van Buitenen - Return all devices 44 | */ 45 | public class MelCloudAccountHandler extends BaseBridgeHandler { 46 | private final Logger logger = LoggerFactory.getLogger(MelCloudAccountHandler.class); 47 | 48 | private MelCloudConnection connection; 49 | private List devices; 50 | private ScheduledFuture connectionCheckTask; 51 | private AccountConfig config; 52 | private boolean loginCredentialError; 53 | 54 | public MelCloudAccountHandler(Bridge bridge) { 55 | super(bridge); 56 | } 57 | 58 | @Override 59 | public void initialize() { 60 | logger.debug("Initializing MELCloud account handler."); 61 | config = getThing().getConfiguration().as(AccountConfig.class); 62 | connection = new MelCloudConnection(); 63 | devices = Collections.emptyList(); 64 | loginCredentialError = false; 65 | scheduler.execute(() -> { 66 | try { 67 | connect(); 68 | } catch (MelCloudCommException e) { 69 | logger.debug("Cannot open the connection to MELCloud, reason: {}", e.getMessage()); 70 | } finally { 71 | startConnectionCheck(); 72 | } 73 | }); 74 | } 75 | 76 | @Override 77 | public void dispose() { 78 | logger.debug("Running dispose()"); 79 | stopConnectionCheck(); 80 | connection = null; 81 | devices = Collections.emptyList(); 82 | config = null; 83 | } 84 | 85 | @Override 86 | public void handleCommand(ChannelUID channelUID, Command command) { 87 | } 88 | 89 | public ThingUID getID() { 90 | return getThing().getUID(); 91 | } 92 | 93 | public List getDeviceList() throws MelCloudCommException, MelCloudLoginException { 94 | connectIfNotConnected(); 95 | return connection.fetchDeviceList(); 96 | } 97 | 98 | private void connect() throws MelCloudCommException, MelCloudLoginException { 99 | if (loginCredentialError) { 100 | throw new MelCloudLoginException("Connection to MELCloud can't be open because of wrong credentials"); 101 | } 102 | logger.debug("Initializing connection to MELCloud"); 103 | updateStatus(ThingStatus.OFFLINE); 104 | try { 105 | connection.login(config.username, config.password, config.language); 106 | devices = connection.fetchDeviceList(); 107 | updateStatus(ThingStatus.ONLINE); 108 | } catch (MelCloudLoginException e) { 109 | updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, e.getMessage()); 110 | loginCredentialError = true; 111 | throw e; 112 | } catch (MelCloudCommException e) { 113 | updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage()); 114 | throw e; 115 | } 116 | } 117 | 118 | private synchronized void connectIfNotConnected() throws MelCloudCommException, MelCloudLoginException { 119 | if (!isConnected()) { 120 | connect(); 121 | } 122 | } 123 | 124 | public boolean isConnected() { 125 | return connection.isConnected(); 126 | } 127 | 128 | public DeviceStatus sendDeviceStatus(DeviceStatus deviceStatus) 129 | throws MelCloudCommException, MelCloudLoginException { 130 | connectIfNotConnected(); 131 | try { 132 | return connection.sendDeviceStatus(deviceStatus); 133 | } catch (MelCloudLoginException e) { 134 | throw e; 135 | } catch (MelCloudCommException e) { 136 | logger.debug("Sending failed, retry once with relogin"); 137 | connect(); 138 | return connection.sendDeviceStatus(deviceStatus); 139 | } 140 | } 141 | 142 | public DeviceStatus fetchDeviceStatus(int deviceId, Optional buildingId) 143 | throws MelCloudCommException, MelCloudLoginException { 144 | connectIfNotConnected(); 145 | int bid = buildingId.orElse(findBuildingId(deviceId)); 146 | 147 | try { 148 | return connection.fetchDeviceStatus(deviceId, bid); 149 | } catch (MelCloudLoginException e) { 150 | throw e; 151 | } catch (MelCloudCommException e) { 152 | logger.debug("Sending failed, retry once with relogin"); 153 | connect(); 154 | return connection.fetchDeviceStatus(deviceId, bid); 155 | } 156 | } 157 | 158 | private int findBuildingId(int deviceId) throws MelCloudCommException { 159 | if (devices != null) { 160 | return devices.stream().filter(d -> d.getDeviceID() == deviceId).findFirst().orElseThrow( 161 | () -> new MelCloudCommException(String.format("Can't find building id for device id %s", deviceId))) 162 | .getBuildingID(); 163 | } 164 | throw new MelCloudCommException(String.format("Can't find building id for device id %s", deviceId)); 165 | } 166 | 167 | private void startConnectionCheck() { 168 | if (connectionCheckTask == null || connectionCheckTask.isCancelled()) { 169 | logger.debug("Start periodic connection check"); 170 | Runnable runnable = () -> { 171 | logger.debug("Check MELCloud connection"); 172 | if (connection.isConnected()) { 173 | logger.debug("Connection to MELCloud open"); 174 | } else { 175 | try { 176 | connect(); 177 | } catch (MelCloudCommException e) { 178 | logger.debug("Connection to MELCloud down"); 179 | } catch (RuntimeException e) { 180 | logger.warn("Unknown error occured during connection check, reason: {}.", e.getMessage(), e); 181 | } 182 | } 183 | }; 184 | connectionCheckTask = scheduler.scheduleWithFixedDelay(runnable, 30, 60, TimeUnit.SECONDS); 185 | } else { 186 | logger.debug("Connection check task already running"); 187 | } 188 | } 189 | 190 | private void stopConnectionCheck() { 191 | if (connectionCheckTask != null) { 192 | logger.debug("Stop periodic connection check"); 193 | connectionCheckTask.cancel(true); 194 | connectionCheckTask = null; 195 | } 196 | } 197 | } 198 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/melcloud/internal/api/MelCloudConnection.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2019 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.melcloud.internal.api; 14 | 15 | import java.io.ByteArrayInputStream; 16 | import java.io.IOException; 17 | import java.io.InputStream; 18 | import java.nio.charset.StandardCharsets; 19 | import java.util.ArrayList; 20 | import java.util.Arrays; 21 | import java.util.List; 22 | import java.util.Properties; 23 | 24 | import org.eclipse.smarthome.io.net.http.HttpUtil; 25 | import org.openhab.binding.melcloud.internal.api.json.Device; 26 | import org.openhab.binding.melcloud.internal.api.json.DeviceStatus; 27 | import org.openhab.binding.melcloud.internal.api.json.ListDevicesResponse; 28 | import org.openhab.binding.melcloud.internal.api.json.LoginClientResponse; 29 | import org.openhab.binding.melcloud.internal.exceptions.MelCloudCommException; 30 | import org.openhab.binding.melcloud.internal.exceptions.MelCloudLoginException; 31 | import org.slf4j.Logger; 32 | import org.slf4j.LoggerFactory; 33 | 34 | import com.google.gson.Gson; 35 | import com.google.gson.GsonBuilder; 36 | import com.google.gson.JsonObject; 37 | import com.google.gson.JsonSyntaxException; 38 | 39 | /** 40 | * The {@link MelCloudConnection} Manage connection to Mitsubishi Cloud (MelCloud). 41 | * 42 | * @author Luca Calcaterra - Initial Contribution 43 | * @author Pauli Anttila - Refactoring 44 | * @author Wietse van Buitenen - Return all devices 45 | */ 46 | public class MelCloudConnection { 47 | 48 | private static final String LOGIN_URL = "https://app.melcloud.com/Mitsubishi.Wifi.Client/Login/ClientLogin"; 49 | private static final String DEVICE_LIST_URL = "https://app.melcloud.com/Mitsubishi.Wifi.Client/User/ListDevices"; 50 | private static final String DEVICE_URL = "https://app.melcloud.com/Mitsubishi.Wifi.Client/Device"; 51 | 52 | private static final int TIMEOUT = 10000; 53 | 54 | // Gson objects are safe to share across threads and are somewhat expensive to construct. Use a single instance. 55 | private static final Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); 56 | 57 | private final Logger logger = LoggerFactory.getLogger(MelCloudConnection.class); 58 | 59 | private boolean isConnected = false; 60 | private String sessionKey; 61 | 62 | public void login(String username, String password, int languageId) 63 | throws MelCloudCommException, MelCloudLoginException { 64 | setConnected(false); 65 | sessionKey = null; 66 | JsonObject jsonReq = new JsonObject(); 67 | jsonReq.addProperty("Email", username); 68 | jsonReq.addProperty("Password", password); 69 | jsonReq.addProperty("Language", languageId); 70 | jsonReq.addProperty("AppVersion", "1.17.5.0"); 71 | jsonReq.addProperty("Persist", false); 72 | jsonReq.addProperty("CaptchaResponse", (String) null); 73 | InputStream data = new ByteArrayInputStream(jsonReq.toString().getBytes(StandardCharsets.UTF_8)); 74 | 75 | try { 76 | String loginResponse = HttpUtil.executeUrl("POST", LOGIN_URL, null, data, "application/json", TIMEOUT); 77 | logger.debug("Login response: {}", loginResponse); 78 | LoginClientResponse resp = gson.fromJson(loginResponse, LoginClientResponse.class); 79 | if (resp.getErrorId() != null) { 80 | 81 | String errorMsg = String.format("Login failed, error code: %s", resp.getErrorId()); 82 | if (resp.getErrorMessage() != null) { 83 | errorMsg.concat(String.format(" (%s)", resp.getErrorMessage())); 84 | } 85 | throw new MelCloudLoginException(errorMsg); 86 | } 87 | sessionKey = resp.getLoginData().getContextKey(); 88 | setConnected(true); 89 | } catch (IOException | JsonSyntaxException e) { 90 | throw new MelCloudCommException(String.format("Login error, reason: %s", e.getMessage(), e)); 91 | } 92 | } 93 | 94 | public List fetchDeviceList() throws MelCloudCommException { 95 | if (isConnected()) { 96 | try { 97 | String response = HttpUtil.executeUrl("GET", DEVICE_LIST_URL, getHeaderProperties(), null, null, 98 | TIMEOUT); 99 | logger.debug("Device list response: {}", response); 100 | List devices = new ArrayList(); 101 | ListDevicesResponse[] buildings = gson.fromJson(response, ListDevicesResponse[].class); 102 | Arrays.asList(buildings).forEach(building -> { 103 | if (building.getStructure().getDevices() != null) { 104 | devices.addAll(building.getStructure().getDevices()); 105 | } 106 | 107 | building.getStructure().getFloors().forEach(floor -> { 108 | if (floor.getDevices() != null) { 109 | devices.addAll(floor.getDevices()); 110 | } 111 | 112 | floor.getAreas().forEach(area -> { 113 | if (area.getDevices() != null) { 114 | devices.addAll(area.getDevices()); 115 | } 116 | }); 117 | }); 118 | 119 | }); 120 | logger.debug("Found {} devices", devices.size()); 121 | 122 | return devices; 123 | } catch (IOException | JsonSyntaxException e) { 124 | setConnected(false); 125 | throw new MelCloudCommException("Error occured during device list poll", e); 126 | } 127 | } 128 | throw new MelCloudCommException("Not connected to MELCloud"); 129 | } 130 | 131 | public DeviceStatus fetchDeviceStatus(int deviceId, int buildingId) throws MelCloudCommException { 132 | if (isConnected()) { 133 | String url = DEVICE_URL + String.format("/Get?id=%d&buildingID=%d", deviceId, buildingId); 134 | try { 135 | String response = HttpUtil.executeUrl("GET", url, getHeaderProperties(), null, null, TIMEOUT); 136 | logger.debug("Device status response: {}", response); 137 | DeviceStatus deviceStatus = gson.fromJson(response, DeviceStatus.class); 138 | return deviceStatus; 139 | } catch (IOException | JsonSyntaxException e) { 140 | setConnected(false); 141 | throw new MelCloudCommException("Error occured during device status fetch", e); 142 | } 143 | } 144 | throw new MelCloudCommException("Not connected to MELCloud"); 145 | } 146 | 147 | public DeviceStatus sendDeviceStatus(DeviceStatus deviceStatus) throws MelCloudCommException { 148 | if (isConnected()) { 149 | String content = gson.toJson(deviceStatus, DeviceStatus.class); 150 | logger.debug("Sending device status: {}", content); 151 | InputStream data = new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8)); 152 | try { 153 | String response = HttpUtil.executeUrl("POST", DEVICE_URL + "/SetAta", getHeaderProperties(), data, 154 | "application/json", TIMEOUT); 155 | logger.debug("Device status sending response: {}", response); 156 | return gson.fromJson(response, DeviceStatus.class); 157 | } catch (IOException | JsonSyntaxException e) { 158 | setConnected(false); 159 | throw new MelCloudCommException("Error occured during device command sending", e); 160 | } 161 | } 162 | throw new MelCloudCommException("Not connected to MELCloud"); 163 | } 164 | 165 | public synchronized boolean isConnected() { 166 | return isConnected; 167 | } 168 | 169 | private synchronized void setConnected(boolean state) { 170 | isConnected = state; 171 | } 172 | 173 | private Properties getHeaderProperties() { 174 | Properties headers = new Properties(); 175 | headers.put("X-MitsContextKey", sessionKey); 176 | return headers; 177 | } 178 | } 179 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/melcloud/internal/api/json/DeviceStatus.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2019 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.melcloud.internal.api.json; 14 | 15 | import java.util.List; 16 | 17 | import com.google.gson.annotations.Expose; 18 | import com.google.gson.annotations.SerializedName; 19 | 20 | /** 21 | * The {@link DeviceProps} is responsible of JSON data For MELCloud API 22 | * Device Status data 23 | * Generated with jsonschema2pojo 24 | * 25 | * @author LucaCalcaterra - Initial contribution 26 | * @author Pauli Anttila - Fine tuned expose annotations 27 | */ 28 | public class DeviceStatus { 29 | 30 | @SerializedName("EffectiveFlags") 31 | @Expose 32 | private Integer effectiveFlags; 33 | 34 | @SerializedName("LocalIPAddress") 35 | @Expose(serialize = false, deserialize = true) 36 | private Object localIPAddress; 37 | 38 | @SerializedName("RoomTemperature") 39 | @Expose(serialize = false, deserialize = true) 40 | private Double roomTemperature; 41 | 42 | @SerializedName("SetTemperature") 43 | @Expose 44 | private Double setTemperature; 45 | 46 | @SerializedName("SetFanSpeed") 47 | @Expose 48 | private Integer setFanSpeed; 49 | 50 | @SerializedName("OperationMode") 51 | @Expose 52 | private Integer operationMode; 53 | 54 | @SerializedName("VaneHorizontal") 55 | @Expose 56 | private Integer vaneHorizontal; 57 | 58 | @SerializedName("VaneVertical") 59 | @Expose 60 | private Integer vaneVertical; 61 | 62 | @SerializedName("Name") 63 | @Expose 64 | private Object name; 65 | 66 | @SerializedName("NumberOfFanSpeeds") 67 | @Expose(serialize = false, deserialize = true) 68 | private Integer numberOfFanSpeeds; 69 | 70 | @SerializedName("WeatherObservations") 71 | @Expose(serialize = false, deserialize = true) 72 | private List weatherObservations = null; 73 | 74 | @SerializedName("ErrorMessage") 75 | @Expose(serialize = false, deserialize = true) 76 | private Object errorMessage; 77 | 78 | @SerializedName("ErrorCode") 79 | @Expose(serialize = false, deserialize = true) 80 | private Integer errorCode; 81 | 82 | @SerializedName("DefaultHeatingSetTemperature") 83 | @Expose(serialize = false, deserialize = true) 84 | private Double defaultHeatingSetTemperature; 85 | 86 | @SerializedName("DefaultCoolingSetTemperature") 87 | @Expose(serialize = false, deserialize = true) 88 | private Double defaultCoolingSetTemperature; 89 | 90 | @SerializedName("HideVaneControls") 91 | @Expose(serialize = false, deserialize = true) 92 | private Boolean hideVaneControls; 93 | 94 | @SerializedName("HideDryModeControl") 95 | @Expose(serialize = false, deserialize = true) 96 | private Boolean hideDryModeControl; 97 | 98 | @SerializedName("RoomTemperatureLabel") 99 | @Expose(serialize = false, deserialize = true) 100 | private Integer roomTemperatureLabel; 101 | 102 | @SerializedName("InStandbyMode") 103 | @Expose(serialize = false, deserialize = true) 104 | private Boolean inStandbyMode; 105 | 106 | @SerializedName("TemperatureIncrementOverride") 107 | @Expose(serialize = false, deserialize = true) 108 | private Integer temperatureIncrementOverride; 109 | 110 | @SerializedName("DeviceID") 111 | @Expose 112 | private Integer deviceID; 113 | 114 | @SerializedName("DeviceType") 115 | @Expose(serialize = false, deserialize = true) 116 | private Integer deviceType; 117 | 118 | @SerializedName("LastCommunication") 119 | @Expose(serialize = false, deserialize = true) 120 | private String lastCommunication; 121 | 122 | @SerializedName("NextCommunication") 123 | @Expose(serialize = false, deserialize = true) 124 | private String nextCommunication; 125 | 126 | @SerializedName("Power") 127 | @Expose 128 | private Boolean power; 129 | 130 | @SerializedName("HasPendingCommand") 131 | @Expose 132 | private Boolean hasPendingCommand; 133 | 134 | @SerializedName("Offline") 135 | @Expose(serialize = false, deserialize = true) 136 | private Boolean offline; 137 | 138 | @SerializedName("Scene") 139 | @Expose(serialize = false, deserialize = true) 140 | private Object scene; 141 | 142 | @SerializedName("SceneOwner") 143 | @Expose(serialize = false, deserialize = true) 144 | private Object sceneOwner; 145 | 146 | public Integer getEffectiveFlags() { 147 | return effectiveFlags; 148 | } 149 | 150 | public void setEffectiveFlags(Integer effectiveFlags) { 151 | this.effectiveFlags = effectiveFlags; 152 | } 153 | 154 | public Object getLocalIPAddress() { 155 | return localIPAddress; 156 | } 157 | 158 | public void setLocalIPAddress(Object localIPAddress) { 159 | this.localIPAddress = localIPAddress; 160 | } 161 | 162 | public Double getRoomTemperature() { 163 | return roomTemperature; 164 | } 165 | 166 | public void setRoomTemperature(Double roomTemperature) { 167 | this.roomTemperature = roomTemperature; 168 | } 169 | 170 | public Double getSetTemperature() { 171 | return setTemperature; 172 | } 173 | 174 | public void setSetTemperature(Double setTemperature) { 175 | this.setTemperature = setTemperature; 176 | } 177 | 178 | public Integer getSetFanSpeed() { 179 | return setFanSpeed; 180 | } 181 | 182 | public void setSetFanSpeed(Integer setFanSpeed) { 183 | this.setFanSpeed = setFanSpeed; 184 | } 185 | 186 | public Integer getOperationMode() { 187 | return operationMode; 188 | } 189 | 190 | public void setOperationMode(Integer operationMode) { 191 | this.operationMode = operationMode; 192 | } 193 | 194 | public Integer getVaneHorizontal() { 195 | return vaneHorizontal; 196 | } 197 | 198 | public void setVaneHorizontal(Integer vaneHorizontal) { 199 | this.vaneHorizontal = vaneHorizontal; 200 | } 201 | 202 | public Integer getVaneVertical() { 203 | return vaneVertical; 204 | } 205 | 206 | public void setVaneVertical(Integer vaneVertical) { 207 | this.vaneVertical = vaneVertical; 208 | } 209 | 210 | public Object getName() { 211 | return name; 212 | } 213 | 214 | public void setName(Object name) { 215 | this.name = name; 216 | } 217 | 218 | public Integer getNumberOfFanSpeeds() { 219 | return numberOfFanSpeeds; 220 | } 221 | 222 | public void setNumberOfFanSpeeds(Integer numberOfFanSpeeds) { 223 | this.numberOfFanSpeeds = numberOfFanSpeeds; 224 | } 225 | 226 | public List getWeatherObservations() { 227 | return weatherObservations; 228 | } 229 | 230 | public void setWeatherObservations(List weatherObservations) { 231 | this.weatherObservations = weatherObservations; 232 | } 233 | 234 | public Object getErrorMessage() { 235 | return errorMessage; 236 | } 237 | 238 | public void setErrorMessage(Object errorMessage) { 239 | this.errorMessage = errorMessage; 240 | } 241 | 242 | public Integer getErrorCode() { 243 | return errorCode; 244 | } 245 | 246 | public void setErrorCode(Integer errorCode) { 247 | this.errorCode = errorCode; 248 | } 249 | 250 | public Double getDefaultHeatingSetTemperature() { 251 | return defaultHeatingSetTemperature; 252 | } 253 | 254 | public void setDefaultHeatingSetTemperature(Double defaultHeatingSetTemperature) { 255 | this.defaultHeatingSetTemperature = defaultHeatingSetTemperature; 256 | } 257 | 258 | public Double getDefaultCoolingSetTemperature() { 259 | return defaultCoolingSetTemperature; 260 | } 261 | 262 | public void setDefaultCoolingSetTemperature(Double defaultCoolingSetTemperature) { 263 | this.defaultCoolingSetTemperature = defaultCoolingSetTemperature; 264 | } 265 | 266 | public Boolean getHideVaneControls() { 267 | return hideVaneControls; 268 | } 269 | 270 | public void setHideVaneControls(Boolean hideVaneControls) { 271 | this.hideVaneControls = hideVaneControls; 272 | } 273 | 274 | public Boolean getHideDryModeControl() { 275 | return hideDryModeControl; 276 | } 277 | 278 | public void setHideDryModeControl(Boolean hideDryModeControl) { 279 | this.hideDryModeControl = hideDryModeControl; 280 | } 281 | 282 | public Integer getRoomTemperatureLabel() { 283 | return roomTemperatureLabel; 284 | } 285 | 286 | public void setRoomTemperatureLabel(Integer roomTemperatureLabel) { 287 | this.roomTemperatureLabel = roomTemperatureLabel; 288 | } 289 | 290 | public Boolean getInStandbyMode() { 291 | return inStandbyMode; 292 | } 293 | 294 | public void setInStandbyMode(Boolean inStandbyMode) { 295 | this.inStandbyMode = inStandbyMode; 296 | } 297 | 298 | public Integer getTemperatureIncrementOverride() { 299 | return temperatureIncrementOverride; 300 | } 301 | 302 | public void setTemperatureIncrementOverride(Integer temperatureIncrementOverride) { 303 | this.temperatureIncrementOverride = temperatureIncrementOverride; 304 | } 305 | 306 | public Integer getDeviceID() { 307 | return deviceID; 308 | } 309 | 310 | public void setDeviceID(Integer deviceID) { 311 | this.deviceID = deviceID; 312 | } 313 | 314 | public Integer getDeviceType() { 315 | return deviceType; 316 | } 317 | 318 | public void setDeviceType(Integer deviceType) { 319 | this.deviceType = deviceType; 320 | } 321 | 322 | public String getLastCommunication() { 323 | return lastCommunication; 324 | } 325 | 326 | public void setLastCommunication(String lastCommunication) { 327 | this.lastCommunication = lastCommunication; 328 | } 329 | 330 | public String getNextCommunication() { 331 | return nextCommunication; 332 | } 333 | 334 | public void setNextCommunication(String nextCommunication) { 335 | this.nextCommunication = nextCommunication; 336 | } 337 | 338 | public Boolean getPower() { 339 | return power; 340 | } 341 | 342 | public void setPower(Boolean power) { 343 | this.power = power; 344 | } 345 | 346 | public Boolean getHasPendingCommand() { 347 | return hasPendingCommand; 348 | } 349 | 350 | public void setHasPendingCommand(Boolean hasPendingCommand) { 351 | this.hasPendingCommand = hasPendingCommand; 352 | } 353 | 354 | public Boolean getOffline() { 355 | return offline; 356 | } 357 | 358 | public void setOffline(Boolean offline) { 359 | this.offline = offline; 360 | } 361 | 362 | public Object getScene() { 363 | return scene; 364 | } 365 | 366 | public void setScene(Object scene) { 367 | this.scene = scene; 368 | } 369 | 370 | public Object getSceneOwner() { 371 | return sceneOwner; 372 | } 373 | 374 | public void setSceneOwner(Object sceneOwner) { 375 | this.sceneOwner = sceneOwner; 376 | } 377 | } 378 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/melcloud/internal/api/json/ListDevicesResponse.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2019 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.melcloud.internal.api.json; 14 | 15 | import com.google.gson.annotations.Expose; 16 | import com.google.gson.annotations.SerializedName; 17 | 18 | /** 19 | * The {@link ListDevicesResponse} is responsible of JSON data For MELCloud API 20 | * Response of Devices List. 21 | * Generated with jsonschema2pojo 22 | * 23 | * @author LucaCalcaterra - Initial contribution 24 | */ 25 | public class ListDevicesResponse { 26 | 27 | @SerializedName("ID") 28 | @Expose 29 | private Integer iD; 30 | @SerializedName("Name") 31 | @Expose 32 | private String name; 33 | @SerializedName("AddressLine1") 34 | @Expose 35 | private String addressLine1; 36 | @SerializedName("AddressLine2") 37 | @Expose 38 | private Object addressLine2; 39 | @SerializedName("City") 40 | @Expose 41 | private String city; 42 | @SerializedName("Postcode") 43 | @Expose 44 | private String postcode; 45 | @SerializedName("Latitude") 46 | @Expose 47 | private Double latitude; 48 | @SerializedName("Longitude") 49 | @Expose 50 | private Double longitude; 51 | @SerializedName("District") 52 | @Expose 53 | private Object district; 54 | @SerializedName("FPDefined") 55 | @Expose 56 | private Boolean fPDefined; 57 | @SerializedName("FPEnabled") 58 | @Expose 59 | private Boolean fPEnabled; 60 | @SerializedName("FPMinTemperature") 61 | @Expose 62 | private Integer fPMinTemperature; 63 | @SerializedName("FPMaxTemperature") 64 | @Expose 65 | private Integer fPMaxTemperature; 66 | @SerializedName("HMDefined") 67 | @Expose 68 | private Boolean hMDefined; 69 | @SerializedName("HMEnabled") 70 | @Expose 71 | private Boolean hMEnabled; 72 | @SerializedName("HMStartDate") 73 | @Expose 74 | private Object hMStartDate; 75 | @SerializedName("HMEndDate") 76 | @Expose 77 | private Object hMEndDate; 78 | @SerializedName("BuildingType") 79 | @Expose 80 | private Integer buildingType; 81 | @SerializedName("PropertyType") 82 | @Expose 83 | private Integer propertyType; 84 | @SerializedName("DateBuilt") 85 | @Expose 86 | private String dateBuilt; 87 | @SerializedName("HasGasSupply") 88 | @Expose 89 | private Boolean hasGasSupply; 90 | @SerializedName("LocationLookupDate") 91 | @Expose 92 | private String locationLookupDate; 93 | @SerializedName("Country") 94 | @Expose 95 | private Integer country; 96 | @SerializedName("TimeZoneContinent") 97 | @Expose 98 | private Integer timeZoneContinent; 99 | @SerializedName("TimeZoneCity") 100 | @Expose 101 | private Integer timeZoneCity; 102 | @SerializedName("TimeZone") 103 | @Expose 104 | private Integer timeZone; 105 | @SerializedName("Location") 106 | @Expose 107 | private Integer location; 108 | @SerializedName("CoolingDisabled") 109 | @Expose 110 | private Boolean coolingDisabled; 111 | @SerializedName("Expanded") 112 | @Expose 113 | private Boolean expanded; 114 | @SerializedName("Structure") 115 | @Expose 116 | private Structure structure; 117 | @SerializedName("AccessLevel") 118 | @Expose 119 | private Integer accessLevel; 120 | @SerializedName("DirectAccess") 121 | @Expose 122 | private Boolean directAccess; 123 | @SerializedName("MinTemperature") 124 | @Expose 125 | private Integer minTemperature; 126 | @SerializedName("MaxTemperature") 127 | @Expose 128 | private Integer maxTemperature; 129 | @SerializedName("Owner") 130 | @Expose 131 | private Object owner; 132 | @SerializedName("EndDate") 133 | @Expose 134 | private String endDate; 135 | @SerializedName("iDateBuilt") 136 | @Expose 137 | private Object iDateBuilt; 138 | @SerializedName("QuantizedCoordinates") 139 | @Expose 140 | private QuantizedCoordinates quantizedCoordinates; 141 | 142 | public Integer getID() { 143 | return iD; 144 | } 145 | 146 | public void setID(Integer iD) { 147 | this.iD = iD; 148 | } 149 | 150 | public String getName() { 151 | return name; 152 | } 153 | 154 | public void setName(String name) { 155 | this.name = name; 156 | } 157 | 158 | public String getAddressLine1() { 159 | return addressLine1; 160 | } 161 | 162 | public void setAddressLine1(String addressLine1) { 163 | this.addressLine1 = addressLine1; 164 | } 165 | 166 | public Object getAddressLine2() { 167 | return addressLine2; 168 | } 169 | 170 | public void setAddressLine2(Object addressLine2) { 171 | this.addressLine2 = addressLine2; 172 | } 173 | 174 | public String getCity() { 175 | return city; 176 | } 177 | 178 | public void setCity(String city) { 179 | this.city = city; 180 | } 181 | 182 | public String getPostcode() { 183 | return postcode; 184 | } 185 | 186 | public void setPostcode(String postcode) { 187 | this.postcode = postcode; 188 | } 189 | 190 | public Double getLatitude() { 191 | return latitude; 192 | } 193 | 194 | public void setLatitude(Double latitude) { 195 | this.latitude = latitude; 196 | } 197 | 198 | public Double getLongitude() { 199 | return longitude; 200 | } 201 | 202 | public void setLongitude(Double longitude) { 203 | this.longitude = longitude; 204 | } 205 | 206 | public Object getDistrict() { 207 | return district; 208 | } 209 | 210 | public void setDistrict(Object district) { 211 | this.district = district; 212 | } 213 | 214 | public Boolean getFPDefined() { 215 | return fPDefined; 216 | } 217 | 218 | public void setFPDefined(Boolean fPDefined) { 219 | this.fPDefined = fPDefined; 220 | } 221 | 222 | public Boolean getFPEnabled() { 223 | return fPEnabled; 224 | } 225 | 226 | public void setFPEnabled(Boolean fPEnabled) { 227 | this.fPEnabled = fPEnabled; 228 | } 229 | 230 | public Integer getFPMinTemperature() { 231 | return fPMinTemperature; 232 | } 233 | 234 | public void setFPMinTemperature(Integer fPMinTemperature) { 235 | this.fPMinTemperature = fPMinTemperature; 236 | } 237 | 238 | public Integer getFPMaxTemperature() { 239 | return fPMaxTemperature; 240 | } 241 | 242 | public void setFPMaxTemperature(Integer fPMaxTemperature) { 243 | this.fPMaxTemperature = fPMaxTemperature; 244 | } 245 | 246 | public Boolean getHMDefined() { 247 | return hMDefined; 248 | } 249 | 250 | public void setHMDefined(Boolean hMDefined) { 251 | this.hMDefined = hMDefined; 252 | } 253 | 254 | public Boolean getHMEnabled() { 255 | return hMEnabled; 256 | } 257 | 258 | public void setHMEnabled(Boolean hMEnabled) { 259 | this.hMEnabled = hMEnabled; 260 | } 261 | 262 | public Object getHMStartDate() { 263 | return hMStartDate; 264 | } 265 | 266 | public void setHMStartDate(Object hMStartDate) { 267 | this.hMStartDate = hMStartDate; 268 | } 269 | 270 | public Object getHMEndDate() { 271 | return hMEndDate; 272 | } 273 | 274 | public void setHMEndDate(Object hMEndDate) { 275 | this.hMEndDate = hMEndDate; 276 | } 277 | 278 | public Integer getBuildingType() { 279 | return buildingType; 280 | } 281 | 282 | public void setBuildingType(Integer buildingType) { 283 | this.buildingType = buildingType; 284 | } 285 | 286 | public Integer getPropertyType() { 287 | return propertyType; 288 | } 289 | 290 | public void setPropertyType(Integer propertyType) { 291 | this.propertyType = propertyType; 292 | } 293 | 294 | public String getDateBuilt() { 295 | return dateBuilt; 296 | } 297 | 298 | public void setDateBuilt(String dateBuilt) { 299 | this.dateBuilt = dateBuilt; 300 | } 301 | 302 | public Boolean getHasGasSupply() { 303 | return hasGasSupply; 304 | } 305 | 306 | public void setHasGasSupply(Boolean hasGasSupply) { 307 | this.hasGasSupply = hasGasSupply; 308 | } 309 | 310 | public String getLocationLookupDate() { 311 | return locationLookupDate; 312 | } 313 | 314 | public void setLocationLookupDate(String locationLookupDate) { 315 | this.locationLookupDate = locationLookupDate; 316 | } 317 | 318 | public Integer getCountry() { 319 | return country; 320 | } 321 | 322 | public void setCountry(Integer country) { 323 | this.country = country; 324 | } 325 | 326 | public Integer getTimeZoneContinent() { 327 | return timeZoneContinent; 328 | } 329 | 330 | public void setTimeZoneContinent(Integer timeZoneContinent) { 331 | this.timeZoneContinent = timeZoneContinent; 332 | } 333 | 334 | public Integer getTimeZoneCity() { 335 | return timeZoneCity; 336 | } 337 | 338 | public void setTimeZoneCity(Integer timeZoneCity) { 339 | this.timeZoneCity = timeZoneCity; 340 | } 341 | 342 | public Integer getTimeZone() { 343 | return timeZone; 344 | } 345 | 346 | public void setTimeZone(Integer timeZone) { 347 | this.timeZone = timeZone; 348 | } 349 | 350 | public Integer getLocation() { 351 | return location; 352 | } 353 | 354 | public void setLocation(Integer location) { 355 | this.location = location; 356 | } 357 | 358 | public Boolean getCoolingDisabled() { 359 | return coolingDisabled; 360 | } 361 | 362 | public void setCoolingDisabled(Boolean coolingDisabled) { 363 | this.coolingDisabled = coolingDisabled; 364 | } 365 | 366 | public Boolean getExpanded() { 367 | return expanded; 368 | } 369 | 370 | public void setExpanded(Boolean expanded) { 371 | this.expanded = expanded; 372 | } 373 | 374 | public Structure getStructure() { 375 | return structure; 376 | } 377 | 378 | public void setStructure(Structure structure) { 379 | this.structure = structure; 380 | } 381 | 382 | public Integer getAccessLevel() { 383 | return accessLevel; 384 | } 385 | 386 | public void setAccessLevel(Integer accessLevel) { 387 | this.accessLevel = accessLevel; 388 | } 389 | 390 | public Boolean getDirectAccess() { 391 | return directAccess; 392 | } 393 | 394 | public void setDirectAccess(Boolean directAccess) { 395 | this.directAccess = directAccess; 396 | } 397 | 398 | public Integer getMinTemperature() { 399 | return minTemperature; 400 | } 401 | 402 | public void setMinTemperature(Integer minTemperature) { 403 | this.minTemperature = minTemperature; 404 | } 405 | 406 | public Integer getMaxTemperature() { 407 | return maxTemperature; 408 | } 409 | 410 | public void setMaxTemperature(Integer maxTemperature) { 411 | this.maxTemperature = maxTemperature; 412 | } 413 | 414 | public Object getOwner() { 415 | return owner; 416 | } 417 | 418 | public void setOwner(Object owner) { 419 | this.owner = owner; 420 | } 421 | 422 | public String getEndDate() { 423 | return endDate; 424 | } 425 | 426 | public void setEndDate(String endDate) { 427 | this.endDate = endDate; 428 | } 429 | 430 | public Object getIDateBuilt() { 431 | return iDateBuilt; 432 | } 433 | 434 | public void setIDateBuilt(Object iDateBuilt) { 435 | this.iDateBuilt = iDateBuilt; 436 | } 437 | 438 | public QuantizedCoordinates getQuantizedCoordinates() { 439 | return quantizedCoordinates; 440 | } 441 | 442 | public void setQuantizedCoordinates(QuantizedCoordinates quantizedCoordinates) { 443 | this.quantizedCoordinates = quantizedCoordinates; 444 | } 445 | } 446 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/melcloud/internal/handler/MelCloudDeviceHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2019 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.melcloud.internal.handler; 14 | 15 | import static org.eclipse.smarthome.core.library.unit.SIUnits.CELSIUS; 16 | import static org.openhab.binding.melcloud.internal.MelCloudBindingConstants.*; 17 | 18 | import java.math.BigDecimal; 19 | import java.math.RoundingMode; 20 | import java.time.LocalDateTime; 21 | import java.time.ZoneId; 22 | import java.time.ZoneOffset; 23 | import java.time.ZonedDateTime; 24 | import java.time.format.DateTimeFormatter; 25 | import java.util.Optional; 26 | import java.util.concurrent.ScheduledFuture; 27 | import java.util.concurrent.TimeUnit; 28 | 29 | import javax.measure.quantity.Temperature; 30 | 31 | import org.eclipse.smarthome.core.library.types.DateTimeType; 32 | import org.eclipse.smarthome.core.library.types.DecimalType; 33 | import org.eclipse.smarthome.core.library.types.OnOffType; 34 | import org.eclipse.smarthome.core.library.types.QuantityType; 35 | import org.eclipse.smarthome.core.library.unit.SIUnits; 36 | import org.eclipse.smarthome.core.thing.Bridge; 37 | import org.eclipse.smarthome.core.thing.Channel; 38 | import org.eclipse.smarthome.core.thing.ChannelUID; 39 | import org.eclipse.smarthome.core.thing.Thing; 40 | import org.eclipse.smarthome.core.thing.ThingStatus; 41 | import org.eclipse.smarthome.core.thing.ThingStatusDetail; 42 | import org.eclipse.smarthome.core.thing.ThingStatusInfo; 43 | import org.eclipse.smarthome.core.thing.binding.BaseThingHandler; 44 | import org.eclipse.smarthome.core.thing.binding.ThingHandler; 45 | import org.eclipse.smarthome.core.types.Command; 46 | import org.eclipse.smarthome.core.types.RefreshType; 47 | import org.openhab.binding.melcloud.internal.api.json.DeviceStatus; 48 | import org.openhab.binding.melcloud.internal.config.AcDeviceConfig; 49 | import org.openhab.binding.melcloud.internal.exceptions.MelCloudCommException; 50 | import org.slf4j.Logger; 51 | import org.slf4j.LoggerFactory; 52 | 53 | /** 54 | * The {@link MelCloudDeviceHandler} is responsible for handling commands, which are 55 | * sent to one of the channels. 56 | * 57 | * @author LucaCalcaterra - Initial contribution 58 | * @author Pauli Anttila - Refactoring 59 | */ 60 | 61 | public class MelCloudDeviceHandler extends BaseThingHandler { 62 | 63 | private static final int EFFECTIVE_FLAG_POWER = 0x01; 64 | private static final int EFFECTIVE_FLAG_OPERATION_MODE = 0x02; 65 | private static final int EFFECTIVE_FLAG_TEMPERATURE = 0x04; 66 | private static final int EFFECTIVE_FLAG_FAN_SPEED = 0x08; 67 | private static final int EFFECTIVE_FLAG_VANE_VERTICAL = 0x10; 68 | private static final int EFFECTIVE_FLAG_VANE_HORIZONTAL = 0x100; 69 | 70 | private final Logger logger = LoggerFactory.getLogger(MelCloudDeviceHandler.class); 71 | private AcDeviceConfig config; 72 | private MelCloudAccountHandler melCloudHandler; 73 | private DeviceStatus deviceStatus; 74 | private ScheduledFuture refreshTask; 75 | 76 | public MelCloudDeviceHandler(Thing thing) { 77 | super(thing); 78 | } 79 | 80 | @Override 81 | public void initialize() { 82 | logger.debug("Initializing {} handler.", getThing().getThingTypeUID()); 83 | 84 | Bridge bridge = getBridge(); 85 | if (bridge == null) { 86 | updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Bridge Not set"); 87 | return; 88 | } 89 | 90 | config = getThing().getConfiguration().as(AcDeviceConfig.class); 91 | logger.debug("A.C. device config: {}", config); 92 | 93 | initializeBridge((getBridge() == null) ? null : getBridge().getHandler(), 94 | (getBridge() == null) ? null : getBridge().getStatus()); 95 | } 96 | 97 | @Override 98 | public void dispose() { 99 | logger.debug("Running dispose()"); 100 | if (refreshTask != null) { 101 | refreshTask.cancel(true); 102 | refreshTask = null; 103 | } 104 | melCloudHandler = null; 105 | } 106 | 107 | @Override 108 | public void bridgeStatusChanged(ThingStatusInfo bridgeStatusInfo) { 109 | logger.debug("bridgeStatusChanged {} for thing {}", bridgeStatusInfo, getThing().getUID()); 110 | initializeBridge((getBridge() == null) ? null : getBridge().getHandler(), bridgeStatusInfo.getStatus()); 111 | 112 | if (bridgeStatusInfo.getStatus() == ThingStatus.ONLINE) { 113 | startAutomaticRefresh(); 114 | } 115 | } 116 | 117 | private void initializeBridge(ThingHandler thingHandler, ThingStatus bridgeStatus) { 118 | logger.debug("initializeBridge {} for thing {}", bridgeStatus, getThing().getUID()); 119 | 120 | if (thingHandler != null && bridgeStatus != null) { 121 | melCloudHandler = (MelCloudAccountHandler) thingHandler; 122 | 123 | if (bridgeStatus == ThingStatus.ONLINE) { 124 | updateStatus(ThingStatus.ONLINE); 125 | startAutomaticRefresh(); 126 | } else { 127 | updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE); 128 | } 129 | } else { 130 | updateStatus(ThingStatus.OFFLINE); 131 | } 132 | } 133 | 134 | @Override 135 | public void handleCommand(ChannelUID channelUID, Command command) { 136 | logger.debug("Received command '{}' to channel {}", command, channelUID); 137 | 138 | if (command instanceof RefreshType) { 139 | logger.debug("Resfresh command not supported"); 140 | return; 141 | } 142 | 143 | if (melCloudHandler == null) { 144 | logger.warn("No connection to MELCloud available, ignore command"); 145 | return; 146 | } 147 | 148 | if (deviceStatus == null) { 149 | logger.warn("No initial data available, ignore command"); 150 | return; 151 | } 152 | 153 | DeviceStatus cmdtoSend = getDeviceStatusCopy(deviceStatus); 154 | cmdtoSend.setEffectiveFlags(0); 155 | 156 | switch (channelUID.getId()) { 157 | case CHANNEL_POWER: 158 | cmdtoSend.setPower((OnOffType) command == OnOffType.ON ? true : false); 159 | cmdtoSend.setEffectiveFlags(EFFECTIVE_FLAG_POWER); 160 | break; 161 | case CHANNEL_OPERATION_MODE: 162 | cmdtoSend.setOperationMode(((DecimalType) command).intValue()); 163 | cmdtoSend.setEffectiveFlags(EFFECTIVE_FLAG_OPERATION_MODE); 164 | break; 165 | case CHANNEL_SET_TEMPERATURE: 166 | BigDecimal val = null; 167 | if (command instanceof QuantityType) { 168 | QuantityType quantity = ((QuantityType) command).toUnit(CELSIUS); 169 | if (quantity != null) { 170 | val = quantity.toBigDecimal().setScale(1, RoundingMode.HALF_UP); 171 | } 172 | } else { 173 | val = new BigDecimal(command.toString()).setScale(1, RoundingMode.HALF_UP); 174 | 175 | } 176 | if (val != null) { 177 | // round nearest .5 178 | double v = Math.round(val.doubleValue() * 2) / 2.0; 179 | cmdtoSend.setSetTemperature(v); 180 | cmdtoSend.setEffectiveFlags(EFFECTIVE_FLAG_TEMPERATURE); 181 | } else { 182 | logger.debug("Can't convert '{}' to set temperature", command); 183 | } 184 | break; 185 | case CHANNEL_FAN_SPEED: 186 | cmdtoSend.setSetFanSpeed(((DecimalType) command).intValue()); 187 | cmdtoSend.setEffectiveFlags(EFFECTIVE_FLAG_FAN_SPEED); 188 | break; 189 | case CHANNEL_VANE_VERTICAL: 190 | cmdtoSend.setVaneVertical(((DecimalType) command).intValue()); 191 | cmdtoSend.setEffectiveFlags(EFFECTIVE_FLAG_VANE_VERTICAL); 192 | break; 193 | case CHANNEL_VANE_HORIZONTAL: 194 | cmdtoSend.setVaneHorizontal(((DecimalType) command).intValue()); 195 | cmdtoSend.setEffectiveFlags(EFFECTIVE_FLAG_VANE_HORIZONTAL); 196 | break; 197 | default: 198 | logger.debug("Read only or unknown channel {}, skip update", channelUID); 199 | } 200 | 201 | if (cmdtoSend.getEffectiveFlags() > 0) { 202 | cmdtoSend.setHasPendingCommand(true); 203 | cmdtoSend.setDeviceID(config.deviceID); 204 | try { 205 | DeviceStatus newDeviceStatus = melCloudHandler.sendDeviceStatus(cmdtoSend); 206 | updateChannels(newDeviceStatus); 207 | } catch (MelCloudCommException e) { 208 | logger.warn("Command '{}' to channel '{}' failed, reason {}. ", command, channelUID, e.getMessage(), e); 209 | } 210 | } else { 211 | logger.debug("Nothing to send"); 212 | } 213 | 214 | } 215 | 216 | private DeviceStatus getDeviceStatusCopy(DeviceStatus deviceStatus) { 217 | DeviceStatus copy = new DeviceStatus(); 218 | synchronized (this) { 219 | copy.setPower(deviceStatus.getPower()); 220 | copy.setOperationMode(deviceStatus.getOperationMode()); 221 | copy.setSetTemperature(deviceStatus.getSetTemperature()); 222 | copy.setSetFanSpeed(deviceStatus.getSetFanSpeed()); 223 | copy.setVaneVertical(deviceStatus.getVaneVertical()); 224 | copy.setVaneHorizontal(deviceStatus.getVaneHorizontal()); 225 | copy.setEffectiveFlags(deviceStatus.getEffectiveFlags()); 226 | copy.setHasPendingCommand(deviceStatus.getHasPendingCommand()); 227 | copy.setDeviceID(deviceStatus.getDeviceID()); 228 | } 229 | return copy; 230 | } 231 | 232 | private void startAutomaticRefresh() { 233 | if (refreshTask == null || refreshTask.isCancelled()) { 234 | Runnable runnable = () -> getDeviceDataAndUpdateChannels(); 235 | refreshTask = scheduler.scheduleWithFixedDelay(runnable, 1, config.pollingInterval, TimeUnit.SECONDS); 236 | } 237 | } 238 | 239 | private void getDeviceDataAndUpdateChannels() { 240 | if (melCloudHandler.isConnected()) { 241 | logger.debug("Update device '{}' channels", getThing().getThingTypeUID()); 242 | try { 243 | DeviceStatus newDeviceStatus = melCloudHandler.fetchDeviceStatus(config.deviceID, 244 | Optional.ofNullable(config.buildingID)); 245 | updateChannels(newDeviceStatus); 246 | } catch (MelCloudCommException e) { 247 | logger.debug("Error occurred during device '{}' polling, reason {}. ", getThing().getThingTypeUID(), 248 | e.getMessage(), e); 249 | } 250 | } else { 251 | logger.debug("Connection to MELCloud is not open, skip periodic update"); 252 | } 253 | } 254 | 255 | private synchronized void updateChannels(DeviceStatus newDeviceStatus) { 256 | synchronized (this) { 257 | deviceStatus = newDeviceStatus; 258 | for (Channel channel : getThing().getChannels()) { 259 | updateChannels(channel.getUID().getId(), deviceStatus); 260 | } 261 | } 262 | } 263 | 264 | private void updateChannels(String channelId, DeviceStatus deviceStatus) { 265 | switch (channelId) { 266 | case CHANNEL_POWER: 267 | updateState(CHANNEL_POWER, deviceStatus.getPower() ? OnOffType.ON : OnOffType.OFF); 268 | break; 269 | case CHANNEL_OPERATION_MODE: 270 | updateState(CHANNEL_OPERATION_MODE, new DecimalType(deviceStatus.getOperationMode())); 271 | break; 272 | case CHANNEL_SET_TEMPERATURE: 273 | updateState(CHANNEL_SET_TEMPERATURE, 274 | new QuantityType(deviceStatus.getSetTemperature(), SIUnits.CELSIUS)); 275 | break; 276 | case CHANNEL_FAN_SPEED: 277 | updateState(CHANNEL_FAN_SPEED, new DecimalType(deviceStatus.getSetFanSpeed())); 278 | break; 279 | case CHANNEL_VANE_HORIZONTAL: 280 | updateState(CHANNEL_VANE_HORIZONTAL, new DecimalType(deviceStatus.getVaneHorizontal())); 281 | break; 282 | case CHANNEL_VANE_VERTICAL: 283 | updateState(CHANNEL_VANE_VERTICAL, new DecimalType(deviceStatus.getVaneVertical())); 284 | break; 285 | case CHANNEL_OFFLINE: 286 | updateState(CHANNEL_OFFLINE, deviceStatus.getOffline() ? OnOffType.ON : OnOffType.OFF); 287 | break; 288 | case CHANNEL_HAS_PENDING_COMMAND: 289 | updateState(CHANNEL_HAS_PENDING_COMMAND, 290 | deviceStatus.getHasPendingCommand() ? OnOffType.ON : OnOffType.OFF); 291 | break; 292 | case CHANNEL_ROOM_TEMPERATURE: 293 | updateState(CHANNEL_ROOM_TEMPERATURE, new DecimalType(deviceStatus.getRoomTemperature())); 294 | break; 295 | case CHANNEL_LAST_COMMUNICATION: 296 | updateState(CHANNEL_LAST_COMMUNICATION, 297 | new DateTimeType(convertDateTime(deviceStatus.getLastCommunication()))); 298 | break; 299 | case CHANNEL_NEXT_COMMUNICATION: 300 | updateState(CHANNEL_NEXT_COMMUNICATION, 301 | new DateTimeType(convertDateTime(deviceStatus.getNextCommunication()))); 302 | break; 303 | } 304 | } 305 | 306 | private ZonedDateTime convertDateTime(String dateTime) { 307 | return ZonedDateTime.ofInstant(LocalDateTime.parse(dateTime, DateTimeFormatter.ISO_LOCAL_DATE_TIME), 308 | ZoneOffset.UTC, ZoneId.systemDefault()); 309 | } 310 | } 311 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/melcloud/internal/api/json/LoginData.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2019 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.melcloud.internal.api.json; 14 | 15 | import com.google.gson.annotations.Expose; 16 | import com.google.gson.annotations.SerializedName; 17 | 18 | /** 19 | * The {@link LoginData} is responsible of JSON data For MELCloud API 20 | * LoginData for Login Request. 21 | * Generated with jsonschema2pojo 22 | * 23 | * @author LucaCalcaterra - Initial contribution 24 | */ 25 | public class LoginData { 26 | 27 | @SerializedName("ContextKey") 28 | @Expose 29 | private String contextKey; 30 | @SerializedName("Client") 31 | @Expose 32 | private Integer client; 33 | @SerializedName("Terms") 34 | @Expose 35 | private Integer terms; 36 | @SerializedName("AL") 37 | @Expose 38 | private Integer aL; 39 | @SerializedName("ML") 40 | @Expose 41 | private Integer mL; 42 | @SerializedName("CMI") 43 | @Expose 44 | private Boolean cMI; 45 | @SerializedName("IsStaff") 46 | @Expose 47 | private Boolean isStaff; 48 | @SerializedName("CUTF") 49 | @Expose 50 | private Boolean cUTF; 51 | @SerializedName("CAA") 52 | @Expose 53 | private Boolean cAA; 54 | @SerializedName("ReceiveCountryNotifications") 55 | @Expose 56 | private Boolean receiveCountryNotifications; 57 | @SerializedName("ReceiveAllNotifications") 58 | @Expose 59 | private Boolean receiveAllNotifications; 60 | @SerializedName("CACA") 61 | @Expose 62 | private Boolean cACA; 63 | @SerializedName("CAGA") 64 | @Expose 65 | private Boolean cAGA; 66 | @SerializedName("MaximumDevices") 67 | @Expose 68 | private Integer maximumDevices; 69 | @SerializedName("ShowDiagnostics") 70 | @Expose 71 | private Boolean showDiagnostics; 72 | @SerializedName("Language") 73 | @Expose 74 | private Integer language; 75 | @SerializedName("Country") 76 | @Expose 77 | private Integer country; 78 | @SerializedName("RealClient") 79 | @Expose 80 | private Integer realClient; 81 | @SerializedName("Name") 82 | @Expose 83 | private String name; 84 | @SerializedName("UseFahrenheit") 85 | @Expose 86 | private Boolean useFahrenheit; 87 | @SerializedName("Duration") 88 | @Expose 89 | private Integer duration; 90 | @SerializedName("Expiry") 91 | @Expose 92 | private String expiry; 93 | @SerializedName("CMSC") 94 | @Expose 95 | private Boolean cMSC; 96 | @SerializedName("PartnerApplicationVersion") 97 | @Expose 98 | private Object partnerApplicationVersion; 99 | @SerializedName("EmailSettingsReminderShown") 100 | @Expose 101 | private Boolean emailSettingsReminderShown; 102 | @SerializedName("EmailUnitErrors") 103 | @Expose 104 | private Integer emailUnitErrors; 105 | @SerializedName("EmailCommsErrors") 106 | @Expose 107 | private Integer emailCommsErrors; 108 | @SerializedName("IsImpersonated") 109 | @Expose 110 | private Boolean isImpersonated; 111 | @SerializedName("LanguageCode") 112 | @Expose 113 | private String languageCode; 114 | @SerializedName("CountryName") 115 | @Expose 116 | private String countryName; 117 | @SerializedName("CurrencySymbol") 118 | @Expose 119 | private String currencySymbol; 120 | @SerializedName("SupportEmailAddress") 121 | @Expose 122 | private String supportEmailAddress; 123 | @SerializedName("DateSeperator") 124 | @Expose 125 | private String dateSeperator; 126 | @SerializedName("TimeSeperator") 127 | @Expose 128 | private String timeSeperator; 129 | @SerializedName("AtwLogoFile") 130 | @Expose 131 | private String atwLogoFile; 132 | @SerializedName("DECCReport") 133 | @Expose 134 | private Boolean dECCReport; 135 | @SerializedName("CSVReport1min") 136 | @Expose 137 | private Boolean cSVReport1min; 138 | @SerializedName("HidePresetPanel") 139 | @Expose 140 | private Boolean hidePresetPanel; 141 | @SerializedName("EmailSettingsReminderRequired") 142 | @Expose 143 | private Boolean emailSettingsReminderRequired; 144 | @SerializedName("TermsText") 145 | @Expose 146 | private Object termsText; 147 | @SerializedName("MapView") 148 | @Expose 149 | private Boolean mapView; 150 | @SerializedName("MapZoom") 151 | @Expose 152 | private Integer mapZoom; 153 | @SerializedName("MapLongitude") 154 | @Expose 155 | private Double mapLongitude; 156 | @SerializedName("MapLatitude") 157 | @Expose 158 | private Double mapLatitude; 159 | 160 | public String getContextKey() { 161 | return contextKey; 162 | } 163 | 164 | public void setContextKey(String contextKey) { 165 | this.contextKey = contextKey; 166 | } 167 | 168 | public Integer getClient() { 169 | return client; 170 | } 171 | 172 | public void setClient(Integer client) { 173 | this.client = client; 174 | } 175 | 176 | public Integer getTerms() { 177 | return terms; 178 | } 179 | 180 | public void setTerms(Integer terms) { 181 | this.terms = terms; 182 | } 183 | 184 | public Integer getAL() { 185 | return aL; 186 | } 187 | 188 | public void setAL(Integer aL) { 189 | this.aL = aL; 190 | } 191 | 192 | public Integer getML() { 193 | return mL; 194 | } 195 | 196 | public void setML(Integer mL) { 197 | this.mL = mL; 198 | } 199 | 200 | public Boolean getCMI() { 201 | return cMI; 202 | } 203 | 204 | public void setCMI(Boolean cMI) { 205 | this.cMI = cMI; 206 | } 207 | 208 | public Boolean getIsStaff() { 209 | return isStaff; 210 | } 211 | 212 | public void setIsStaff(Boolean isStaff) { 213 | this.isStaff = isStaff; 214 | } 215 | 216 | public Boolean getCUTF() { 217 | return cUTF; 218 | } 219 | 220 | public void setCUTF(Boolean cUTF) { 221 | this.cUTF = cUTF; 222 | } 223 | 224 | public Boolean getCAA() { 225 | return cAA; 226 | } 227 | 228 | public void setCAA(Boolean cAA) { 229 | this.cAA = cAA; 230 | } 231 | 232 | public Boolean getReceiveCountryNotifications() { 233 | return receiveCountryNotifications; 234 | } 235 | 236 | public void setReceiveCountryNotifications(Boolean receiveCountryNotifications) { 237 | this.receiveCountryNotifications = receiveCountryNotifications; 238 | } 239 | 240 | public Boolean getReceiveAllNotifications() { 241 | return receiveAllNotifications; 242 | } 243 | 244 | public void setReceiveAllNotifications(Boolean receiveAllNotifications) { 245 | this.receiveAllNotifications = receiveAllNotifications; 246 | } 247 | 248 | public Boolean getCACA() { 249 | return cACA; 250 | } 251 | 252 | public void setCACA(Boolean cACA) { 253 | this.cACA = cACA; 254 | } 255 | 256 | public Boolean getCAGA() { 257 | return cAGA; 258 | } 259 | 260 | public void setCAGA(Boolean cAGA) { 261 | this.cAGA = cAGA; 262 | } 263 | 264 | public Integer getMaximumDevices() { 265 | return maximumDevices; 266 | } 267 | 268 | public void setMaximumDevices(Integer maximumDevices) { 269 | this.maximumDevices = maximumDevices; 270 | } 271 | 272 | public Boolean getShowDiagnostics() { 273 | return showDiagnostics; 274 | } 275 | 276 | public void setShowDiagnostics(Boolean showDiagnostics) { 277 | this.showDiagnostics = showDiagnostics; 278 | } 279 | 280 | public Integer getLanguage() { 281 | return language; 282 | } 283 | 284 | public void setLanguage(Integer language) { 285 | this.language = language; 286 | } 287 | 288 | public Integer getCountry() { 289 | return country; 290 | } 291 | 292 | public void setCountry(Integer country) { 293 | this.country = country; 294 | } 295 | 296 | public Integer getRealClient() { 297 | return realClient; 298 | } 299 | 300 | public void setRealClient(Integer realClient) { 301 | this.realClient = realClient; 302 | } 303 | 304 | public String getName() { 305 | return name; 306 | } 307 | 308 | public void setName(String name) { 309 | this.name = name; 310 | } 311 | 312 | public Boolean getUseFahrenheit() { 313 | return useFahrenheit; 314 | } 315 | 316 | public void setUseFahrenheit(Boolean useFahrenheit) { 317 | this.useFahrenheit = useFahrenheit; 318 | } 319 | 320 | public Integer getDuration() { 321 | return duration; 322 | } 323 | 324 | public void setDuration(Integer duration) { 325 | this.duration = duration; 326 | } 327 | 328 | public String getExpiry() { 329 | return expiry; 330 | } 331 | 332 | public void setExpiry(String expiry) { 333 | this.expiry = expiry; 334 | } 335 | 336 | public Boolean getCMSC() { 337 | return cMSC; 338 | } 339 | 340 | public void setCMSC(Boolean cMSC) { 341 | this.cMSC = cMSC; 342 | } 343 | 344 | public Object getPartnerApplicationVersion() { 345 | return partnerApplicationVersion; 346 | } 347 | 348 | public void setPartnerApplicationVersion(Object partnerApplicationVersion) { 349 | this.partnerApplicationVersion = partnerApplicationVersion; 350 | } 351 | 352 | public Boolean getEmailSettingsReminderShown() { 353 | return emailSettingsReminderShown; 354 | } 355 | 356 | public void setEmailSettingsReminderShown(Boolean emailSettingsReminderShown) { 357 | this.emailSettingsReminderShown = emailSettingsReminderShown; 358 | } 359 | 360 | public Integer getEmailUnitErrors() { 361 | return emailUnitErrors; 362 | } 363 | 364 | public void setEmailUnitErrors(Integer emailUnitErrors) { 365 | this.emailUnitErrors = emailUnitErrors; 366 | } 367 | 368 | public Integer getEmailCommsErrors() { 369 | return emailCommsErrors; 370 | } 371 | 372 | public void setEmailCommsErrors(Integer emailCommsErrors) { 373 | this.emailCommsErrors = emailCommsErrors; 374 | } 375 | 376 | public Boolean getIsImpersonated() { 377 | return isImpersonated; 378 | } 379 | 380 | public void setIsImpersonated(Boolean isImpersonated) { 381 | this.isImpersonated = isImpersonated; 382 | } 383 | 384 | public String getLanguageCode() { 385 | return languageCode; 386 | } 387 | 388 | public void setLanguageCode(String languageCode) { 389 | this.languageCode = languageCode; 390 | } 391 | 392 | public String getCountryName() { 393 | return countryName; 394 | } 395 | 396 | public void setCountryName(String countryName) { 397 | this.countryName = countryName; 398 | } 399 | 400 | public String getCurrencySymbol() { 401 | return currencySymbol; 402 | } 403 | 404 | public void setCurrencySymbol(String currencySymbol) { 405 | this.currencySymbol = currencySymbol; 406 | } 407 | 408 | public String getSupportEmailAddress() { 409 | return supportEmailAddress; 410 | } 411 | 412 | public void setSupportEmailAddress(String supportEmailAddress) { 413 | this.supportEmailAddress = supportEmailAddress; 414 | } 415 | 416 | public String getDateSeperator() { 417 | return dateSeperator; 418 | } 419 | 420 | public void setDateSeperator(String dateSeperator) { 421 | this.dateSeperator = dateSeperator; 422 | } 423 | 424 | public String getTimeSeperator() { 425 | return timeSeperator; 426 | } 427 | 428 | public void setTimeSeperator(String timeSeperator) { 429 | this.timeSeperator = timeSeperator; 430 | } 431 | 432 | public String getAtwLogoFile() { 433 | return atwLogoFile; 434 | } 435 | 436 | public void setAtwLogoFile(String atwLogoFile) { 437 | this.atwLogoFile = atwLogoFile; 438 | } 439 | 440 | public Boolean getDECCReport() { 441 | return dECCReport; 442 | } 443 | 444 | public void setDECCReport(Boolean dECCReport) { 445 | this.dECCReport = dECCReport; 446 | } 447 | 448 | public Boolean getCSVReport1min() { 449 | return cSVReport1min; 450 | } 451 | 452 | public void setCSVReport1min(Boolean cSVReport1min) { 453 | this.cSVReport1min = cSVReport1min; 454 | } 455 | 456 | public Boolean getHidePresetPanel() { 457 | return hidePresetPanel; 458 | } 459 | 460 | public void setHidePresetPanel(Boolean hidePresetPanel) { 461 | this.hidePresetPanel = hidePresetPanel; 462 | } 463 | 464 | public Boolean getEmailSettingsReminderRequired() { 465 | return emailSettingsReminderRequired; 466 | } 467 | 468 | public void setEmailSettingsReminderRequired(Boolean emailSettingsReminderRequired) { 469 | this.emailSettingsReminderRequired = emailSettingsReminderRequired; 470 | } 471 | 472 | public Object getTermsText() { 473 | return termsText; 474 | } 475 | 476 | public void setTermsText(Object termsText) { 477 | this.termsText = termsText; 478 | } 479 | 480 | public Boolean getMapView() { 481 | return mapView; 482 | } 483 | 484 | public void setMapView(Boolean mapView) { 485 | this.mapView = mapView; 486 | } 487 | 488 | public Integer getMapZoom() { 489 | return mapZoom; 490 | } 491 | 492 | public void setMapZoom(Integer mapZoom) { 493 | this.mapZoom = mapZoom; 494 | } 495 | 496 | public Double getMapLongitude() { 497 | return mapLongitude; 498 | } 499 | 500 | public void setMapLongitude(Double mapLongitude) { 501 | this.mapLongitude = mapLongitude; 502 | } 503 | 504 | public Double getMapLatitude() { 505 | return mapLatitude; 506 | } 507 | 508 | public void setMapLatitude(Double mapLatitude) { 509 | this.mapLatitude = mapLatitude; 510 | } 511 | 512 | } 513 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/melcloud/internal/api/json/Device.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2019 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.melcloud.internal.api.json; 14 | 15 | import java.security.Permissions; 16 | import java.util.List; 17 | 18 | import com.google.gson.annotations.Expose; 19 | import com.google.gson.annotations.SerializedName; 20 | 21 | /** 22 | * The {@link Device} is responsible of JSON data For MELCloud API 23 | * Device Structure. 24 | * Generated with jsonschema2pojo 25 | * 26 | * @author LucaCalcaterra - Initial contribution 27 | */ 28 | 29 | public class Device { 30 | 31 | @SerializedName("DeviceID") 32 | @Expose 33 | private Integer deviceID; 34 | @SerializedName("DeviceName") 35 | @Expose 36 | private String deviceName; 37 | @SerializedName("BuildingID") 38 | @Expose 39 | private Integer buildingID; 40 | @SerializedName("BuildingName") 41 | @Expose 42 | private Object buildingName; 43 | @SerializedName("FloorID") 44 | @Expose 45 | private Object floorID; 46 | @SerializedName("FloorName") 47 | @Expose 48 | private Object floorName; 49 | @SerializedName("AreaID") 50 | @Expose 51 | private Object areaID; 52 | @SerializedName("AreaName") 53 | @Expose 54 | private Object areaName; 55 | @SerializedName("ImageID") 56 | @Expose 57 | private Integer imageID; 58 | @SerializedName("InstallationDate") 59 | @Expose 60 | private String installationDate; 61 | @SerializedName("LastServiceDate") 62 | @Expose 63 | private Object lastServiceDate; 64 | @SerializedName("Presets") 65 | @Expose 66 | private List presets = null; 67 | @SerializedName("OwnerID") 68 | @Expose 69 | private Object ownerID; 70 | @SerializedName("OwnerName") 71 | @Expose 72 | private Object ownerName; 73 | @SerializedName("OwnerEmail") 74 | @Expose 75 | private Object ownerEmail; 76 | @SerializedName("AccessLevel") 77 | @Expose 78 | private Integer accessLevel; 79 | @SerializedName("DirectAccess") 80 | @Expose 81 | private Boolean directAccess; 82 | @SerializedName("EndDate") 83 | @Expose 84 | private String endDate; 85 | @SerializedName("Zone1Name") 86 | @Expose 87 | private Object zone1Name; 88 | @SerializedName("Zone2Name") 89 | @Expose 90 | private Object zone2Name; 91 | @SerializedName("MinTemperature") 92 | @Expose 93 | private Integer minTemperature; 94 | @SerializedName("MaxTemperature") 95 | @Expose 96 | private Integer maxTemperature; 97 | @SerializedName("HideVaneControls") 98 | @Expose 99 | private Boolean hideVaneControls; 100 | @SerializedName("HideDryModeControl") 101 | @Expose 102 | private Boolean hideDryModeControl; 103 | @SerializedName("HideRoomTemperature") 104 | @Expose 105 | private Boolean hideRoomTemperature; 106 | @SerializedName("HideSupplyTemperature") 107 | @Expose 108 | private Boolean hideSupplyTemperature; 109 | @SerializedName("HideOutdoorTemperature") 110 | @Expose 111 | private Boolean hideOutdoorTemperature; 112 | @SerializedName("BuildingCountry") 113 | @Expose 114 | private Object buildingCountry; 115 | @SerializedName("OwnerCountry") 116 | @Expose 117 | private Object ownerCountry; 118 | @SerializedName("AdaptorType") 119 | @Expose 120 | private Integer adaptorType; 121 | @SerializedName("Type") 122 | @Expose 123 | private Integer type; 124 | @SerializedName("MacAddress") 125 | @Expose 126 | private String macAddress; 127 | @SerializedName("SerialNumber") 128 | @Expose 129 | private String serialNumber; 130 | @SerializedName("Device") 131 | @Expose 132 | private DeviceProps device; 133 | @SerializedName("DiagnosticMode") 134 | @Expose 135 | private Integer diagnosticMode; 136 | @SerializedName("DiagnosticEndDate") 137 | @Expose 138 | private Object diagnosticEndDate; 139 | @SerializedName("Location") 140 | @Expose 141 | private Integer location; 142 | @SerializedName("DetectedCountry") 143 | @Expose 144 | private Object detectedCountry; 145 | @SerializedName("Registrations") 146 | @Expose 147 | private Integer registrations; 148 | @SerializedName("LocalIPAddress") 149 | @Expose 150 | private Object localIPAddress; 151 | @SerializedName("TimeZone") 152 | @Expose 153 | private Integer timeZone; 154 | @SerializedName("RegistReason") 155 | @Expose 156 | private Object registReason; 157 | @SerializedName("ExpectedCommand") 158 | @Expose 159 | private Integer expectedCommand; 160 | @SerializedName("RegistRetry") 161 | @Expose 162 | private Integer registRetry; 163 | @SerializedName("DateCreated") 164 | @Expose 165 | private String dateCreated; 166 | @SerializedName("FirmwareDeployment") 167 | @Expose 168 | private Object firmwareDeployment; 169 | @SerializedName("FirmwareUpdateAborted") 170 | @Expose 171 | private Boolean firmwareUpdateAborted; 172 | @SerializedName("Permissions") 173 | @Expose 174 | private Permissions permissions; 175 | 176 | public Integer getDeviceID() { 177 | return deviceID; 178 | } 179 | 180 | public void setDeviceID(Integer deviceID) { 181 | this.deviceID = deviceID; 182 | } 183 | 184 | public String getDeviceName() { 185 | return deviceName; 186 | } 187 | 188 | public void setDeviceName(String deviceName) { 189 | this.deviceName = deviceName; 190 | } 191 | 192 | public Integer getBuildingID() { 193 | return buildingID; 194 | } 195 | 196 | public void setBuildingID(Integer buildingID) { 197 | this.buildingID = buildingID; 198 | } 199 | 200 | public Object getBuildingName() { 201 | return buildingName; 202 | } 203 | 204 | public void setBuildingName(Object buildingName) { 205 | this.buildingName = buildingName; 206 | } 207 | 208 | public Object getFloorID() { 209 | return floorID; 210 | } 211 | 212 | public void setFloorID(Object floorID) { 213 | this.floorID = floorID; 214 | } 215 | 216 | public Object getFloorName() { 217 | return floorName; 218 | } 219 | 220 | public void setFloorName(Object floorName) { 221 | this.floorName = floorName; 222 | } 223 | 224 | public Object getAreaID() { 225 | return areaID; 226 | } 227 | 228 | public void setAreaID(Object areaID) { 229 | this.areaID = areaID; 230 | } 231 | 232 | public Object getAreaName() { 233 | return areaName; 234 | } 235 | 236 | public void setAreaName(Object areaName) { 237 | this.areaName = areaName; 238 | } 239 | 240 | public Integer getImageID() { 241 | return imageID; 242 | } 243 | 244 | public void setImageID(Integer imageID) { 245 | this.imageID = imageID; 246 | } 247 | 248 | public String getInstallationDate() { 249 | return installationDate; 250 | } 251 | 252 | public void setInstallationDate(String installationDate) { 253 | this.installationDate = installationDate; 254 | } 255 | 256 | public Object getLastServiceDate() { 257 | return lastServiceDate; 258 | } 259 | 260 | public void setLastServiceDate(Object lastServiceDate) { 261 | this.lastServiceDate = lastServiceDate; 262 | } 263 | 264 | public List getPresets() { 265 | return presets; 266 | } 267 | 268 | public void setPresets(List presets) { 269 | this.presets = presets; 270 | } 271 | 272 | public Object getOwnerID() { 273 | return ownerID; 274 | } 275 | 276 | public void setOwnerID(Object ownerID) { 277 | this.ownerID = ownerID; 278 | } 279 | 280 | public Object getOwnerName() { 281 | return ownerName; 282 | } 283 | 284 | public void setOwnerName(Object ownerName) { 285 | this.ownerName = ownerName; 286 | } 287 | 288 | public Object getOwnerEmail() { 289 | return ownerEmail; 290 | } 291 | 292 | public void setOwnerEmail(Object ownerEmail) { 293 | this.ownerEmail = ownerEmail; 294 | } 295 | 296 | public Integer getAccessLevel() { 297 | return accessLevel; 298 | } 299 | 300 | public void setAccessLevel(Integer accessLevel) { 301 | this.accessLevel = accessLevel; 302 | } 303 | 304 | public Boolean getDirectAccess() { 305 | return directAccess; 306 | } 307 | 308 | public void setDirectAccess(Boolean directAccess) { 309 | this.directAccess = directAccess; 310 | } 311 | 312 | public String getEndDate() { 313 | return endDate; 314 | } 315 | 316 | public void setEndDate(String endDate) { 317 | this.endDate = endDate; 318 | } 319 | 320 | public Object getZone1Name() { 321 | return zone1Name; 322 | } 323 | 324 | public void setZone1Name(Object zone1Name) { 325 | this.zone1Name = zone1Name; 326 | } 327 | 328 | public Object getZone2Name() { 329 | return zone2Name; 330 | } 331 | 332 | public void setZone2Name(Object zone2Name) { 333 | this.zone2Name = zone2Name; 334 | } 335 | 336 | public Integer getMinTemperature() { 337 | return minTemperature; 338 | } 339 | 340 | public void setMinTemperature(Integer minTemperature) { 341 | this.minTemperature = minTemperature; 342 | } 343 | 344 | public Integer getMaxTemperature() { 345 | return maxTemperature; 346 | } 347 | 348 | public void setMaxTemperature(Integer maxTemperature) { 349 | this.maxTemperature = maxTemperature; 350 | } 351 | 352 | public Boolean getHideVaneControls() { 353 | return hideVaneControls; 354 | } 355 | 356 | public void setHideVaneControls(Boolean hideVaneControls) { 357 | this.hideVaneControls = hideVaneControls; 358 | } 359 | 360 | public Boolean getHideDryModeControl() { 361 | return hideDryModeControl; 362 | } 363 | 364 | public void setHideDryModeControl(Boolean hideDryModeControl) { 365 | this.hideDryModeControl = hideDryModeControl; 366 | } 367 | 368 | public Boolean getHideRoomTemperature() { 369 | return hideRoomTemperature; 370 | } 371 | 372 | public void setHideRoomTemperature(Boolean hideRoomTemperature) { 373 | this.hideRoomTemperature = hideRoomTemperature; 374 | } 375 | 376 | public Boolean getHideSupplyTemperature() { 377 | return hideSupplyTemperature; 378 | } 379 | 380 | public void setHideSupplyTemperature(Boolean hideSupplyTemperature) { 381 | this.hideSupplyTemperature = hideSupplyTemperature; 382 | } 383 | 384 | public Boolean getHideOutdoorTemperature() { 385 | return hideOutdoorTemperature; 386 | } 387 | 388 | public void setHideOutdoorTemperature(Boolean hideOutdoorTemperature) { 389 | this.hideOutdoorTemperature = hideOutdoorTemperature; 390 | } 391 | 392 | public Object getBuildingCountry() { 393 | return buildingCountry; 394 | } 395 | 396 | public void setBuildingCountry(Object buildingCountry) { 397 | this.buildingCountry = buildingCountry; 398 | } 399 | 400 | public Object getOwnerCountry() { 401 | return ownerCountry; 402 | } 403 | 404 | public void setOwnerCountry(Object ownerCountry) { 405 | this.ownerCountry = ownerCountry; 406 | } 407 | 408 | public Integer getAdaptorType() { 409 | return adaptorType; 410 | } 411 | 412 | public void setAdaptorType(Integer adaptorType) { 413 | this.adaptorType = adaptorType; 414 | } 415 | 416 | public Integer getType() { 417 | return type; 418 | } 419 | 420 | public void setType(Integer type) { 421 | this.type = type; 422 | } 423 | 424 | public String getMacAddress() { 425 | return macAddress; 426 | } 427 | 428 | public void setMacAddress(String macAddress) { 429 | this.macAddress = macAddress; 430 | } 431 | 432 | public String getSerialNumber() { 433 | return serialNumber; 434 | } 435 | 436 | public void setSerialNumber(String serialNumber) { 437 | this.serialNumber = serialNumber; 438 | } 439 | 440 | public DeviceProps getDeviceProps() { 441 | return device; 442 | } 443 | 444 | public void setDeviceProps(DeviceProps device) { 445 | this.device = device; 446 | } 447 | 448 | public Integer getDiagnosticMode() { 449 | return diagnosticMode; 450 | } 451 | 452 | public void setDiagnosticMode(Integer diagnosticMode) { 453 | this.diagnosticMode = diagnosticMode; 454 | } 455 | 456 | public Object getDiagnosticEndDate() { 457 | return diagnosticEndDate; 458 | } 459 | 460 | public void setDiagnosticEndDate(Object diagnosticEndDate) { 461 | this.diagnosticEndDate = diagnosticEndDate; 462 | } 463 | 464 | public Integer getLocation() { 465 | return location; 466 | } 467 | 468 | public void setLocation(Integer location) { 469 | this.location = location; 470 | } 471 | 472 | public Object getDetectedCountry() { 473 | return detectedCountry; 474 | } 475 | 476 | public void setDetectedCountry(Object detectedCountry) { 477 | this.detectedCountry = detectedCountry; 478 | } 479 | 480 | public Integer getRegistrations() { 481 | return registrations; 482 | } 483 | 484 | public void setRegistrations(Integer registrations) { 485 | this.registrations = registrations; 486 | } 487 | 488 | public Object getLocalIPAddress() { 489 | return localIPAddress; 490 | } 491 | 492 | public void setLocalIPAddress(Object localIPAddress) { 493 | this.localIPAddress = localIPAddress; 494 | } 495 | 496 | public Integer getTimeZone() { 497 | return timeZone; 498 | } 499 | 500 | public void setTimeZone(Integer timeZone) { 501 | this.timeZone = timeZone; 502 | } 503 | 504 | public Object getRegistReason() { 505 | return registReason; 506 | } 507 | 508 | public void setRegistReason(Object registReason) { 509 | this.registReason = registReason; 510 | } 511 | 512 | public Integer getExpectedCommand() { 513 | return expectedCommand; 514 | } 515 | 516 | public void setExpectedCommand(Integer expectedCommand) { 517 | this.expectedCommand = expectedCommand; 518 | } 519 | 520 | public Integer getRegistRetry() { 521 | return registRetry; 522 | } 523 | 524 | public void setRegistRetry(Integer registRetry) { 525 | this.registRetry = registRetry; 526 | } 527 | 528 | public String getDateCreated() { 529 | return dateCreated; 530 | } 531 | 532 | public void setDateCreated(String dateCreated) { 533 | this.dateCreated = dateCreated; 534 | } 535 | 536 | public Object getFirmwareDeployment() { 537 | return firmwareDeployment; 538 | } 539 | 540 | public void setFirmwareDeployment(Object firmwareDeployment) { 541 | this.firmwareDeployment = firmwareDeployment; 542 | } 543 | 544 | public Boolean getFirmwareUpdateAborted() { 545 | return firmwareUpdateAborted; 546 | } 547 | 548 | public void setFirmwareUpdateAborted(Boolean firmwareUpdateAborted) { 549 | this.firmwareUpdateAborted = firmwareUpdateAborted; 550 | } 551 | 552 | public Permissions getPermissions() { 553 | return permissions; 554 | } 555 | 556 | public void setPermissions(Permissions permissions) { 557 | this.permissions = permissions; 558 | } 559 | 560 | } 561 | -------------------------------------------------------------------------------- /src/main/java/org/openhab/binding/melcloud/internal/api/json/DeviceProps.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2010-2019 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.melcloud.internal.api.json; 14 | 15 | import java.util.List; 16 | 17 | import com.google.gson.annotations.Expose; 18 | import com.google.gson.annotations.SerializedName; 19 | 20 | /** 21 | * The {@link DeviceProps} is responsible of JSON data For MELCloud API 22 | * Device Properties. 23 | * Generated with jsonschema2pojo 24 | * 25 | * @author LucaCalcaterra - Initial contribution 26 | */ 27 | public class DeviceProps { 28 | 29 | @SerializedName("ListHistory24Formatters") 30 | @Expose 31 | private List listHistory24Formatters = null; 32 | @SerializedName("DeviceType") 33 | @Expose 34 | private Integer deviceType; 35 | @SerializedName("CanCool") 36 | @Expose 37 | private Boolean canCool; 38 | @SerializedName("CanHeat") 39 | @Expose 40 | private Boolean canHeat; 41 | @SerializedName("CanDry") 42 | @Expose 43 | private Boolean canDry; 44 | @SerializedName("HasAutomaticFanSpeed") 45 | @Expose 46 | private Boolean hasAutomaticFanSpeed; 47 | @SerializedName("AirDirectionFunction") 48 | @Expose 49 | private Boolean airDirectionFunction; 50 | @SerializedName("SwingFunction") 51 | @Expose 52 | private Boolean swingFunction; 53 | @SerializedName("NumberOfFanSpeeds") 54 | @Expose 55 | private Integer numberOfFanSpeeds; 56 | @SerializedName("UseTemperatureA") 57 | @Expose 58 | private Boolean useTemperatureA; 59 | @SerializedName("TemperatureIncrementOverride") 60 | @Expose 61 | private Integer temperatureIncrementOverride; 62 | @SerializedName("TemperatureIncrement") 63 | @Expose 64 | private Double temperatureIncrement; 65 | @SerializedName("MinTempCoolDry") 66 | @Expose 67 | private Double minTempCoolDry; 68 | @SerializedName("MaxTempCoolDry") 69 | @Expose 70 | private Double maxTempCoolDry; 71 | @SerializedName("MinTempHeat") 72 | @Expose 73 | private Double minTempHeat; 74 | @SerializedName("MaxTempHeat") 75 | @Expose 76 | private Double maxTempHeat; 77 | @SerializedName("MinTempAutomatic") 78 | @Expose 79 | private Double minTempAutomatic; 80 | @SerializedName("MaxTempAutomatic") 81 | @Expose 82 | private Double maxTempAutomatic; 83 | @SerializedName("LegacyDevice") 84 | @Expose 85 | private Boolean legacyDevice; 86 | @SerializedName("UnitSupportsStandbyMode") 87 | @Expose 88 | private Boolean unitSupportsStandbyMode; 89 | @SerializedName("ModelIsAirCurtain") 90 | @Expose 91 | private Boolean modelIsAirCurtain; 92 | @SerializedName("ModelSupportsFanSpeed") 93 | @Expose 94 | private Boolean modelSupportsFanSpeed; 95 | @SerializedName("ModelSupportsAuto") 96 | @Expose 97 | private Boolean modelSupportsAuto; 98 | @SerializedName("ModelSupportsHeat") 99 | @Expose 100 | private Boolean modelSupportsHeat; 101 | @SerializedName("ModelSupportsDry") 102 | @Expose 103 | private Boolean modelSupportsDry; 104 | @SerializedName("ModelSupportsVaneVertical") 105 | @Expose 106 | private Boolean modelSupportsVaneVertical; 107 | @SerializedName("ModelSupportsVaneHorizontal") 108 | @Expose 109 | private Boolean modelSupportsVaneHorizontal; 110 | @SerializedName("ModelSupportsStandbyMode") 111 | @Expose 112 | private Boolean modelSupportsStandbyMode; 113 | @SerializedName("ModelSupportsEnergyReporting") 114 | @Expose 115 | private Boolean modelSupportsEnergyReporting; 116 | @SerializedName("Power") 117 | @Expose 118 | private Boolean power; 119 | @SerializedName("RoomTemperature") 120 | @Expose 121 | private Double roomTemperature; 122 | @SerializedName("SetTemperature") 123 | @Expose 124 | private Double setTemperature; 125 | @SerializedName("ActualFanSpeed") 126 | @Expose 127 | private Integer actualFanSpeed; 128 | @SerializedName("FanSpeed") 129 | @Expose 130 | private Integer fanSpeed; 131 | @SerializedName("AutomaticFanSpeed") 132 | @Expose 133 | private Boolean automaticFanSpeed; 134 | @SerializedName("VaneVerticalDirection") 135 | @Expose 136 | private Integer vaneVerticalDirection; 137 | @SerializedName("VaneVerticalSwing") 138 | @Expose 139 | private Boolean vaneVerticalSwing; 140 | @SerializedName("VaneHorizontalDirection") 141 | @Expose 142 | private Integer vaneHorizontalDirection; 143 | @SerializedName("VaneHorizontalSwing") 144 | @Expose 145 | private Boolean vaneHorizontalSwing; 146 | @SerializedName("OperationMode") 147 | @Expose 148 | private Integer operationMode; 149 | @SerializedName("EffectiveFlags") 150 | @Expose 151 | private Integer effectiveFlags; 152 | @SerializedName("LastEffectiveFlags") 153 | @Expose 154 | private Integer lastEffectiveFlags; 155 | @SerializedName("InStandbyMode") 156 | @Expose 157 | private Boolean inStandbyMode; 158 | @SerializedName("DefaultCoolingSetTemperature") 159 | @Expose 160 | private Double defaultCoolingSetTemperature; 161 | @SerializedName("DefaultHeatingSetTemperature") 162 | @Expose 163 | private Double defaultHeatingSetTemperature; 164 | @SerializedName("RoomTemperatureLabel") 165 | @Expose 166 | private Integer roomTemperatureLabel; 167 | @SerializedName("HasEnergyConsumedMeter") 168 | @Expose 169 | private Boolean hasEnergyConsumedMeter; 170 | @SerializedName("CurrentEnergyConsumed") 171 | @Expose 172 | private Integer currentEnergyConsumed; 173 | @SerializedName("CurrentEnergyMode") 174 | @Expose 175 | private Integer currentEnergyMode; 176 | @SerializedName("CoolingDisabled") 177 | @Expose 178 | private Boolean coolingDisabled; 179 | @SerializedName("MinPcycle") 180 | @Expose 181 | private Integer minPcycle; 182 | @SerializedName("MaxPcycle") 183 | @Expose 184 | private Integer maxPcycle; 185 | @SerializedName("EffectivePCycle") 186 | @Expose 187 | private Integer effectivePCycle; 188 | @SerializedName("MaxOutdoorUnits") 189 | @Expose 190 | private Integer maxOutdoorUnits; 191 | @SerializedName("MaxIndoorUnits") 192 | @Expose 193 | private Integer maxIndoorUnits; 194 | @SerializedName("MaxTemperatureControlUnits") 195 | @Expose 196 | private Integer maxTemperatureControlUnits; 197 | @SerializedName("DeviceID") 198 | @Expose 199 | private Integer deviceID; 200 | @SerializedName("MacAddress") 201 | @Expose 202 | private String macAddress; 203 | @SerializedName("SerialNumber") 204 | @Expose 205 | private String serialNumber; 206 | @SerializedName("TimeZoneID") 207 | @Expose 208 | private Integer timeZoneID; 209 | @SerializedName("DiagnosticMode") 210 | @Expose 211 | private Integer diagnosticMode; 212 | @SerializedName("DiagnosticEndDate") 213 | @Expose 214 | private Object diagnosticEndDate; 215 | @SerializedName("ExpectedCommand") 216 | @Expose 217 | private Integer expectedCommand; 218 | @SerializedName("Owner") 219 | @Expose 220 | private Object owner; 221 | @SerializedName("DetectedCountry") 222 | @Expose 223 | private Object detectedCountry; 224 | @SerializedName("AdaptorType") 225 | @Expose 226 | private Integer adaptorType; 227 | @SerializedName("FirmwareDeployment") 228 | @Expose 229 | private Object firmwareDeployment; 230 | @SerializedName("FirmwareUpdateAborted") 231 | @Expose 232 | private Boolean firmwareUpdateAborted; 233 | @SerializedName("WifiSignalStrength") 234 | @Expose 235 | private Integer wifiSignalStrength; 236 | @SerializedName("WifiAdapterStatus") 237 | @Expose 238 | private String wifiAdapterStatus; 239 | @SerializedName("Position") 240 | @Expose 241 | private String position; 242 | @SerializedName("PCycle") 243 | @Expose 244 | private Integer pCycle; 245 | @SerializedName("RecordNumMax") 246 | @Expose 247 | private Integer recordNumMax; 248 | @SerializedName("LastTimeStamp") 249 | @Expose 250 | private String lastTimeStamp; 251 | @SerializedName("ErrorCode") 252 | @Expose 253 | private Integer errorCode; 254 | @SerializedName("HasError") 255 | @Expose 256 | private Boolean hasError; 257 | @SerializedName("LastReset") 258 | @Expose 259 | private String lastReset; 260 | @SerializedName("FlashWrites") 261 | @Expose 262 | private Integer flashWrites; 263 | @SerializedName("Scene") 264 | @Expose 265 | private Object scene; 266 | @SerializedName("SSLExpirationDate") 267 | @Expose 268 | private Object sSLExpirationDate; 269 | @SerializedName("SPTimeout") 270 | @Expose 271 | private Object sPTimeout; 272 | @SerializedName("Passcode") 273 | @Expose 274 | private Object passcode; 275 | @SerializedName("ServerCommunicationDisabled") 276 | @Expose 277 | private Boolean serverCommunicationDisabled; 278 | @SerializedName("ConsecutiveUploadErrors") 279 | @Expose 280 | private Integer consecutiveUploadErrors; 281 | @SerializedName("DoNotRespondAfter") 282 | @Expose 283 | private Object doNotRespondAfter; 284 | @SerializedName("OwnerRoleAccessLevel") 285 | @Expose 286 | private Integer ownerRoleAccessLevel; 287 | @SerializedName("OwnerCountry") 288 | @Expose 289 | private Integer ownerCountry; 290 | @SerializedName("Rate1StartTime") 291 | @Expose 292 | private Object rate1StartTime; 293 | @SerializedName("Rate2StartTime") 294 | @Expose 295 | private Object rate2StartTime; 296 | @SerializedName("ProtocolVersion") 297 | @Expose 298 | private Integer protocolVersion; 299 | @SerializedName("UnitVersion") 300 | @Expose 301 | private Integer unitVersion; 302 | @SerializedName("FirmwareAppVersion") 303 | @Expose 304 | private Integer firmwareAppVersion; 305 | @SerializedName("FirmwareWebVersion") 306 | @Expose 307 | private Integer firmwareWebVersion; 308 | @SerializedName("FirmwareWlanVersion") 309 | @Expose 310 | private Integer firmwareWlanVersion; 311 | @SerializedName("HasErrorMessages") 312 | @Expose 313 | private Boolean hasErrorMessages; 314 | @SerializedName("HasZone2") 315 | @Expose 316 | private Boolean hasZone2; 317 | @SerializedName("Offline") 318 | @Expose 319 | private Boolean offline; 320 | @SerializedName("Units") 321 | @Expose 322 | private List units = null; 323 | 324 | public List getListHistory24Formatters() { 325 | return listHistory24Formatters; 326 | } 327 | 328 | public void setListHistory24Formatters(List listHistory24Formatters) { 329 | this.listHistory24Formatters = listHistory24Formatters; 330 | } 331 | 332 | public Integer getDeviceType() { 333 | return deviceType; 334 | } 335 | 336 | public void setDeviceType(Integer deviceType) { 337 | this.deviceType = deviceType; 338 | } 339 | 340 | public Boolean getCanCool() { 341 | return canCool; 342 | } 343 | 344 | public void setCanCool(Boolean canCool) { 345 | this.canCool = canCool; 346 | } 347 | 348 | public Boolean getCanHeat() { 349 | return canHeat; 350 | } 351 | 352 | public void setCanHeat(Boolean canHeat) { 353 | this.canHeat = canHeat; 354 | } 355 | 356 | public Boolean getCanDry() { 357 | return canDry; 358 | } 359 | 360 | public void setCanDry(Boolean canDry) { 361 | this.canDry = canDry; 362 | } 363 | 364 | public Boolean getHasAutomaticFanSpeed() { 365 | return hasAutomaticFanSpeed; 366 | } 367 | 368 | public void setHasAutomaticFanSpeed(Boolean hasAutomaticFanSpeed) { 369 | this.hasAutomaticFanSpeed = hasAutomaticFanSpeed; 370 | } 371 | 372 | public Boolean getAirDirectionFunction() { 373 | return airDirectionFunction; 374 | } 375 | 376 | public void setAirDirectionFunction(Boolean airDirectionFunction) { 377 | this.airDirectionFunction = airDirectionFunction; 378 | } 379 | 380 | public Boolean getSwingFunction() { 381 | return swingFunction; 382 | } 383 | 384 | public void setSwingFunction(Boolean swingFunction) { 385 | this.swingFunction = swingFunction; 386 | } 387 | 388 | public Integer getNumberOfFanSpeeds() { 389 | return numberOfFanSpeeds; 390 | } 391 | 392 | public void setNumberOfFanSpeeds(Integer numberOfFanSpeeds) { 393 | this.numberOfFanSpeeds = numberOfFanSpeeds; 394 | } 395 | 396 | public Boolean getUseTemperatureA() { 397 | return useTemperatureA; 398 | } 399 | 400 | public void setUseTemperatureA(Boolean useTemperatureA) { 401 | this.useTemperatureA = useTemperatureA; 402 | } 403 | 404 | public Integer getTemperatureIncrementOverride() { 405 | return temperatureIncrementOverride; 406 | } 407 | 408 | public void setTemperatureIncrementOverride(Integer temperatureIncrementOverride) { 409 | this.temperatureIncrementOverride = temperatureIncrementOverride; 410 | } 411 | 412 | public Double getTemperatureIncrement() { 413 | return temperatureIncrement; 414 | } 415 | 416 | public void setTemperatureIncrement(Double temperatureIncrement) { 417 | this.temperatureIncrement = temperatureIncrement; 418 | } 419 | 420 | public Double getMinTempCoolDry() { 421 | return minTempCoolDry; 422 | } 423 | 424 | public void setMinTempCoolDry(Double minTempCoolDry) { 425 | this.minTempCoolDry = minTempCoolDry; 426 | } 427 | 428 | public Double getMaxTempCoolDry() { 429 | return maxTempCoolDry; 430 | } 431 | 432 | public void setMaxTempCoolDry(Double maxTempCoolDry) { 433 | this.maxTempCoolDry = maxTempCoolDry; 434 | } 435 | 436 | public Double getMinTempHeat() { 437 | return minTempHeat; 438 | } 439 | 440 | public void setMinTempHeat(Double minTempHeat) { 441 | this.minTempHeat = minTempHeat; 442 | } 443 | 444 | public Double getMaxTempHeat() { 445 | return maxTempHeat; 446 | } 447 | 448 | public void setMaxTempHeat(Double maxTempHeat) { 449 | this.maxTempHeat = maxTempHeat; 450 | } 451 | 452 | public Double getMinTempAutomatic() { 453 | return minTempAutomatic; 454 | } 455 | 456 | public void setMinTempAutomatic(Double minTempAutomatic) { 457 | this.minTempAutomatic = minTempAutomatic; 458 | } 459 | 460 | public Double getMaxTempAutomatic() { 461 | return maxTempAutomatic; 462 | } 463 | 464 | public void setMaxTempAutomatic(Double maxTempAutomatic) { 465 | this.maxTempAutomatic = maxTempAutomatic; 466 | } 467 | 468 | public Boolean getLegacyDevice() { 469 | return legacyDevice; 470 | } 471 | 472 | public void setLegacyDevice(Boolean legacyDevice) { 473 | this.legacyDevice = legacyDevice; 474 | } 475 | 476 | public Boolean getUnitSupportsStandbyMode() { 477 | return unitSupportsStandbyMode; 478 | } 479 | 480 | public void setUnitSupportsStandbyMode(Boolean unitSupportsStandbyMode) { 481 | this.unitSupportsStandbyMode = unitSupportsStandbyMode; 482 | } 483 | 484 | public Boolean getModelIsAirCurtain() { 485 | return modelIsAirCurtain; 486 | } 487 | 488 | public void setModelIsAirCurtain(Boolean modelIsAirCurtain) { 489 | this.modelIsAirCurtain = modelIsAirCurtain; 490 | } 491 | 492 | public Boolean getModelSupportsFanSpeed() { 493 | return modelSupportsFanSpeed; 494 | } 495 | 496 | public void setModelSupportsFanSpeed(Boolean modelSupportsFanSpeed) { 497 | this.modelSupportsFanSpeed = modelSupportsFanSpeed; 498 | } 499 | 500 | public Boolean getModelSupportsAuto() { 501 | return modelSupportsAuto; 502 | } 503 | 504 | public void setModelSupportsAuto(Boolean modelSupportsAuto) { 505 | this.modelSupportsAuto = modelSupportsAuto; 506 | } 507 | 508 | public Boolean getModelSupportsHeat() { 509 | return modelSupportsHeat; 510 | } 511 | 512 | public void setModelSupportsHeat(Boolean modelSupportsHeat) { 513 | this.modelSupportsHeat = modelSupportsHeat; 514 | } 515 | 516 | public Boolean getModelSupportsDry() { 517 | return modelSupportsDry; 518 | } 519 | 520 | public void setModelSupportsDry(Boolean modelSupportsDry) { 521 | this.modelSupportsDry = modelSupportsDry; 522 | } 523 | 524 | public Boolean getModelSupportsVaneVertical() { 525 | return modelSupportsVaneVertical; 526 | } 527 | 528 | public void setModelSupportsVaneVertical(Boolean modelSupportsVaneVertical) { 529 | this.modelSupportsVaneVertical = modelSupportsVaneVertical; 530 | } 531 | 532 | public Boolean getModelSupportsVaneHorizontal() { 533 | return modelSupportsVaneHorizontal; 534 | } 535 | 536 | public void setModelSupportsVaneHorizontal(Boolean modelSupportsVaneHorizontal) { 537 | this.modelSupportsVaneHorizontal = modelSupportsVaneHorizontal; 538 | } 539 | 540 | public Boolean getModelSupportsStandbyMode() { 541 | return modelSupportsStandbyMode; 542 | } 543 | 544 | public void setModelSupportsStandbyMode(Boolean modelSupportsStandbyMode) { 545 | this.modelSupportsStandbyMode = modelSupportsStandbyMode; 546 | } 547 | 548 | public Boolean getModelSupportsEnergyReporting() { 549 | return modelSupportsEnergyReporting; 550 | } 551 | 552 | public void setModelSupportsEnergyReporting(Boolean modelSupportsEnergyReporting) { 553 | this.modelSupportsEnergyReporting = modelSupportsEnergyReporting; 554 | } 555 | 556 | public Boolean getPower() { 557 | return power; 558 | } 559 | 560 | public void setPower(Boolean power) { 561 | this.power = power; 562 | } 563 | 564 | public Double getRoomTemperature() { 565 | return roomTemperature; 566 | } 567 | 568 | public void setRoomTemperature(Double roomTemperature) { 569 | this.roomTemperature = roomTemperature; 570 | } 571 | 572 | public Double getSetTemperature() { 573 | return setTemperature; 574 | } 575 | 576 | public void setSetTemperature(Double setTemperature) { 577 | this.setTemperature = setTemperature; 578 | } 579 | 580 | public Integer getActualFanSpeed() { 581 | return actualFanSpeed; 582 | } 583 | 584 | public void setActualFanSpeed(Integer actualFanSpeed) { 585 | this.actualFanSpeed = actualFanSpeed; 586 | } 587 | 588 | public Integer getFanSpeed() { 589 | return fanSpeed; 590 | } 591 | 592 | public void setFanSpeed(Integer fanSpeed) { 593 | this.fanSpeed = fanSpeed; 594 | } 595 | 596 | public Boolean getAutomaticFanSpeed() { 597 | return automaticFanSpeed; 598 | } 599 | 600 | public void setAutomaticFanSpeed(Boolean automaticFanSpeed) { 601 | this.automaticFanSpeed = automaticFanSpeed; 602 | } 603 | 604 | public Integer getVaneVerticalDirection() { 605 | return vaneVerticalDirection; 606 | } 607 | 608 | public void setVaneVerticalDirection(Integer vaneVerticalDirection) { 609 | this.vaneVerticalDirection = vaneVerticalDirection; 610 | } 611 | 612 | public Boolean getVaneVerticalSwing() { 613 | return vaneVerticalSwing; 614 | } 615 | 616 | public void setVaneVerticalSwing(Boolean vaneVerticalSwing) { 617 | this.vaneVerticalSwing = vaneVerticalSwing; 618 | } 619 | 620 | public Integer getVaneHorizontalDirection() { 621 | return vaneHorizontalDirection; 622 | } 623 | 624 | public void setVaneHorizontalDirection(Integer vaneHorizontalDirection) { 625 | this.vaneHorizontalDirection = vaneHorizontalDirection; 626 | } 627 | 628 | public Boolean getVaneHorizontalSwing() { 629 | return vaneHorizontalSwing; 630 | } 631 | 632 | public void setVaneHorizontalSwing(Boolean vaneHorizontalSwing) { 633 | this.vaneHorizontalSwing = vaneHorizontalSwing; 634 | } 635 | 636 | public Integer getOperationMode() { 637 | return operationMode; 638 | } 639 | 640 | public void setOperationMode(Integer operationMode) { 641 | this.operationMode = operationMode; 642 | } 643 | 644 | public Integer getEffectiveFlags() { 645 | return effectiveFlags; 646 | } 647 | 648 | public void setEffectiveFlags(Integer effectiveFlags) { 649 | this.effectiveFlags = effectiveFlags; 650 | } 651 | 652 | public Integer getLastEffectiveFlags() { 653 | return lastEffectiveFlags; 654 | } 655 | 656 | public void setLastEffectiveFlags(Integer lastEffectiveFlags) { 657 | this.lastEffectiveFlags = lastEffectiveFlags; 658 | } 659 | 660 | public Boolean getInStandbyMode() { 661 | return inStandbyMode; 662 | } 663 | 664 | public void setInStandbyMode(Boolean inStandbyMode) { 665 | this.inStandbyMode = inStandbyMode; 666 | } 667 | 668 | public Double getDefaultCoolingSetTemperature() { 669 | return defaultCoolingSetTemperature; 670 | } 671 | 672 | public void setDefaultCoolingSetTemperature(Double defaultCoolingSetTemperature) { 673 | this.defaultCoolingSetTemperature = defaultCoolingSetTemperature; 674 | } 675 | 676 | public Double getDefaultHeatingSetTemperature() { 677 | return defaultHeatingSetTemperature; 678 | } 679 | 680 | public void setDefaultHeatingSetTemperature(Double defaultHeatingSetTemperature) { 681 | this.defaultHeatingSetTemperature = defaultHeatingSetTemperature; 682 | } 683 | 684 | public Integer getRoomTemperatureLabel() { 685 | return roomTemperatureLabel; 686 | } 687 | 688 | public void setRoomTemperatureLabel(Integer roomTemperatureLabel) { 689 | this.roomTemperatureLabel = roomTemperatureLabel; 690 | } 691 | 692 | public Boolean getHasEnergyConsumedMeter() { 693 | return hasEnergyConsumedMeter; 694 | } 695 | 696 | public void setHasEnergyConsumedMeter(Boolean hasEnergyConsumedMeter) { 697 | this.hasEnergyConsumedMeter = hasEnergyConsumedMeter; 698 | } 699 | 700 | public Integer getCurrentEnergyConsumed() { 701 | return currentEnergyConsumed; 702 | } 703 | 704 | public void setCurrentEnergyConsumed(Integer currentEnergyConsumed) { 705 | this.currentEnergyConsumed = currentEnergyConsumed; 706 | } 707 | 708 | public Integer getCurrentEnergyMode() { 709 | return currentEnergyMode; 710 | } 711 | 712 | public void setCurrentEnergyMode(Integer currentEnergyMode) { 713 | this.currentEnergyMode = currentEnergyMode; 714 | } 715 | 716 | public Boolean getCoolingDisabled() { 717 | return coolingDisabled; 718 | } 719 | 720 | public void setCoolingDisabled(Boolean coolingDisabled) { 721 | this.coolingDisabled = coolingDisabled; 722 | } 723 | 724 | public Integer getMinPcycle() { 725 | return minPcycle; 726 | } 727 | 728 | public void setMinPcycle(Integer minPcycle) { 729 | this.minPcycle = minPcycle; 730 | } 731 | 732 | public Integer getMaxPcycle() { 733 | return maxPcycle; 734 | } 735 | 736 | public void setMaxPcycle(Integer maxPcycle) { 737 | this.maxPcycle = maxPcycle; 738 | } 739 | 740 | public Integer getEffectivePCycle() { 741 | return effectivePCycle; 742 | } 743 | 744 | public void setEffectivePCycle(Integer effectivePCycle) { 745 | this.effectivePCycle = effectivePCycle; 746 | } 747 | 748 | public Integer getMaxOutdoorUnits() { 749 | return maxOutdoorUnits; 750 | } 751 | 752 | public void setMaxOutdoorUnits(Integer maxOutdoorUnits) { 753 | this.maxOutdoorUnits = maxOutdoorUnits; 754 | } 755 | 756 | public Integer getMaxIndoorUnits() { 757 | return maxIndoorUnits; 758 | } 759 | 760 | public void setMaxIndoorUnits(Integer maxIndoorUnits) { 761 | this.maxIndoorUnits = maxIndoorUnits; 762 | } 763 | 764 | public Integer getMaxTemperatureControlUnits() { 765 | return maxTemperatureControlUnits; 766 | } 767 | 768 | public void setMaxTemperatureControlUnits(Integer maxTemperatureControlUnits) { 769 | this.maxTemperatureControlUnits = maxTemperatureControlUnits; 770 | } 771 | 772 | public Integer getDeviceID() { 773 | return deviceID; 774 | } 775 | 776 | public void setDeviceID(Integer deviceID) { 777 | this.deviceID = deviceID; 778 | } 779 | 780 | public String getMacAddress() { 781 | return macAddress; 782 | } 783 | 784 | public void setMacAddress(String macAddress) { 785 | this.macAddress = macAddress; 786 | } 787 | 788 | public String getSerialNumber() { 789 | return serialNumber; 790 | } 791 | 792 | public void setSerialNumber(String serialNumber) { 793 | this.serialNumber = serialNumber; 794 | } 795 | 796 | public Integer getTimeZoneID() { 797 | return timeZoneID; 798 | } 799 | 800 | public void setTimeZoneID(Integer timeZoneID) { 801 | this.timeZoneID = timeZoneID; 802 | } 803 | 804 | public Integer getDiagnosticMode() { 805 | return diagnosticMode; 806 | } 807 | 808 | public void setDiagnosticMode(Integer diagnosticMode) { 809 | this.diagnosticMode = diagnosticMode; 810 | } 811 | 812 | public Object getDiagnosticEndDate() { 813 | return diagnosticEndDate; 814 | } 815 | 816 | public void setDiagnosticEndDate(Object diagnosticEndDate) { 817 | this.diagnosticEndDate = diagnosticEndDate; 818 | } 819 | 820 | public Integer getExpectedCommand() { 821 | return expectedCommand; 822 | } 823 | 824 | public void setExpectedCommand(Integer expectedCommand) { 825 | this.expectedCommand = expectedCommand; 826 | } 827 | 828 | public Object getOwner() { 829 | return owner; 830 | } 831 | 832 | public void setOwner(Object owner) { 833 | this.owner = owner; 834 | } 835 | 836 | public Object getDetectedCountry() { 837 | return detectedCountry; 838 | } 839 | 840 | public void setDetectedCountry(Object detectedCountry) { 841 | this.detectedCountry = detectedCountry; 842 | } 843 | 844 | public Integer getAdaptorType() { 845 | return adaptorType; 846 | } 847 | 848 | public void setAdaptorType(Integer adaptorType) { 849 | this.adaptorType = adaptorType; 850 | } 851 | 852 | public Object getFirmwareDeployment() { 853 | return firmwareDeployment; 854 | } 855 | 856 | public void setFirmwareDeployment(Object firmwareDeployment) { 857 | this.firmwareDeployment = firmwareDeployment; 858 | } 859 | 860 | public Boolean getFirmwareUpdateAborted() { 861 | return firmwareUpdateAborted; 862 | } 863 | 864 | public void setFirmwareUpdateAborted(Boolean firmwareUpdateAborted) { 865 | this.firmwareUpdateAborted = firmwareUpdateAborted; 866 | } 867 | 868 | public Integer getWifiSignalStrength() { 869 | return wifiSignalStrength; 870 | } 871 | 872 | public void setWifiSignalStrength(Integer wifiSignalStrength) { 873 | this.wifiSignalStrength = wifiSignalStrength; 874 | } 875 | 876 | public String getWifiAdapterStatus() { 877 | return wifiAdapterStatus; 878 | } 879 | 880 | public void setWifiAdapterStatus(String wifiAdapterStatus) { 881 | this.wifiAdapterStatus = wifiAdapterStatus; 882 | } 883 | 884 | public String getPosition() { 885 | return position; 886 | } 887 | 888 | public void setPosition(String position) { 889 | this.position = position; 890 | } 891 | 892 | public Integer getPCycle() { 893 | return pCycle; 894 | } 895 | 896 | public void setPCycle(Integer pCycle) { 897 | this.pCycle = pCycle; 898 | } 899 | 900 | public Integer getRecordNumMax() { 901 | return recordNumMax; 902 | } 903 | 904 | public void setRecordNumMax(Integer recordNumMax) { 905 | this.recordNumMax = recordNumMax; 906 | } 907 | 908 | public String getLastTimeStamp() { 909 | return lastTimeStamp; 910 | } 911 | 912 | public void setLastTimeStamp(String lastTimeStamp) { 913 | this.lastTimeStamp = lastTimeStamp; 914 | } 915 | 916 | public Integer getErrorCode() { 917 | return errorCode; 918 | } 919 | 920 | public void setErrorCode(Integer errorCode) { 921 | this.errorCode = errorCode; 922 | } 923 | 924 | public Boolean getHasError() { 925 | return hasError; 926 | } 927 | 928 | public void setHasError(Boolean hasError) { 929 | this.hasError = hasError; 930 | } 931 | 932 | public String getLastReset() { 933 | return lastReset; 934 | } 935 | 936 | public void setLastReset(String lastReset) { 937 | this.lastReset = lastReset; 938 | } 939 | 940 | public Integer getFlashWrites() { 941 | return flashWrites; 942 | } 943 | 944 | public void setFlashWrites(Integer flashWrites) { 945 | this.flashWrites = flashWrites; 946 | } 947 | 948 | public Object getScene() { 949 | return scene; 950 | } 951 | 952 | public void setScene(Object scene) { 953 | this.scene = scene; 954 | } 955 | 956 | public Object getSSLExpirationDate() { 957 | return sSLExpirationDate; 958 | } 959 | 960 | public void setSSLExpirationDate(Object sSLExpirationDate) { 961 | this.sSLExpirationDate = sSLExpirationDate; 962 | } 963 | 964 | public Object getSPTimeout() { 965 | return sPTimeout; 966 | } 967 | 968 | public void setSPTimeout(Object sPTimeout) { 969 | this.sPTimeout = sPTimeout; 970 | } 971 | 972 | public Object getPasscode() { 973 | return passcode; 974 | } 975 | 976 | public void setPasscode(Object passcode) { 977 | this.passcode = passcode; 978 | } 979 | 980 | public Boolean getServerCommunicationDisabled() { 981 | return serverCommunicationDisabled; 982 | } 983 | 984 | public void setServerCommunicationDisabled(Boolean serverCommunicationDisabled) { 985 | this.serverCommunicationDisabled = serverCommunicationDisabled; 986 | } 987 | 988 | public Integer getConsecutiveUploadErrors() { 989 | return consecutiveUploadErrors; 990 | } 991 | 992 | public void setConsecutiveUploadErrors(Integer consecutiveUploadErrors) { 993 | this.consecutiveUploadErrors = consecutiveUploadErrors; 994 | } 995 | 996 | public Object getDoNotRespondAfter() { 997 | return doNotRespondAfter; 998 | } 999 | 1000 | public void setDoNotRespondAfter(Object doNotRespondAfter) { 1001 | this.doNotRespondAfter = doNotRespondAfter; 1002 | } 1003 | 1004 | public Integer getOwnerRoleAccessLevel() { 1005 | return ownerRoleAccessLevel; 1006 | } 1007 | 1008 | public void setOwnerRoleAccessLevel(Integer ownerRoleAccessLevel) { 1009 | this.ownerRoleAccessLevel = ownerRoleAccessLevel; 1010 | } 1011 | 1012 | public Integer getOwnerCountry() { 1013 | return ownerCountry; 1014 | } 1015 | 1016 | public void setOwnerCountry(Integer ownerCountry) { 1017 | this.ownerCountry = ownerCountry; 1018 | } 1019 | 1020 | public Object getRate1StartTime() { 1021 | return rate1StartTime; 1022 | } 1023 | 1024 | public void setRate1StartTime(Object rate1StartTime) { 1025 | this.rate1StartTime = rate1StartTime; 1026 | } 1027 | 1028 | public Object getRate2StartTime() { 1029 | return rate2StartTime; 1030 | } 1031 | 1032 | public void setRate2StartTime(Object rate2StartTime) { 1033 | this.rate2StartTime = rate2StartTime; 1034 | } 1035 | 1036 | public Integer getProtocolVersion() { 1037 | return protocolVersion; 1038 | } 1039 | 1040 | public void setProtocolVersion(Integer protocolVersion) { 1041 | this.protocolVersion = protocolVersion; 1042 | } 1043 | 1044 | public Integer getUnitVersion() { 1045 | return unitVersion; 1046 | } 1047 | 1048 | public void setUnitVersion(Integer unitVersion) { 1049 | this.unitVersion = unitVersion; 1050 | } 1051 | 1052 | public Integer getFirmwareAppVersion() { 1053 | return firmwareAppVersion; 1054 | } 1055 | 1056 | public void setFirmwareAppVersion(Integer firmwareAppVersion) { 1057 | this.firmwareAppVersion = firmwareAppVersion; 1058 | } 1059 | 1060 | public Integer getFirmwareWebVersion() { 1061 | return firmwareWebVersion; 1062 | } 1063 | 1064 | public void setFirmwareWebVersion(Integer firmwareWebVersion) { 1065 | this.firmwareWebVersion = firmwareWebVersion; 1066 | } 1067 | 1068 | public Integer getFirmwareWlanVersion() { 1069 | return firmwareWlanVersion; 1070 | } 1071 | 1072 | public void setFirmwareWlanVersion(Integer firmwareWlanVersion) { 1073 | this.firmwareWlanVersion = firmwareWlanVersion; 1074 | } 1075 | 1076 | public Boolean getHasErrorMessages() { 1077 | return hasErrorMessages; 1078 | } 1079 | 1080 | public void setHasErrorMessages(Boolean hasErrorMessages) { 1081 | this.hasErrorMessages = hasErrorMessages; 1082 | } 1083 | 1084 | public Boolean getHasZone2() { 1085 | return hasZone2; 1086 | } 1087 | 1088 | public void setHasZone2(Boolean hasZone2) { 1089 | this.hasZone2 = hasZone2; 1090 | } 1091 | 1092 | public Boolean getOffline() { 1093 | return offline; 1094 | } 1095 | 1096 | public void setOffline(Boolean offline) { 1097 | this.offline = offline; 1098 | } 1099 | 1100 | public List getUnits() { 1101 | return units; 1102 | } 1103 | 1104 | public void setUnits(List units) { 1105 | this.units = units; 1106 | } 1107 | 1108 | } 1109 | --------------------------------------------------------------------------------