Compare commits

..

10 Commits

Author SHA1 Message Date
BWS Systems
d9e09851ee Merge pull request #1392 from dedeweb/master
Domoticz API changes
2025-09-07 09:52:45 -04:00
denis
d57bfec7ba use new domoticz API 2023-09-14 09:37:21 +02:00
BWS Systems
483b165f2a update pom.xml to correct version umber 2022-02-10 10:32:19 -05:00
BWS Systems
e2969c1a49 Merge pull request #1358 from bwssytems/devbranch5.4.1
Devbranch5.4.1
fixes #1267
2022-01-30 15:17:42 -05:00
BWS Systems
c99777efe7 Merge pull request #1318 from bwssytems/dependabot/maven/org.apache.httpcomponents-httpclient-4.5.13
Bump httpclient from 4.5.1 to 4.5.13
2022-01-30 15:01:27 -05:00
BWS Systems
8363d4c78c Merge pull request #1314 from hanno2003/master
Fixed typo in docker setup script
2022-01-30 15:00:23 -05:00
dependabot[bot]
e015bca721 Bump httpclient from 4.5.1 to 4.5.13
Bumps httpclient from 4.5.1 to 4.5.13.

---
updated-dependencies:
- dependency-name: org.apache.httpcomponents:httpclient
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-04 01:05:03 +00:00
hgeorg
3b5eea0dce Merge pull request #1 from hgeorg/hgeorg-patch-1
Update README.md
2021-05-25 23:37:55 +02:00
hgeorg
25e8b3f24f Update README.md
Fixed typo in docker script
2021-05-25 23:37:35 +02:00
crush157
7f72b0311a Add option to set hue uid to 9 octets 2021-03-24 14:31:11 -04:00
7 changed files with 56 additions and 24 deletions

View File

@@ -57,20 +57,20 @@ Then locate the jar and start the server with:
ATTENTION: Due to port 80 being the default, Linux restricts this to super user. Use the instructions below. ATTENTION: Due to port 80 being the default, Linux restricts this to super user. Use the instructions below.
``` ```
java -jar ha-bridge-5.4.0.jar java -jar ha-bridge-5.4.1.jar
``` ```
## Manual installation of ha-bridge and setup of systemd service ## Manual installation of ha-bridge and setup of systemd service
Next gen Linux systems (this includes the Raspberry Pi), use systemd to run and manage services. Next gen Linux systems (this includes the Raspberry Pi), use systemd to run and manage services.
Here is a link on how to use systemd: https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units Here is a link on how to use systemd: https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units
Create the directory and make sure that ha-bridge-5.4.0.jar is in your /home/pi/ha-bridge directory. Create the directory and make sure that ha-bridge-5.4.1.jar is in your /home/pi/ha-bridge directory.
``` ```
pi@raspberrypi:~ $ mkdir ha-bridge pi@raspberrypi:~ $ mkdir ha-bridge
pi@raspberrypi:~ $ cd ha-bridge pi@raspberrypi:~ $ cd ha-bridge
pi@raspberrypi:~/ha-bridge $ wget https://github.com/bwssytems/ha-bridge/releases/download/v5.4.0/ha-bridge-5.4.0.jar pi@raspberrypi:~/ha-bridge $ wget https://github.com/bwssytems/ha-bridge/releases/download/v5.4.1/ha-bridge-5.4.1.jar
``` ```
Create the ha-bridge.service unit file: Create the ha-bridge.service unit file:
@@ -89,7 +89,7 @@ After=network.target
Type=simple Type=simple
WorkingDirectory=/home/pi/ha-bridge WorkingDirectory=/home/pi/ha-bridge
ExecStart=/usr/bin/java -jar -Dconfig.file=/home/pi/ha-bridge/data/habridge.config /home/pi/ha-bridge/ha-bridge-5.4.0.jar ExecStart=/usr/bin/java -jar -Dconfig.file=/home/pi/ha-bridge/data/habridge.config /home/pi/ha-bridge/ha-bridge-5.4.1.jar
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
@@ -161,7 +161,7 @@ pi@raspberrypi:~ $ docker run \
--volume=$PWD:/ha-bridge/data \ --volume=$PWD:/ha-bridge/data \
--volume=/etc/localtime:/etc/localtime:ro \ --volume=/etc/localtime:/etc/localtime:ro \
--volume=/etc/timezone:/etc/timezone:ro \ --volume=/etc/timezone:/etc/timezone:ro \
habridge/ha-bridge-raspberry-pi3 \ habridge/ha-bridge-raspberrypi3 \
-Dserver.port=8080 \ -Dserver.port=8080 \
-Dsecurity.key=secret -Dsecurity.key=secret
``` ```

View File

@@ -5,7 +5,7 @@
<groupId>com.bwssystems.HABridge</groupId> <groupId>com.bwssystems.HABridge</groupId>
<artifactId>ha-bridge</artifactId> <artifactId>ha-bridge</artifactId>
<version>5.4.0-java11</version> <version>5.4.1-java11</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>HA Bridge</name> <name>HA Bridge</name>
@@ -71,7 +71,7 @@
<dependency> <dependency>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId> <artifactId>httpclient</artifactId>
<version>4.5.1</version> <version>4.5.13</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>

View File

@@ -138,6 +138,9 @@ public class BridgeSettingsDescriptor {
@SerializedName("linkbuttontimeout") @SerializedName("linkbuttontimeout")
@Expose @Expose
private Integer linkbuttontimeout; private Integer linkbuttontimeout;
@SerializedName("uidnineoctets")
@Expose
private boolean uidnineoctets;
// @SerializedName("activeloggers") // @SerializedName("activeloggers")
// @Expose // @Expose
@@ -202,6 +205,7 @@ public class BridgeSettingsDescriptor {
this.configfile = Configuration.CONFIG_FILE; this.configfile = Configuration.CONFIG_FILE;
this.upnpadvanced = false; this.upnpadvanced = false;
this.linkbuttontimeout = Configuration.LINK_BUTTON_TIMEOUT; this.linkbuttontimeout = Configuration.LINK_BUTTON_TIMEOUT;
this.uidnineoctets = false;
} }
public String getUpnpConfigAddress() { public String getUpnpConfigAddress() {
@@ -873,4 +877,12 @@ public class BridgeSettingsDescriptor {
public void setLinkbuttontimeout(Integer linkbuttontimeout) { public void setLinkbuttontimeout(Integer linkbuttontimeout) {
this.linkbuttontimeout = linkbuttontimeout; this.linkbuttontimeout = linkbuttontimeout;
} }
public boolean isUidnineoctets() {
return uidnineoctets;
}
public void setUidnineoctets(boolean uidnineoctets) {
this.uidnineoctets = uidnineoctets;
}
} }

View File

@@ -18,7 +18,7 @@ import com.bwssystems.HABridge.DeviceMapTypes;
import com.bwssystems.HABridge.api.CallItem; import com.bwssystems.HABridge.api.CallItem;
import com.bwssystems.HABridge.api.hue.DeviceResponse; import com.bwssystems.HABridge.api.hue.DeviceResponse;
import com.bwssystems.HABridge.api.hue.DeviceState; import com.bwssystems.HABridge.api.hue.DeviceState;
import com.bwssystems.HABridge.dao.DeviceDescriptor; // import com.bwssystems.HABridge.dao.DeviceDescriptor;
import com.bwssystems.HABridge.plugins.hue.HueHome; import com.bwssystems.HABridge.plugins.hue.HueHome;
import com.bwssystems.HABridge.util.BackupHandler; import com.bwssystems.HABridge.util.BackupHandler;
import com.bwssystems.HABridge.util.JsonTransformer; import com.bwssystems.HABridge.util.JsonTransformer;
@@ -43,9 +43,10 @@ public class DeviceRepository extends BackupHandler {
private Gson gson; private Gson gson;
private Integer nextId; private Integer nextId;
private Integer seedId; private Integer seedId;
private boolean uidnineoctets;
private Logger log = LoggerFactory.getLogger(DeviceRepository.class); private Logger log = LoggerFactory.getLogger(DeviceRepository.class);
public DeviceRepository(String deviceDb, Integer seedid) { public DeviceRepository(String deviceDb, Integer seedid, boolean uidnineoctets_setting) {
super(); super();
gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
repositoryPath = null; repositoryPath = null;
@@ -53,6 +54,7 @@ public class DeviceRepository extends BackupHandler {
setupParams(repositoryPath, ".bk", "device.db-"); setupParams(repositoryPath, ".bk", "device.db-");
nextId = seedid; nextId = seedid;
seedId = seedid; seedId = seedid;
uidnineoctets = uidnineoctets_setting;
_loadRepository(repositoryPath); _loadRepository(repositoryPath);
} }
@@ -311,22 +313,35 @@ public class DeviceRepository extends BackupHandler {
log.warn("Cannot get MD5 utility to hash unique ids."); log.warn("Cannot get MD5 utility to hash unique ids.");
} }
if(md != null) { if (md != null) {
md.update(anId.toString().getBytes()); md.update(anId.toString().getBytes());
byte[] digest = md.digest(); byte[] digest = md.digest();
theUniqueId = String.format("%s:%s:%s:%s:%s:%s:%s-%s", if (uidnineoctets) {
HexLibrary.encodeHexString(digest).substring(0, 2), theUniqueId = String.format("00:%s:%s:%s:%s:%s:%s:%s-%s",
HexLibrary.encodeHexString(digest).substring(2, 4), HexLibrary.encodeHexString(digest).substring(0, 2),
HexLibrary.encodeHexString(digest).substring(4, 6), HexLibrary.encodeHexString(digest).substring(2, 4),
HexLibrary.encodeHexString(digest).substring(6, 8), HexLibrary.encodeHexString(digest).substring(4, 6),
HexLibrary.encodeHexString(digest).substring(8, 10), HexLibrary.encodeHexString(digest).substring(6, 8),
HexLibrary.encodeHexString(digest).substring(10, 12), HexLibrary.encodeHexString(digest).substring(8, 10),
HexLibrary.encodeHexString(digest).substring(12, 14), HexLibrary.encodeHexString(digest).substring(10, 12),
HexLibrary.encodeHexString(digest).substring(14, 16)); HexLibrary.encodeHexString(digest).substring(12, 14),
HexLibrary.encodeHexString(digest).substring(14, 16));
} else {
theUniqueId = String.format("%s:%s:%s:%s:%s:%s:%s-%s",
HexLibrary.encodeHexString(digest).substring(0, 2),
HexLibrary.encodeHexString(digest).substring(2, 4),
HexLibrary.encodeHexString(digest).substring(4, 6),
HexLibrary.encodeHexString(digest).substring(6, 8),
HexLibrary.encodeHexString(digest).substring(8, 10),
HexLibrary.encodeHexString(digest).substring(10, 12),
HexLibrary.encodeHexString(digest).substring(12, 14),
HexLibrary.encodeHexString(digest).substring(14, 16));
}
} }
if (theUniqueId == null) {
if(theUniqueId == null) {
newValue = anId % 256; newValue = anId % 256;
if (newValue <= 0) if (newValue <= 0)
newValue = 1; newValue = 1;

View File

@@ -48,7 +48,7 @@ public class DeviceResource {
public DeviceResource(BridgeSettings theSettings, HomeManager aHomeManager) { public DeviceResource(BridgeSettings theSettings, HomeManager aHomeManager) {
bridgeSettings = theSettings; bridgeSettings = theSettings;
this.deviceRepository = new DeviceRepository(bridgeSettings.getBridgeSettingsDescriptor().getUpnpDeviceDb(), bridgeSettings.getBridgeSettingsDescriptor().getSeedid()); this.deviceRepository = new DeviceRepository(bridgeSettings.getBridgeSettingsDescriptor().getUpnpDeviceDb(), bridgeSettings.getBridgeSettingsDescriptor().getSeedid(), bridgeSettings.getBridgeSettingsDescriptor().isUidnineoctets());
this.groupRepository = new GroupRepository(bridgeSettings.getBridgeSettingsDescriptor().getUpnpGroupDb()); this.groupRepository = new GroupRepository(bridgeSettings.getBridgeSettingsDescriptor().getUpnpGroupDb());
homeManager = aHomeManager; homeManager = aHomeManager;
aGsonHandler = new GsonBuilder().create(); aGsonHandler = new GsonBuilder().create();

View File

@@ -12,8 +12,8 @@ import com.google.gson.Gson;
public class DomoticzHandler { public class DomoticzHandler {
private static final Logger log = LoggerFactory.getLogger(DomoticzHandler.class); private static final Logger log = LoggerFactory.getLogger(DomoticzHandler.class);
private static final String GET_REQUEST = "/json.htm?type="; private static final String GET_REQUEST = "/json.htm?type=command&param=";
private static final String DEVICES_TYPE = "devices"; private static final String DEVICES_TYPE = "getdevices";
private static final String SCENES_TYPE = "scenes"; private static final String SCENES_TYPE = "scenes";
private static final String FILTER_USED = "&used=true"; private static final String FILTER_USED = "&used=true";
private NamedIP domoticzAddress; private NamedIP domoticzAddress;

View File

@@ -829,6 +829,11 @@
<td><input type="checkbox" ng-model="bridge.settings.upnpadvanced" ng-true-value=true <td><input type="checkbox" ng-model="bridge.settings.upnpadvanced" ng-true-value=true
ng-false-value=false> {{bridge.settings.upnpadvanced}}</td> ng-false-value=false> {{bridge.settings.upnpadvanced}}</td>
</tr> </tr>
<tr>
<td>Unique ID to use 9 Octets (Renumber after saving this setting)</td>
<td><input type="checkbox" ng-model="bridge.settings.uidnineoctets" ng-true-value=true
ng-false-value=false> {{bridge.settings.uidnineoctets}}</td>
</tr>
<tr> <tr>
<td>Trace UPNP Calls</td> <td>Trace UPNP Calls</td>
<td><input type="checkbox" ng-model="bridge.settings.traceupnp" ng-true-value=true <td><input type="checkbox" ng-model="bridge.settings.traceupnp" ng-true-value=true