mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-18 08:13:23 +00:00
Working on pairing with hue app
This commit is contained in:
@@ -121,7 +121,6 @@ public class BridgeSettingsDescriptor {
|
|||||||
this.somfyconfigured = false;
|
this.somfyconfigured = false;
|
||||||
this.lifxconfigured = false;
|
this.lifxconfigured = false;
|
||||||
this.farenheit = true;
|
this.farenheit = true;
|
||||||
this.whitelist = null;
|
|
||||||
this.securityData = null;
|
this.securityData = null;
|
||||||
this.settingsChanged = false;
|
this.settingsChanged = false;
|
||||||
this.myechourl = "echo.amazon.com/#cards";
|
this.myechourl = "echo.amazon.com/#cards";
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ public class HueApiResponse {
|
|||||||
private Map<String, JsonObject> rules;
|
private Map<String, JsonObject> rules;
|
||||||
private HueConfig config;
|
private HueConfig config;
|
||||||
|
|
||||||
public HueApiResponse(String name, String ipaddress, Map<String, WhitelistEntry> awhitelist, String emulateHubVersion) {
|
public HueApiResponse(String name, String ipaddress, Map<String, WhitelistEntry> awhitelist, String emulateHubVersion, boolean isLinkButtonPressed) {
|
||||||
super();
|
super();
|
||||||
this.setConfig(HueConfig.createConfig(name, ipaddress, awhitelist, emulateHubVersion));
|
this.setConfig(HueConfig.createConfig(name, ipaddress, awhitelist, emulateHubVersion, isLinkButtonPressed));
|
||||||
this.setRules(new HashMap<>());
|
this.setRules(new HashMap<>());
|
||||||
this.setSensors(new HashMap<>());
|
this.setSensors(new HashMap<>());
|
||||||
this.setSchedules(new HashMap<>());
|
this.setSchedules(new HashMap<>());
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class HueConfig
|
|||||||
private String replacesbridgeid;
|
private String replacesbridgeid;
|
||||||
private Map<String, WhitelistEntry> whitelist;
|
private Map<String, WhitelistEntry> whitelist;
|
||||||
|
|
||||||
public static HueConfig createConfig(String name, String ipaddress, Map<String, WhitelistEntry> awhitelist, String emulateHubVersion) {
|
public static HueConfig createConfig(String name, String ipaddress, Map<String, WhitelistEntry> awhitelist, String emulateHubVersion, boolean isLinkButtonPressed) {
|
||||||
HueConfig aConfig = new HueConfig();
|
HueConfig aConfig = new HueConfig();
|
||||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
||||||
SimpleDateFormat dateFormatGmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
SimpleDateFormat dateFormatGmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
||||||
@@ -44,7 +44,7 @@ public class HueConfig
|
|||||||
aConfig.setPortalservices(false);
|
aConfig.setPortalservices(false);
|
||||||
aConfig.setGateway(ipaddress);
|
aConfig.setGateway(ipaddress);
|
||||||
aConfig.setSwversion(emulateHubVersion);
|
aConfig.setSwversion(emulateHubVersion);
|
||||||
aConfig.setLinkbutton(true);
|
aConfig.setLinkbutton(isLinkButtonPressed);
|
||||||
aConfig.setIpaddress(ipaddress);
|
aConfig.setIpaddress(ipaddress);
|
||||||
aConfig.setProxyport(0);
|
aConfig.setProxyport(0);
|
||||||
aConfig.setSwupdate(Swupdate.createSwupdate());
|
aConfig.setSwupdate(Swupdate.createSwupdate());
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ public class HueMulator {
|
|||||||
validMapTypes = new DeviceMapTypes();
|
validMapTypes = new DeviceMapTypes();
|
||||||
bridgeSettingMaster = bridgeMaster;
|
bridgeSettingMaster = bridgeMaster;
|
||||||
bridgeSettings = bridgeSettingMaster.getBridgeSettingsDescriptor();
|
bridgeSettings = bridgeSettingMaster.getBridgeSettingsDescriptor();
|
||||||
|
|
||||||
homeManager= aHomeManager;
|
homeManager= aHomeManager;
|
||||||
myHueHome = (HueHome) homeManager.findHome(DeviceMapTypes.HUE_DEVICE[DeviceMapTypes.typeIndex]);
|
myHueHome = (HueHome) homeManager.findHome(DeviceMapTypes.HUE_DEVICE[DeviceMapTypes.typeIndex]);
|
||||||
aGsonHandler = new GsonBuilder().create();
|
aGsonHandler = new GsonBuilder().create();
|
||||||
@@ -769,8 +770,8 @@ public class HueMulator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HueApiResponse apiResponse = new HueApiResponse("Philips hue", bridgeSettings.getUpnpConfigAddress(),
|
HueApiResponse apiResponse = new HueApiResponse("Philips hue", bridgeSettings.getUpnpConfigAddress(),
|
||||||
bridgeSettings.getWhitelist(), bridgeSettings.getHubversion());
|
bridgeSettings.getWhitelist(), bridgeSettings.getHubversion(), bridgeSettingMaster.getBridgeControl().isLinkButton());
|
||||||
|
log.debug("api response config <<<" + aGsonHandler.toJson(apiResponse.getConfig()) + ">>>");
|
||||||
return apiResponse.getConfig();
|
return apiResponse.getConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -782,7 +783,7 @@ public class HueMulator {
|
|||||||
return theErrors;
|
return theErrors;
|
||||||
|
|
||||||
HueApiResponse apiResponse = new HueApiResponse("Philips hue", bridgeSettings.getUpnpConfigAddress(),
|
HueApiResponse apiResponse = new HueApiResponse("Philips hue", bridgeSettings.getUpnpConfigAddress(),
|
||||||
bridgeSettings.getWhitelist(), bridgeSettings.getHubversion());
|
bridgeSettings.getWhitelist(), bridgeSettings.getHubversion(), bridgeSettingMaster.getBridgeControl().isLinkButton());
|
||||||
apiResponse.setLights((Map<String, DeviceResponse>) this.lightsListHandler(userId, ipAddress));
|
apiResponse.setLights((Map<String, DeviceResponse>) this.lightsListHandler(userId, ipAddress));
|
||||||
apiResponse.setGroups((Map<String, GroupResponse>) this.groupsListHandler(userId, ipAddress));
|
apiResponse.setGroups((Map<String, GroupResponse>) this.groupsListHandler(userId, ipAddress));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user