Merge branch 'refs/heads/pr/785' into FeaturesfFor5.0

# Conflicts:
#	src/main/resources/public/scripts/app.js
This commit is contained in:
Admin
2017-11-14 13:13:22 -06:00
35 changed files with 1518 additions and 10 deletions

View File

@@ -65,6 +65,7 @@ public class BridgeSettings extends BackupHandler {
public void buildSettings() {
String addressString = null;
String theVeraAddress = null;
String theFibaroAddress = null;
String theSomfyAddress = null;
String theHarmonyAddress = null;
String configFileProperty = System.getProperty("config.file");
@@ -108,6 +109,22 @@ public class BridgeSettings extends BackupHandler {
}
}
theBridgeSettings.setVeraAddress(theVeraList);
theFibaroAddress = System.getProperty("fibaro.address");
IpList theFibaroList = null;
if(theFibaroAddress != null) {
try {
theFibaroList = new Gson().fromJson(theFibaroAddress, IpList.class);
} catch (Exception e) {
try {
theFibaroList = new Gson().fromJson("{devices:[{name:default,ip:" + theFibaroAddress + "}]}", IpList.class);
} catch (Exception et) {
log.error("Cannot parse fibaro.address, not set with message: " + e.getMessage(), e);
theFibaroList = null;
}
}
}
theBridgeSettings.setFibaroAddress(theFibaroList);
theHarmonyAddress = System.getProperty("harmony.address");
IpList theHarmonyList = null;
@@ -182,6 +199,7 @@ public class BridgeSettings extends BackupHandler {
theBridgeSettings.setButtonsleep(Integer.parseInt(Configuration.DEFAULT_BUTTON_SLEEP));
theBridgeSettings.setVeraconfigured(theBridgeSettings.isValidVera());
theBridgeSettings.setFibaroconfigured(theBridgeSettings.isValidFibaro());
theBridgeSettings.setHarmonyconfigured(theBridgeSettings.isValidHarmony());
theBridgeSettings.setNestConfigured(theBridgeSettings.isValidNest());
theBridgeSettings.setHueconfigured(theBridgeSettings.isValidHue());

View File

@@ -30,6 +30,9 @@ public class BridgeSettingsDescriptor {
@SerializedName("veraaddress")
@Expose
private IpList veraaddress;
@SerializedName("fibaroaddress")
@Expose
private IpList fibaroaddress;
@SerializedName("harmonyaddress")
@Expose
private IpList harmonyaddress;
@@ -97,6 +100,7 @@ public class BridgeSettingsDescriptor {
private boolean settingsChanged;
private boolean veraconfigured;
private boolean fibaroconfigured;
private boolean harmonyconfigured;
private boolean hueconfigured;
private boolean nestconfigured;
@@ -114,6 +118,7 @@ public class BridgeSettingsDescriptor {
this.traceupnp = false;
this.nestconfigured = false;
this.veraconfigured = false;
this.fibaroconfigured = false;
this.somfyconfigured = false;
this.harmonyconfigured = false;
this.hueconfigured = false;
@@ -175,12 +180,18 @@ public class BridgeSettingsDescriptor {
public IpList getVeraAddress() {
return veraaddress;
}
public IpList getFibaroAddress() {
return fibaroaddress;
}
public IpList getSomfyAddress() {
return somfyaddress;
}
public void setVeraAddress(IpList veraAddress) {
this.veraaddress = veraAddress;
}
public void setFibaroAddress(IpList fibaroAddress) {
this.fibaroaddress = fibaroAddress;
}
public void setSomfyAddress(IpList somfyAddress) {
this.somfyaddress = somfyAddress;
}
@@ -217,12 +228,18 @@ public class BridgeSettingsDescriptor {
public boolean isVeraconfigured() {
return veraconfigured;
}
public boolean isFibaroconfigured() {
return fibaroconfigured;
}
public boolean isSomfyconfigured() {
return somfyconfigured;
}
public void setVeraconfigured(boolean veraconfigured) {
this.veraconfigured = veraconfigured;
}
public void setFibaroconfigured(boolean fibaroconfigured) {
this.fibaroconfigured = fibaroconfigured;
}
public void setSomfyconfigured(boolean somfyconfigured) {
this.somfyconfigured = somfyconfigured;
}
@@ -378,6 +395,14 @@ public class BridgeSettingsDescriptor {
return false;
return true;
}
public Boolean isValidFibaro() {
if(this.getFibaroAddress() == null || this.getFibaroAddress().getDevices().size() <= 0)
return false;
List<NamedIP> devicesList = this.getFibaroAddress().getDevices();
if(devicesList.get(0).getIp().contains(Configuration.DEFAULT_ADDRESS))
return false;
return true;
}
public Boolean isValidHarmony() {
if(this.getHarmonyAddress() == null || this.getHarmonyAddress().getDevices().size() <= 0)
return false;

View File

@@ -7,6 +7,8 @@ public class DeviceMapTypes {
public final static String[] CUSTOM_DEVICE = { "custom", "Custom"};
public final static String[] VERA_DEVICE = { "veraDevice", "Vera Device"};
public final static String[] VERA_SCENE = { "veraScene", "Vera Scene"};
public final static String[] FIBARO_DEVICE = { "fibaroDevice", "Fibaro Device"};
public final static String[] FIBARO_SCENE = { "fibaroScene", "Fibaro Scene"};
public final static String[] HARMONY_ACTIVITY = { "harmonyActivity", "Harmony Activity"};
public final static String[] HARMONY_BUTTON = { "harmonyButton", "Harmony Button"};
public final static String[] NEST_HOMEAWAY = { "nestHomeAway", "Nest Home Status"};
@@ -57,6 +59,8 @@ public class DeviceMapTypes {
deviceMapTypes.add(UDP_DEVICE);
deviceMapTypes.add(VERA_DEVICE);
deviceMapTypes.add(VERA_SCENE);
deviceMapTypes.add(FIBARO_DEVICE);
deviceMapTypes.add(FIBARO_SCENE);
deviceMapTypes.add(SOMFY_DEVICE);
}
public static int getTypeIndex() {

View File

@@ -19,6 +19,7 @@ import com.bwssystems.HABridge.plugins.somfy.SomfyHome;
import com.bwssystems.HABridge.plugins.tcp.TCPHome;
import com.bwssystems.HABridge.plugins.udp.UDPHome;
import com.bwssystems.HABridge.plugins.vera.VeraHome;
import com.bwssystems.HABridge.plugins.fibaro.FibaroHome;
import com.bwssystems.HABridge.util.UDPDatagramSender;
public class HomeManager {
@@ -73,6 +74,8 @@ public class HomeManager {
homeList.put(DeviceMapTypes.CUSTOM_DEVICE[DeviceMapTypes.typeIndex], aHome);
homeList.put(DeviceMapTypes.VERA_DEVICE[DeviceMapTypes.typeIndex], aHome);
homeList.put(DeviceMapTypes.VERA_SCENE[DeviceMapTypes.typeIndex], aHome);
homeList.put(DeviceMapTypes.FIBARO_DEVICE[DeviceMapTypes.typeIndex], aHome);
homeList.put(DeviceMapTypes.FIBARO_SCENE[DeviceMapTypes.typeIndex], aHome);
//setup the tcp handler Home
aHome = new TCPHome(bridgeSettings);
homeList.put(DeviceMapTypes.TCP_DEVICE[DeviceMapTypes.typeIndex], aHome);
@@ -85,7 +88,11 @@ public class HomeManager {
aHome = new VeraHome(bridgeSettings);
resourceList.put(DeviceMapTypes.VERA_DEVICE[DeviceMapTypes.typeIndex], aHome);
resourceList.put(DeviceMapTypes.VERA_SCENE[DeviceMapTypes.typeIndex], aHome);
//setup the Domoticz configuration if available
// Setup Fibaro Home if available
aHome = new FibaroHome(bridgeSettings);
resourceList.put(DeviceMapTypes.FIBARO_DEVICE[DeviceMapTypes.typeIndex], aHome);
resourceList.put(DeviceMapTypes.FIBARO_SCENE[DeviceMapTypes.typeIndex], aHome);
//setup the Domoticz configuration if available
aHome = new DomoticzHome(bridgeSettings);
homeList.put(DeviceMapTypes.DOMOTICZ_DEVICE[DeviceMapTypes.typeIndex], aHome);
resourceList.put(DeviceMapTypes.DOMOTICZ_DEVICE[DeviceMapTypes.typeIndex], aHome);

View File

@@ -2,8 +2,8 @@ package com.bwssystems.HABridge;
public class NamedIP {
private String name;
private String ip;
private String webhook;
private String ip;
private String webhook;
private String port;
private String username;
private String password;

View File

@@ -231,6 +231,18 @@ public class DeviceResource {
response.status(HttpStatus.SC_OK);
return homeManager.findResource(DeviceMapTypes.VERA_DEVICE[DeviceMapTypes.typeIndex]).getItems(DeviceMapTypes.VERA_SCENE[DeviceMapTypes.typeIndex]);
}, new JsonTransformer());
get (API_CONTEXT + "/fibaro/devices", "application/json", (request, response) -> {
log.debug("Get fibaro devices");
response.status(HttpStatus.SC_OK);
return homeManager.findResource(DeviceMapTypes.FIBARO_DEVICE[DeviceMapTypes.typeIndex]).getItems(DeviceMapTypes.FIBARO_DEVICE[DeviceMapTypes.typeIndex]);
}, new JsonTransformer());
get (API_CONTEXT + "/fibaro/scenes", "application/json", (request, response) -> {
log.debug("Get fibaro scenes");
response.status(HttpStatus.SC_OK);
return homeManager.findResource(DeviceMapTypes.FIBARO_DEVICE[DeviceMapTypes.typeIndex]).getItems(DeviceMapTypes.FIBARO_SCENE[DeviceMapTypes.typeIndex]);
}, new JsonTransformer());
get (API_CONTEXT + "/harmony/activities", "application/json", (request, response) -> {
log.debug("Get harmony activities");

View File

@@ -0,0 +1,105 @@
package com.bwssystems.HABridge.plugins.fibaro;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.bwssystems.HABridge.BridgeSettings;
import com.bwssystems.HABridge.DeviceMapTypes;
import com.bwssystems.HABridge.Home;
import com.bwssystems.HABridge.NamedIP;
import com.bwssystems.HABridge.api.CallItem;
import com.bwssystems.HABridge.dao.DeviceDescriptor;
import com.bwssystems.HABridge.hue.MultiCommandUtil;
import com.bwssystems.HABridge.plugins.fibaro.json.Device;
import com.bwssystems.HABridge.plugins.fibaro.json.Scene;
public class FibaroHome implements Home
{
private static final Logger log = LoggerFactory.getLogger(FibaroHome.class);
private Map<String, FibaroInfo> fibaros;
private Boolean validFibaro;
public FibaroHome(BridgeSettings bridgeSettings)
{
super();
createHome(bridgeSettings);
}
public List<Device> getDevices()
{
log.debug("consolidating devices for fibaros");
Iterator<String> keys = fibaros.keySet().iterator();
ArrayList<Device> deviceList = new ArrayList<>();
while(keys.hasNext())
{
String key = keys.next();
for(Device device : fibaros.get(key).getDevices())
deviceList.add(device);
}
return deviceList;
}
public List<Scene> getScenes()
{
log.debug("consolidating scenes for fibaros");
Iterator<String> keys = fibaros.keySet().iterator();
ArrayList<Scene> sceneList = new ArrayList<>();
while(keys.hasNext())
{
String key = keys.next();
for(Scene scene : fibaros.get(key).getScenes())
sceneList.add(scene);
}
return sceneList;
}
@Override
public String deviceHandler(CallItem anItem, MultiCommandUtil aMultiUtil, String lightId, int intensity, Integer targetBri, Integer targetBriInc, DeviceDescriptor device, String body)
{
// Not a device handler
return null;
}
@Override
public Object getItems(String type)
{
if(validFibaro)
{
if(type.equalsIgnoreCase(DeviceMapTypes.FIBARO_DEVICE[DeviceMapTypes.typeIndex]))
return getDevices();
if(type.equalsIgnoreCase(DeviceMapTypes.FIBARO_SCENE[DeviceMapTypes.typeIndex]))
return getScenes();
}
return null;
}
@Override
public Home createHome(BridgeSettings bridgeSettings)
{
validFibaro = bridgeSettings.getBridgeSettingsDescriptor().isValidFibaro();
log.info("Fibaro Home created." + (validFibaro ? "" : " No Fibaros configured."));
if(validFibaro)
{
fibaros = new HashMap<String, FibaroInfo>();
Iterator<NamedIP> theList = bridgeSettings.getBridgeSettingsDescriptor().getFibaroAddress().getDevices().iterator();
while(theList.hasNext())
{
NamedIP aFibaro = theList.next();
fibaros.put(aFibaro.getName(), new FibaroInfo(aFibaro));
}
}
return this;
}
@Override
public void closeHome()
{
fibaros = null;
}
}

View File

@@ -0,0 +1,178 @@
package com.bwssystems.HABridge.plugins.fibaro;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import org.apache.commons.codec.binary.Base64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.bwssystems.HABridge.NamedIP;
import com.bwssystems.HABridge.plugins.fibaro.json.Device;
import com.bwssystems.HABridge.plugins.fibaro.json.Room;
import com.bwssystems.HABridge.plugins.fibaro.json.Scene;
import com.google.gson.Gson;
public class FibaroInfo
{
private static final Logger log = LoggerFactory.getLogger(FibaroInfo.class);
private final NamedIP fibaroAddress;
private final String fibaroAuth;
private final Gson gson;
// You can disable it if you want TODO config
boolean useSaveLogs = true; // This can be used to exclude some devices from list
boolean useUserDescription = true;
boolean replaceTrash = true;
boolean scenesWithLiliCommandOnly = true;
public FibaroInfo(NamedIP addressName)
{
super();
fibaroAddress = addressName;
fibaroAuth = "Basic " + new String(Base64.encodeBase64((addressName.getUsername() + ":" + addressName.getPassword()).getBytes()));
gson = new Gson();
}
private String request(String request)
{
String result = null;
try
{
URL url = new URL("http://" + fibaroAddress.getIp() + ":" + fibaroAddress.getPort() + request);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Authorization", fibaroAuth);
connection.setRequestProperty("Content-Type", "application/json;charset=utf-8");
connection.connect();
BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()));
StringBuilder buffer = new StringBuilder();
String line;
while((line = br.readLine()) != null)
{
buffer.append(line).append("\n");
}
br.close();
result = buffer.toString();
}
catch(IOException e)
{
log.warn("Error while get getJson: {} ", request, e);
}
return result;
}
private boolean sendCommand(String request)
{
try
{
URL url = new URL("http://" + fibaroAddress.getIp() + ":" + fibaroAddress.getPort() + request);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Authorization", fibaroAuth);
connection.getResponseMessage();
}
catch(IOException e)
{
log.warn("Error while get getJson: {} ", request, e);
return false;
}
return true;
}
private String replaceTrash(String name)
{
String sanitizedName = name.replaceAll("[0-9:/-]", "");
sanitizedName = name.replaceAll("\\s+", " ");
return sanitizedName.trim();
}
private Room[] getRooms()
{
String result = request("/api/rooms");
Room[] rooms = result == null ? new Room[0] : gson.fromJson(result, Room[].class);
if(replaceTrash)
for(Room r : rooms)
r.setName(replaceTrash(r.getName()));
return rooms;
}
public Device[] getDevices()
{
Room[] rooms = getRooms();
log.info("Found: " + rooms.length + " rooms");
String result = request("/api/devices?enabled=true&visible=true");
Device[] all_devices = result == null ? new Device[0] : gson.fromJson(result, Device[].class);
int count = 0;
for(Device d : all_devices)
if(d.getRoomID() > 0 && (useSaveLogs ? "true".equals(d.getProperties().getSaveLogs()) : true))
count++;
Device[] devices = new Device[count];
int i = 0;
for(Device d : all_devices)
if(d.getRoomID() > 0 && (useSaveLogs ? "true".equals(d.getProperties().getSaveLogs()) : true))
{
if(useUserDescription && d.getProperties().getUserDescription() != null && !d.getProperties().getUserDescription().isEmpty())
d.setName(d.getProperties().getUserDescription());
if(replaceTrash)
d.setName(replaceTrash(d.getName()));
devices[i++] = d;
for(Room room : rooms)
if(d.getRoomID() == room.getId())
d.setRoomName(room.getName());
d.fibaroaddress = fibaroAddress.getIp();
d.fibaroport = fibaroAddress.getPort();
d.fibaroAuth = fibaroAuth;
d.fibaroname = fibaroAddress.getName();
}
log.info("Found: " + devices.length + " devices");
return devices;
}
public Scene[] getScenes()
{
Room[] rooms = getRooms();
String result = request("/api/scenes?enabled=true&visible=true");
Scene[] all_scenes = result == null ? new Scene[0] : gson.fromJson(result, Scene[].class);
int count = 0;
for(Scene s : all_scenes)
if(!scenesWithLiliCommandOnly || s.getLiliStartCommand() != null && !s.getLiliStartCommand().isEmpty())
count++;
Scene[] scenes = new Scene[count];
int i = 0;
for(Scene s : all_scenes)
if(!scenesWithLiliCommandOnly || s.getLiliStartCommand() != null && !s.getLiliStartCommand().isEmpty())
{
if(replaceTrash)
s.setName(replaceTrash(s.getName()));
scenes[i++] = s;
for(Room room : rooms)
if(s.getRoomID() == room.getId())
s.setRoomName(room.getName());
s.fibaroaddress = fibaroAddress.getIp();
s.fibaroport = fibaroAddress.getPort();
s.fibaroAuth = fibaroAuth;
s.fibaroname = fibaroAddress.getName();
}
log.info("Found: " + count + " scenes");
return scenes;
}
}

View File

@@ -0,0 +1,35 @@
package com.bwssystems.HABridge.plugins.fibaro;
public enum ModeType {
OFF(0, "Off"),
HEAT(1, "Heat"),
COOL(2, "Cool"),
AUTO(3, "Auto"),
AUX_HEAT(4, "Aux Heat"),
RESUME(5, "Resume"),
FAN_ONLY(6, "Fan Only"),
FURNANCE(7, "Furnace"),
DRY_AIR(8, "Dry Air"),
MOIST_AIR(9, "Moist Air"),
AUTO_CHANGEOVER(10, "Auto Changeover"),
HEAT_ECON(11, "Heat Econ"),
COOL_ECON(12, "Cool Econ"),
AWAY(13, "Away"),
MANUAL(31, "Manual");
private int key;
private String label;
private ModeType(int key, String label) {
this.key = key;
this.label = label;
}
public int getKey() {
return key;
}
public String getLabel() {
return label;
}
}

View File

@@ -0,0 +1,108 @@
package com.bwssystems.HABridge.plugins.fibaro.json;
import com.google.gson.annotations.SerializedName;
public class Device {
private String roomName;
@SerializedName("id")
private String id;
@SerializedName("name")
private String name;
@SerializedName("roomID")
private int roomID;
@SerializedName("type")
private String type;
@SerializedName("baseType")
private String baseType;
@SerializedName("enabled")
private boolean enabled;
@SerializedName("visible")
private boolean visible;
@SerializedName("isPlugin")
private boolean isPlugin;
@SerializedName("parentId")
private int parentId;
@SerializedName("remoteGatewayId")
private int remoteGatewayId;
@SerializedName("viewXml")
private boolean viewXml;
@SerializedName("configXml")
private boolean configXml;
@SerializedName("interfaces")
private Object interfaces;
@SerializedName("properties")
private DeviceProperties properties;
@SerializedName("actions")
private Object actions;
@SerializedName("created")
private int created;
@SerializedName("modified")
private int modified;
@SerializedName("sortOrder")
private int sortOrder;
public String getRoomName() {
return roomName;
}
public void setRoomName(String roomName) {
this.roomName = roomName;
}
public String getId() {
return id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getRoomID() {
return roomID;
}
public String getType() {
return type;
}
public DeviceProperties getProperties() {
return properties;
}
public boolean isThermostat() {
return type.equals("com.fibaro.setPoint") || type.equals("com.fibaro.thermostatDanfoss")
|| type.equals("com.fibaro.thermostatHorstmann");
}
@Override
public String toString() {
return "{" + id + ", " + name + "}";
}
public String fibaroaddress;
public String fibaroport;
public String fibaroAuth;
public String fibaroname;
}

View File

@@ -0,0 +1,244 @@
package com.bwssystems.HABridge.plugins.fibaro.json;
import com.google.gson.annotations.SerializedName;
public class DeviceProperties {
@SerializedName("batteryLevel")
private String batteryLevel;
@SerializedName("UIMessageSendTime")
private String UIMessageSendTime;
@SerializedName("autoConfig")
private String autoConfig;
@SerializedName("color")
private String color;
@SerializedName("date")
private String date;
@SerializedName("dead")
private String dead;
@SerializedName("deviceControlType")
private String deviceControlType;
@SerializedName("deviceIcon")
private String deviceIcon;
@SerializedName("disabled")
private String disabled;
@SerializedName("emailNotificationID")
private String emailNotificationID;
@SerializedName("emailNotificationType")
private String emailNotificationType;
@SerializedName("endPoint")
private String endPoint;
@SerializedName("energy")
private String energy;
@SerializedName("liliOffCommand")
private String liliOffCommand;
@SerializedName("liliOnCommand")
private String liliOnCommand;
@SerializedName("log")
private String log;
@SerializedName("logTemp")
private String logTemp;
@SerializedName("manufacturer")
private String manufacturer;
@SerializedName("markAsDead")
private String markAsDead;
@SerializedName("mode")
private String mode;
@SerializedName("model")
private String model;
@SerializedName("nodeID")
private String nodeID;
@SerializedName("pollingDeadDevice")
private String pollingDeadDevice;
@SerializedName("pollingTime")
private String pollingTime;
@SerializedName("pollingTimeNext")
private String pollingTimeNext;
@SerializedName("pollingTimeSec")
private int pollingTimeSec;
@SerializedName("power")
private String power;
@SerializedName("productInfo")
private String productInfo;
@SerializedName("pushNotificationID")
private String pushNotificationID;
@SerializedName("pushNotificationType")
private String pushNotificationType;
@SerializedName("remoteGatewayId")
private String remoteGatewayId;
@SerializedName("requestNodeNeighborStat")
private String requestNodeNeighborStat;
@SerializedName("requestNodeNeighborStatTimeStemp")
private String requestNodeNeighborStatTimeStemp;
@SerializedName("requestNodeNeighborState")
private String requestNodeNeighborState;
@SerializedName("requestNodeNeighborStateTimeStemp")
private String requestNodeNeighborStateTimeStemp;
@SerializedName("saveLogs")
private String saveLogs;
@SerializedName("showChildren")
private String showChildren;
@SerializedName("smsNotificationID")
private String smsNotificationID;
@SerializedName("smsNotificationType")
private String smsNotificationType;
@SerializedName("supportedModes")
private String supportedModes;
@SerializedName("targetLevel")
private String targetLevel;
@SerializedName("unit")
private String unit;
@SerializedName("useTemplate")
private String useTemplate;
@SerializedName("status")
private String status;
@SerializedName("sunriseHour")
private String sunriseHour;
@SerializedName("sunsetHour")
private String sunsetHour;
@SerializedName("userDescription")
private String userDescription;
@SerializedName("value")
private String value;
@SerializedName("zwaveBuildVersion")
private String zwaveBuildVersion;
@SerializedName("zwaveCompany")
private String zwaveCompany;
@SerializedName("zwaveInfo")
private String zwaveInfo;
@SerializedName("zwaveRegion")
private String zwaveRegion;
@SerializedName("zwaveVersion")
private double zwaveVersion;
public String getBatteryLevel() {
return batteryLevel;
}
public String getColor() {
return color;
}
public String getDeviceControlType() {
return deviceControlType;
}
public String getEnergy() {
return energy;
}
public String getPower() {
return power;
}
public String getTargetLevel() {
return targetLevel;
}
public String getValue() {
return value;
}
// --- begin yrWeather plugin ---
@SerializedName("Humidity")
private String Humidity;
@SerializedName("Pressure")
private String Pressure;
@SerializedName("Temperature")
private String Temperature;
@SerializedName("WeatherCondition")
private String WeatherCondition;
@SerializedName("Wind")
private String Wind;
public String getHumidity() {
return Humidity;
}
public String getPressure() {
return Pressure;
}
public String getSaveLogs()
{
return saveLogs;
}
public String getTemperature() {
return Temperature;
}
public String getWeatherCondition() {
return WeatherCondition;
}
public String getWind() {
return Wind;
}
// --- end yrWeather plugin ---
public String getUserDescription()
{
return userDescription;
}
public void setUserDescription(String userDescription)
{
this.userDescription = userDescription;
}
}

View File

@@ -0,0 +1,43 @@
package com.bwssystems.HABridge.plugins.fibaro.json;
import com.google.gson.annotations.SerializedName;
public class Room {
@SerializedName("id")
private int id;
@SerializedName("name")
private String name;
@SerializedName("sectionID")
private int sectionID;
@SerializedName("icon")
private String icon;
@SerializedName("defaultSensors")
private Sensor defaultSensors;
@SerializedName("defaultThermostat")
private int defaultThermostat;
@SerializedName("sortOrder")
private int sortOrder;
public int getId() {
return id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getSectionID()
{
return sectionID;
}
}

View File

@@ -0,0 +1,100 @@
package com.bwssystems.HABridge.plugins.fibaro.json;
import com.google.gson.annotations.SerializedName;
public class Scene {
private String roomName;
@SerializedName("id")
private String id;
@SerializedName("name")
private String name;
@SerializedName("type")
private String type;
@SerializedName("properties")
private String properties;
@SerializedName("roomID")
private int roomID;
@SerializedName("iconID")
private int iconID;
@SerializedName("runConfig")
private String runConfig;
@SerializedName("autostart")
private boolean autostart;
@SerializedName("protectedByPIN")
private boolean protectedByPIN;
@SerializedName("killable")
private boolean killable;
@SerializedName("maxRunningInstances")
private int maxRunningInstances;
@SerializedName("runningInstances")
private int runningInstances;
@SerializedName("visible")
private boolean visible;
@SerializedName("isLua")
private boolean isLua;
@SerializedName("triggers")
private SceneTriggers triggers;
@SerializedName("liliStartCommand")
private String liliStartCommand;
@SerializedName("liliStopCommand")
private String liliStopCommand;
@SerializedName("sortOrder")
private int sortOrder;
public String getRoomName() {
return roomName;
}
public void setRoomName(String roomName) {
this.roomName = roomName;
}
public String getId() {
return id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getRoomID() {
return roomID;
}
public String getLiliStartCommand()
{
return liliStartCommand;
}
@Override
public String toString() {
return "{" + id + ", " + name + "}";
}
public String fibaroaddress;
public String fibaroport;
public String fibaroAuth;
public String fibaroname;
}

View File

@@ -0,0 +1,11 @@
package com.bwssystems.HABridge.plugins.fibaro.json;
import com.google.gson.annotations.SerializedName;
public class SceneProperties {
@SerializedName("id")
private String id;
@SerializedName("name")
private String name;
}

View File

@@ -0,0 +1,14 @@
package com.bwssystems.HABridge.plugins.fibaro.json;
import com.google.gson.annotations.SerializedName;
public class SceneTriggers {
@SerializedName("properties")
private SceneProperties[] properties;
@SerializedName("globals")
private String[] globals;
@SerializedName("events")
private String[] events;
}

View File

@@ -0,0 +1,14 @@
package com.bwssystems.HABridge.plugins.fibaro.json;
import com.google.gson.annotations.SerializedName;
public class Sensor {
@SerializedName("temperature")
private int temperature;
@SerializedName("humidity")
private int humidity;
@SerializedName("light")
private int light;
}