Compare commits

..

12 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
BWS Systems
b3f2c25721 Merge pull request #1266 from bwssytems/dev_branch_5.3.x
Dev branch 5.3.x to create v5.4.0

#1044 Alexa app, error "Device doesn't support requested value" bug question
#1118 Device status update in Alexa App is not working correctly for ha-bridge devices bug duplicate question
#1126 Can't get XY ColorData into URL enhancement question
#1127 Can't get separate hue, saturation and brightness enhancement question
#1128 Wrong color calucation in HS mode bug question
#1131 Changing color temperatur is not working correctly bug question
#1132 Conversion from CIE to RGB incorrect bug question
#1139 Device ID creation fails bug question
#1150 Home Assistant gets null exception during initialization bug question
#1170 Alexa not sending the correct color codes duplicate
#1171 Please add option: If bright request present with on, only send dim enhancement
#1184 Alexa will not discover HABridge question
#1191 When "Use UPNP Address Interface Only" is selected, echo cannot find ha-bridge bug
#1210 [Enahnacement] Have link button timeout be configurable enhancement
#1215 Alexa unable to discover recently added devices to ha-bridge duplicate question
#1227 Feature request: ${intensity.previous} value passing control enhancement
#1239 HA-Bridge has suddenly given up itself - Exception in thread "main" java.lang.NullPointerException bug question
#1243 Alexa device discovery now broke question
#1253 HABridge hue ColorDecode 0 0 0 bug question
#1256 Homeassistant devices not appearing bug question
2020-12-14 12:20:52 -06:00
bwssystems
98008428a7 Fixed HomeAssistant issues and this is teh release for 5.4.0 2020-12-14 12:17:44 -06:00
9 changed files with 396 additions and 61 deletions

105
README.md
View File

@@ -35,7 +35,7 @@ A Custom implementation path looks like this:
**NOTE: This software does not control Philips Hue devices directly. A physical Philips Hue Hub is required for that, by which the ha-bridge can then proxy all of your real Hue bridges behind this bridge.**
**ISSUE: Google Home does NOT support local connection to Philips Hue Hubs and requires that it connect to meethue.com. Since the ha-bridge only emulates the local API, and is not associated with Philips, this method will not work. If you have an older Google Home application, this may still work. YMMV.**
**ISSUE: Google Home does NOT support local connection to Philips Hue Hubs and requires that it connect to meethue.com. Since the ha-bridge only emulates the local API, and is not associated with Philips, this method will not work.**
**FAQ: Please look here for the current FAQs! https://github.com/bwssytems/ha-bridge/wiki/HA-Bridge-FAQs**
@@ -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.
```
java -jar ha-bridge-5.3.1RC5.jar
java -jar ha-bridge-5.4.1.jar
```
## 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.
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.3.1RC5.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:~ $ cd ha-bridge
pi@raspberrypi:~/ha-bridge $ wget https://github.com/bwssytems/ha-bridge/releases/download/v5.3.1RC5/ha-bridge-5.3.1RC5.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:
@@ -89,7 +89,7 @@ After=network.target
Type=simple
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.3.1RC5.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]
WantedBy=multi-user.target
@@ -161,7 +161,7 @@ pi@raspberrypi:~ $ docker run \
--volume=$PWD:/ha-bridge/data \
--volume=/etc/localtime:/etc/localtime:ro \
--volume=/etc/timezone:/etc/timezone:ro \
habridge/ha-bridge-raspberry-pi3 \
habridge/ha-bridge-raspberrypi3 \
-Dserver.port=8080 \
-Dsecurity.key=secret
```
@@ -375,6 +375,10 @@ This setting is in bridge-id, uuid, etc. in ha-bridge hue config replies. Leave
This setting is the time used in between button presses when there is multiple buttons in a button device. It also controls the time between multiple items in a custom device call. This is defaulted to 100ms and the number represents milliseconds (1000 milliseconds = 1 second).
#### Log Messages to Buffer
This controls how many log messages will be kept and displayed on the log tab. This does not affect what is written to the standard output for logging. The default is 512. Changing this will incur more memory usage of the process.
#### UPNP Original (simple version) ####
Use very simplistic UPNP handling that was used in versions previous to 4.0. (Not Recommended)
#### UPNP Advanced (use multiple responses and notifies) ####
Turns on advanced UPP that hue bridge version 1 used at the latest release, not very stable. (Not Recommended)
#### Trace UPNP Calls
Turn on tracing for upnp discovery messages to the log. The default is false.
#### Trace State Changes
@@ -516,6 +520,59 @@ e.g.
[{"item":{"clientId":"TestClient","topic":"Yep","message":"This is the time ${time.format(yyyy-MM-ddTHH:mm:ssXXX)}"},"type":"mqttDevice"}]
```
Listing of all intensity replacement values that can be used.
Replacement target text | Description
------------------------|------------
${intensity.percent} | Insert the whole number percentage value e.g. 45
${intensity.decimal_percent} | Insert the decimal percentage value e.g. 0.45
${intensity.byte} | Insert the byte value
${intensity.math(X)} | Insert the math function identified by X
${intensity.math(X).hex} | Insert the hex value of the math function identified by X
${intensity.percent.hex} | Insert the hex value of the integer percentage value
${intensity.byte.hex} | Insert the hex value of the byte value
${intensity.previous_percent} | Insert the previous integer percentage value
${intensity.previous_decimal_percent}Insert the previous decimal percentage value
${intensity.previous_byte} | Insert the previous byte value
Listing of all color replacement values that can be used.
Replacement target text | Description
------------------------| -----------
${color.r} | Insert the integer value of Red e.g. 123
${color.g} | Insert the integer value of Green e.g. 241
${color.b} | Insert the integer value of Blue e.g. 255
${color.rx} | Insert the hex value of Red e.g. 7BX
${color.gx} | Insert the hex value of Green e.g. F1X
${color.bx} | Insert the hex value of Blue e.g. FFX
${color.rgbx} | Insert the hex value of all rgb e.g. 7BF1FFX
${color.hsb} | Insert the hsb value e.g. 186.3636,100.0,74.1176
${color.h} | Insert the decimal value of hue e.g. 186.3636
${color.s} | Insert the decimal value of saturation e.g. 100.0
${colorbri} | Insert the integer value of the intensity
${color.milight:([01234])} | Insert the converted value for milight
Listing of all ha-bridge device data replacement values that can be used.
Replacement target text | Description
------------------------|------------
${device.id} | Insert the ID of the device
${device.uniqueid} | Insert the unique ID of the device
${device.name} | Insert the name of the device
${device.mapId} | Insert the map ID of the deivice
${device.mapType} | Insert the map type of the device
${device.deviceType} | Insert the device type of the device
${device.targetDevice} | Insert the target device of the device
${device.requesterAddress} | Insert the requester address of the device being addressed
${device.description} | Insert the description of the device
${device.comments} | Insert the comments of the device
Listing of all time data replacement values that can be used.
Replacement target text | Description
------------------------|------------
${time.format([Java SimpleDateFormat style string]) | Insert the current time described by java SimpleDateFormat string descriptor
${time.millis} | Insert the current time in milliseconds that the system returns
Also, you may want to use the REST APIs listed below to configure your devices.
## Ask Alexa
@@ -537,41 +594,7 @@ DIM Commands| Alexa, set `<Device Name>` to `<Position>`
To see what Alexa thinks you said, you can check in the home page for your Alexa.
To view or remove devices that Alexa knows about, you can use the mobile app `Menu / Settings / Connected Home` or go to http://echo.amazon.com/#cards.
## Google Assistant
Google Home is supported as of v3.2.0 and forward, but only if the bridge is running on port 80.
**ISSUE: Google Home does NOT support local connection to Philips Hue Hubs and requires that it connect to meethue.com. Since the ha-bridge only emulates the local API, and is not associated with Philips, this method will not work. If you have an older Google Home application, this may still work. YMMV.**
Use the Google Home app on a phone to add new "home control" devices by going into `Settings / Home Control / +`
as described [here](https://support.google.com/googlehome/answer/7124115?hl=en&ref_topic=7125624#homecontrol).
Click on `Philips Hue` under the `Add new` section. If ha-bridge is on the same network as the
phone as well as the Home device, then the app should quickly pass through the pairing step and
populate with all of the devices. If instead it takes you to a Philips Hue login page, this means
that the bridge was not properly discovered.
Then you can say "OK Google, Turn on the office light" or whatever name you have given your configured devices.
The Google Assistant can also group lights into rooms as described in the main [help article](https://support.google.com/googlehome/answer/7072090?hl=en&ref_topic=7029100).
Here is the table of items to use to tell Google what you want to do. Note that either "OK Google"
or "Hey Google" can be used as a trigger.
To do this: | Say "Hey Google", then...
------------|--------------------------
To turn on/off a light | "Turn on <light name>"
Dim a light | "Dim the <light name>"
Brighten a light | "Brighten the <light name>"
Set a light brightness to a certain percentage | "Set <light name> to 50%"
Dim/Brighten lights by a certain percentage | "Dim/Brighten <light name> by 50%"
Turn on/off all lights in room | "Turn on/off lights in <room name>"
Turn on/off all lights | "Turn on/off all of the lights"
To see what Home thinks you said, you can ask "Hey Google, What did I say?" or check the history in the app.
New or removed devices are picked up automatically as soon as they are added/removed from ha-bridge.
No re-discovery step is necessary.
To view or remove devices that Alexa knows about, you can use the mobile app click on the devices icon or go to http://echo.amazon.com/#cards.
## Configuration REST API Usage
This section will describe the REST API available for configuration. The REST body examples are all formatted for easy reading, the actual body usage should be like this:

273
java8_pom.xml Normal file
View File

@@ -0,0 +1,273 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.bwssystems.HABridge</groupId>
<artifactId>ha-bridge</artifactId>
<version>5.4.0</version>
<packaging>jar</packaging>
<name>HA Bridge</name>
<description>Emulates a Philips Hue bridge to allow the Amazon Echo to hook up to other HA systems, i.e. Vera or Harmony Hub or Nest, using lightweight frameworks</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>Eclipse Paho Repo</id>
<url>https://repo.eclipse.org/content/repositories/paho-releases/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.bwssytems</groupId>
<artifactId>harmony-java-client</artifactId>
<version>master-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.github.bwssytems</groupId>
<artifactId>nest-controller</artifactId>
<version>1.0.14</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.sparkjava</groupId>
<artifactId>spark-core</artifactId>
<version>2.7.2</version>
<exclusions>
<exclusion>
<artifactId>slf4j-simple</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.24</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.6.2</version>
</dependency>
<dependency>
<groupId>net.java.dev.eval</groupId>
<artifactId>eval</artifactId>
<version>0.5</version>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>org.igniterealtime.smack</groupId>
<artifactId>smack-core</artifactId>
<version>4.2.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.paho</groupId>
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.bwssytems</groupId>
<artifactId>lifx-sdk-java</artifactId>
<version>2.1.6</version>
</dependency>
<dependency>
<groupId>com.github.mob41</groupId>
<artifactId>broadlink-java-api</artifactId>
<version>master-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
</dependency>
<dependency>
<groupId>org.jmdns</groupId>
<artifactId>jmdns</artifactId>
<version>3.5.5</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>version.properties</include>
</includes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>version.properties</exclude>
</excludes>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M2</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.3</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<skipTests>false</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>true</minimizeJar>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>META-INF/*.txt</exclude>
<exclude>META-INF/maven/**</exclude>
<exclude>about_files/**</exclude>
</excludes>
</filter>
<filter>
<artifact>*:*</artifact>
</filter>
<filter>
<artifact>org.slf4j:slf4j-api</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<artifact>commons-logging:commons-logging</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<artifact>xpp3:xpp3</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<artifact>org.igniterealtime.smack:*</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<artifact>com.github.bwssytems:harmony-java-client</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<artifact>org.eclipse.paho:org.eclipse.paho.client.mqttv3</artifact>
<includes>
<include>**</include>
</includes>
</filter>
</filters>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.bwssystems.HABridge.HABridge</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

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

View File

@@ -138,6 +138,9 @@ public class BridgeSettingsDescriptor {
@SerializedName("linkbuttontimeout")
@Expose
private Integer linkbuttontimeout;
@SerializedName("uidnineoctets")
@Expose
private boolean uidnineoctets;
// @SerializedName("activeloggers")
// @Expose
@@ -202,6 +205,7 @@ public class BridgeSettingsDescriptor {
this.configfile = Configuration.CONFIG_FILE;
this.upnpadvanced = false;
this.linkbuttontimeout = Configuration.LINK_BUTTON_TIMEOUT;
this.uidnineoctets = false;
}
public String getUpnpConfigAddress() {
@@ -873,4 +877,12 @@ public class BridgeSettingsDescriptor {
public void setLinkbuttontimeout(Integer 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.hue.DeviceResponse;
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.util.BackupHandler;
import com.bwssystems.HABridge.util.JsonTransformer;
@@ -43,9 +43,10 @@ public class DeviceRepository extends BackupHandler {
private Gson gson;
private Integer nextId;
private Integer seedId;
private boolean uidnineoctets;
private Logger log = LoggerFactory.getLogger(DeviceRepository.class);
public DeviceRepository(String deviceDb, Integer seedid) {
public DeviceRepository(String deviceDb, Integer seedid, boolean uidnineoctets_setting) {
super();
gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
repositoryPath = null;
@@ -53,6 +54,7 @@ public class DeviceRepository extends BackupHandler {
setupParams(repositoryPath, ".bk", "device.db-");
nextId = seedid;
seedId = seedid;
uidnineoctets = uidnineoctets_setting;
_loadRepository(repositoryPath);
}
@@ -311,22 +313,35 @@ public class DeviceRepository extends BackupHandler {
log.warn("Cannot get MD5 utility to hash unique ids.");
}
if(md != null) {
if (md != null) {
md.update(anId.toString().getBytes());
byte[] digest = md.digest();
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 (uidnineoctets) {
theUniqueId = String.format("00:%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));
} 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;
if (newValue <= 0)
newValue = 1;

View File

@@ -48,7 +48,7 @@ public class DeviceResource {
public DeviceResource(BridgeSettings theSettings, HomeManager aHomeManager) {
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());
homeManager = aHomeManager;
aGsonHandler = new GsonBuilder().create();

View File

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

View File

@@ -102,6 +102,10 @@ public class HomeAssistant {
if (theAuthType == null) {
try {
theAuthType = new Gson().fromJson(hassAddress.getExtensions(), HassAuth.class);
if(theAuthType == null) {
theAuthType = new HassAuth();
theAuthType.setLegacyauth(false);
}
} catch (Exception e) {
log.warn("Could not read hass auth - continuing with defaults.");
theAuthType = new HassAuth();
@@ -114,7 +118,7 @@ public class HomeAssistant {
private NameValue[] getAuthHeader() {
if (headers == null) {
if (hassAddress.getPassword() != null && !hassAddress.getPassword().isEmpty()) {
headers = new NameValue[1];
headers = new NameValue[2];
headers[0] = new NameValue();
if (isLegacyAuth()) {
headers[0].setName("x-ha-access");
@@ -123,6 +127,9 @@ public class HomeAssistant {
headers[0].setName("Authorization");
headers[0].setValue("Bearer " + hassAddress.getPassword());
}
headers[1] = new NameValue();
headers[1].setName("Accept-Encoding");
headers[1].setValue("gzip");
}
} else if(hassAddress.getPassword() == null || hassAddress.getPassword().isEmpty()) {
headers = null;

View File

@@ -829,6 +829,11 @@
<td><input type="checkbox" ng-model="bridge.settings.upnpadvanced" ng-true-value=true
ng-false-value=false> {{bridge.settings.upnpadvanced}}</td>
</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>
<td>Trace UPNP Calls</td>
<td><input type="checkbox" ng-model="bridge.settings.traceupnp" ng-true-value=true