Compare commits

...

21 Commits

Author SHA1 Message Date
Admin
78d39325b0 Switch Status enhancement
Fixes #461
 Feature Request ${device.XXXX] enhancement
Fixes #577
 [Feature] Select Interface - UPnP Listening on all interfaces/IP
addresses enhancement
Fixes #591
 HAL http Control issue bug
Fixes #661
 Allow edit of configured endpoints in bridge control enhancement
Fixes #662
2017-06-09 13:17:40 -05:00
Admin
208b1cad2a Fixed HAL control issue, added switch status, added new ${device.xxx}
replacement items and interface selection for upnp
2017-06-09 12:57:18 -05:00
Admin
998450af4e Updating HAL changes 2017-05-31 16:32:33 -05:00
Admin
d78c7c536d Updateing HAL handling 2017-05-30 16:41:26 -05:00
Admin
fb9cc64839 Fix HAL connect issues. 2017-05-26 15:36:01 -05:00
BWS Systems
409c93bfb2 Merge pull request #647 from bwssytems/Fixes-for-v4.5
Fixes for v4.5
2017-05-24 16:05:24 -05:00
Admin
543a79bb66 Update version 2017-05-24 16:02:12 -05:00
BWS Systems
16d1054b96 Merge pull request #646 from bwssytems/master
Update from master branch
2017-05-24 15:59:24 -05:00
BWS Systems
165b6ef9bb Merge branch 'Fixes-for-v4.5' into master 2017-05-24 15:59:13 -05:00
BWS Systems
fb94b858f6 Merge pull request #635 from ibenrodriguez/master
minor typos in README
2017-05-24 15:55:55 -05:00
Admin
ea80925533 remove .map files and remove async from run function. 2017-05-24 15:54:21 -05:00
Admin
62b896ee07 Implement devimal percent for no locale, add HAL https and debugging for
link buttton usage.
2017-05-19 15:45:56 -05:00
Iben Rodriguez
8657ea6704 removing duplicate wget instructions in README file
removing duplicate wget instructions in README file lines 73-79 were
duplicated at 80-81
2017-05-17 06:42:59 -07:00
Iben Rodriguez
05bd6b6d77 minor typos in README
Corrected a few minor typos in the README file such as API being UPPER
CASE.
2017-05-16 18:05:07 -07:00
Admin
19256e4eaa Updated code for issues and included new pull requests from others. 2017-05-11 15:30:34 -05:00
BWS Systems
905f6aa9ec Merge pull request #625 from ahertz/logitech_pop
Added error message for scene invocation, to allow Logitech Pop to work.
2017-05-10 11:17:54 -05:00
BWS Systems
daa0dac5b9 Merge pull request #622 from glynhudson/patch-1
readme fixes and tweaks
2017-05-10 11:17:33 -05:00
Aaron Hertz
0478fc69f4 Added error message for scene invocation, to allow Logitech Pop to work. 2017-05-07 11:24:55 -04:00
Glyn Hudson
b99e74823c readme fixes and tweaks 2017-05-05 01:54:54 +01:00
BWS Systems
ebeb6be7a7 Update issue for google home
Fixes #572
2017-04-20 16:22:33 -05:00
BWS Systems
d3979da2b4 Fix ask Alexa table
Fixes #598
2017-04-18 11:12:20 -05:00
22 changed files with 414 additions and 257 deletions

101
README.md
View File

@@ -1,5 +1,5 @@
# ha-bridge # ha-bridge
Emulates Philips Hue api to other home automation gateways such as an Amazon Echo or Google Home. The Bridge handles basic commands such as "On", "Off" and "brightness" commands of the hue protocol. This bridge can control most devices that have a distinct API. Emulates Philips Hue API to other home automation gateways such as an Amazon Echo or other systems that support Philips Hue. The Bridge handles basic commands such as "On", "Off" and "brightness" commands of the hue protocol. This bridge can control most devices that have a distinct API.
Here are some diagrams to put this software in perspective. Here are some diagrams to put this software in perspective.
@@ -35,9 +35,11 @@ THe Harmony Hub 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.** **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 now seems to 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.**
**FAQ: Please look here for the current FAQs! https://github.com/bwssytems/ha-bridge/wiki/HA-Bridge-FAQs** **FAQ: Please look here for the current FAQs! https://github.com/bwssytems/ha-bridge/wiki/HA-Bridge-FAQs**
In the cases of systems that require authorization and/or have API's that cannot be handled in the current method, a module may need to be built. The Harmony Hub is such a module and so is the Nest module. The Bridge has helpers to build devices for the gateway for the Logitech Harmony Hub, Vera, Vera Lite or Vera Edge, Nest, Somfy Tahoma and the ability to proxy all of your real Hue bridges behind this bridge. In the cases of systems that require authorization and/or have APIs that cannot be handled in the current method, a module may need to be built. The Harmony Hub is such a module and so is the Nest module. The Bridge has helpers to build devices for the gateway for the Logitech Harmony Hub, Vera, Vera Lite or Vera Edge, Nest, Somfy Tahoma and the ability to proxy all of your real Hue bridges behind this bridge.
Alternatively the Bridge supports custom calls as well using http/https/udp and tcp such as the LimitlessLED/MiLight bulbs using the UDP protocol. Binary data is supported with UDP/TCP. Alternatively the Bridge supports custom calls as well using http/https/udp and tcp such as the LimitlessLED/MiLight bulbs using the UDP protocol. Binary data is supported with UDP/TCP.
@@ -59,24 +61,19 @@ ATTENTION: This requires JDK 1.8 to run
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-4.5.0.jar java -jar ha-bridge-4.5.1.jar
``` ```
### Automation on Linux systems ### Automation on Linux systems
To have this configured and running automatically there are a few resources to use. One is using Docker and a docker container has been built for this and can be gotten here: https://github.com/aptalca/docker-ha-bridge To have this configured and running automatically there are a few resources to use. One is using Docker and a docker container has been built for this and can be gotten here: https://github.com/aptalca/docker-ha-bridge
Create the directory and make sure that ha-bridge-4.5.0.jar is in your /home/pi/habridge directory. Create the directory and make sure that ha-bridge-4.5.1.jar is in your /home/pi/habridge directory.
``` ```
pi@raspberrypi:~ $ mkdir habridge pi@raspberrypi:~ $ mkdir habridge
pi@raspberrypi:~ $ cd habridge pi@raspberrypi:~ $ cd habridge
pi@raspberrypi:~/habridge $ wget https://github.com/bwssytems/ha-bridge/releases/download/v4.5.0/ha-bridge-4.5.0.jar pi@raspberrypi:~/habridge $ wget https://github.com/bwssytems/ha-bridge/releases/download/v4.5.1/ha-bridge-4.5.1.jar
```
Create the directory and make sure that ha-bridge-4.5.0.jar is in your /home/pi/habridge directory.
```
pi@raspberrypi:~ $ mkdir habridge
pi@raspberrypi:~ $ cd habridge
pi@raspberrypi:~/habridge $ wget https://github.com/bwssytems/ha-bridge/releases/download/v4.5.0/ha-bridge-4.5.0.jar
``` ```
#### System Control Setup on a pi (preferred) #### System Control Setup on a pi (preferred)
For next gen Linux systems (this includes the Raspberry Pi), here is a systemctl unit file that you can install. Here is a link on how to do this: https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units For next gen Linux systems (this includes the Raspberry Pi), here is a systemctl unit file that you can install. Here is a link on how to do this: https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units
@@ -95,7 +92,7 @@ After=network.target
[Service] [Service]
Type=simple Type=simple
WorkingDirectory=/home/pi/habridge WorkingDirectory=/home/pi/habridge
ExecStart=/usr/bin/java -jar -Dconfig.file=/home/pi/habridge/data/habridge.config /home/pi/habridge/ha-bridge-4.5.0.jar ExecStart=/usr/bin/java -jar -Dconfig.file=/home/pi/habridge/data/habridge.config /home/pi/habridge/ha-bridge-4.5.1.jar
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
@@ -130,7 +127,7 @@ Then cut and past this, modify any locations that are not correct
``` ```
cd /home/pi/habridge cd /home/pi/habridge
rm /home/pi/habridge/habridge-log.txt rm /home/pi/habridge/habridge-log.txt
nohup java -jar -Dconfig.file=/home/pi/habridge/data/habridge.config /home/pi/habridge/ha-bridge-4.5.0.jar > /home/pi/habridge/habridge-log.txt 2>&1 & nohup java -jar -Dconfig.file=/home/pi/habridge/data/habridge.config /home/pi/habridge/ha-bridge-4.5.1.jar > /home/pi/habridge/habridge-log.txt 2>&1 &
chmod 777 /home/pi/habridge/habridge-log.txt chmod 777 /home/pi/habridge/habridge-log.txt
``` ```
@@ -148,12 +145,14 @@ pi@raspberrypi:~/habridge $ tail -f habridge-log.txt
``` ```
## Run ha-bridge alongside web server already on port 80 ## Run ha-bridge alongside web server already on port 80
These examples will help you proxy your current webserver requests to the ha-bridge running on a different port, such as 8080. These examples will help you proxy your current webserver requests to the ha-bridge running on a different port, such as 8080.
### Apache Example ### Apache Example
Reverse proxy with Apache on Ubuntu linux: Reverse proxy with Apache on Ubuntu linux:
a2enmod proxy Enable the required Apache modules:
a2enmod proxy_http
a2enmod headers `a2enmod proxy proxy_http headers`
Added the following lines to my Apache config file “000-default” Added the following lines to my Apache config file “000-default”
@@ -175,7 +174,10 @@ Added the following lines to my Apache config file “000-default”
</VirtualHost> </VirtualHost>
``` ```
service apache2 restart Restart apache for the changes to take effect.
`service apache2 restart`
### lighthttpd Example ### lighthttpd Example
``` ```
server.modules += ( "mod_proxy" ) server.modules += ( "mod_proxy" )
@@ -219,7 +221,7 @@ This option is very important to set if you will be using username/passwords to
java -jar -Dsecurity.key=Xfawer354WertSdf321234asd ha-bridge-W.X.Y.jar java -jar -Dsecurity.key=Xfawer354WertSdf321234asd ha-bridge-W.X.Y.jar
``` ```
### -Dexec.garden=`<The path to your scripts and program directory>` ### -Dexec.garden=`<The path to your scripts and program directory>`
This sets a directory of your choosing to have a walled area for what can be executed by the Exec Command type. This is a good feature to use if you use the capabilities of executing a script or program from the ha-bridge. The default is not set which allows any program or script to be called and anyone with access to the your system could create an exec command call and execute it from the api. This is will prevent any issues if your system gets hacked. To override the default, specify -Dexec.garden=`<The path to your scripts and program directory>` explicitly on the command line. The command line example: This sets a directory of your choosing to have a walled area for what can be executed by the Exec Command type. This is a good feature to use if you use the capabilities of executing a script or program from the ha-bridge. The default is not set which allows any program or script to be called and anyone with access to the your system could create an exec command call and execute it from the API. This is will prevent any issues if your system gets hacked. To override the default, specify -Dexec.garden=`<The path to your scripts and program directory>` explicitly on the command line. The command line example:
``` ```
java -jar -Dexec.garden=C:\Users\John\bin java -jar -Dexec.garden=C:\Users\John\bin
``` ```
@@ -241,13 +243,15 @@ This field is used to test the bridge server with the UPNP IP Address and to mak
#### Bridge Control Buttons #### Bridge Control Buttons
These buttons are for managing the bridge. The Save button is enabled when there is a change to the configuration. The Bridge Reinitialize button will recycle the internal running of the bridge in the java process. The Stop button will stop the java process. The Refresh button will refresh the page and settings. These buttons are for managing the bridge. The Save button is enabled when there is a change to the configuration. The Bridge Reinitialize button will recycle the internal running of the bridge in the java process. The Stop button will stop the java process. The Refresh button will refresh the page and settings.
#### The Security Dialog #### The Security Dialog
This is where you can set the different security settings for the ha-bridge. There are two settings, one for enabling Hue like operation to secure the Hue api with the internally generated user for the calls that are done after the link button. The other is to secure the hue api with a username/password that is created as well. The other fields are to add and delete users and to set and change passwords for those users. If there are no users in the system, the system will not require a username/password to operate. This is where you can set the different security settings for the ha-bridge. There are two settings, one for enabling Hue like operation to secure the Hue API with the internally generated user for the calls that are done after the link button. The other is to secure the hue API with a username/password that is created as well. The other fields are to add and delete users and to set and change passwords for those users. If there are no users in the system, the system will not require a username/password to operate.
#### Configuration Path and File #### Configuration Path and File
The default location for the configuration file to contain the settings for the bridge is the relative path from where the bridge is started in "data/habridge.config". If you would like a different filename or directory, specify `<directory>/<filename>` explicitly. The default location for the configuration file to contain the settings for the bridge is the relative path from where the bridge is started in "data/habridge.config". If you would like a different filename or directory, specify `<directory>/<filename>` explicitly.
#### Device DB Path and File #### Device DB Path and File
The default location for the db to contain the devices as they are added is "data/devices.db". If you would like a different filename or directory, specify `<directory>/<filename> explicitly. The default location for the db to contain the devices as they are added is "data/devices.db". If you would like a different filename or directory, specify `<directory>/<filename> explicitly.
#### UPNP IP Address #### UPNP IP Address
The server defaults to the first available address on the host if this is not given. This default may NOT be the correct IP that is your public IP for your host on the network. It is best to set this parameter to not have discovery issues. Replace this value with the server ipv4 address you would like to use as the address that any upnp device will call after discovery. The server defaults to the first available address on the host if this is not given. This default may NOT be the correct IP that is your public IP for your host on the network. It is best to set this parameter to not have discovery issues. Replace this value with the server ipv4 address you would like to use as the address that any upnp device will call after discovery.
#### Use UPNP Address Interface
The server tries to bind to all interfaces to respond to UPNP request. Setting this to `true` will make the binding to the interface that has the `UPNP IP Address`. The default is to be all interfaces which is set as false.
#### Web Server IP Address #### Web Server IP Address
The server defaults to all interfaces on the machine (0.0.0.0). Replace this value with the server ipv4 address you would like to use as the address that will bind to a specific ip address on an interface if you would like. This is only necessary if you want to isolate how access is handled to the web UI. The server defaults to all interfaces on the machine (0.0.0.0). Replace this value with the server ipv4 address you would like to use as the address that will bind to a specific ip address on an interface if you would like. This is only necessary if you want to isolate how access is handled to the web UI.
#### Web Server Port #### Web Server Port
@@ -406,7 +410,7 @@ You can control items that require special calculated values using ${intensity.m
For the items that want to have a date time put into the message, utilize ${time.format(yyyy-MM-ddTHH:mm:ssXXX)} where "yyyy-MM-ddTHH:mm:ssXXX" can be any format from the Java SimpleDateFormat documented here: https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html For the items that want to have a date time put into the message, utilize ${time.format(yyyy-MM-ddTHH:mm:ssXXX)} where "yyyy-MM-ddTHH:mm:ssXXX" can be any format from the Java SimpleDateFormat documented here: https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html
Also, device data can be inserted into your payloads by the use of "${device.name}", "${device.id}", "${device.uniqueid}", "${device.targetDevice}", "${device.mapId}", "${device.mapType}" and "${device.deviceType}". These work just like the dimming value replacements. Also, device data can be inserted into your payloads by the use of "${device.name}", "${device.id}", "${device.uniqueid}", "${device.targetDevice}", "${device.mapId}", "${device.mapType}", "${device.deviceType}", "${device.requesterAddress}", "${device.description}" and "${device.comments}". These work just like the dimming value replacements.
e.g. e.g.
``` ```
[{"item":"http://192.168.1.201:3480/data_request?id=action&output_format=json&DeviceNum=10&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=${intensity.math(X/4)}","type":"httpDevice"}] [{"item":"http://192.168.1.201:3480/data_request?id=action&output_format=json&DeviceNum=10&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=${intensity.math(X/4)}","type":"httpDevice"}]
@@ -419,7 +423,7 @@ e.g.
``` ```
Also, you may want to use the REST API's listed below to configure your devices. Also, you may want to use the REST APIs listed below to configure your devices.
## Ask Alexa ## Ask Alexa
After this Tell Alexa: "Alexa, discover my devices". If there is an issue you can go to the `Menu / Settings / Connected Home` for the echo on the mobile app or your browser and have Alexa forget all devices and then do the discovery again. After this Tell Alexa: "Alexa, discover my devices". If there is an issue you can go to the `Menu / Settings / Connected Home` for the echo on the mobile app or your browser and have Alexa forget all devices and then do the discovery again.
@@ -429,16 +433,13 @@ Here is the table of items to use to tell Alexa what you want to do, this has ch
To do this... | Say this... To do this... | Say this...
--------------|------------ --------------|------------
ON Commands | ON Commands | Alexa, turn on `<Device Name>`
| Alexa, turn on `<Device Name>` OFF Commands | Alexa, turn off `<Device Name>`
OFF Commands | DIM Commands | Alexa, brighten `<Device Name>` to `<Position>`
| Alexa, turn off `<Device Name>` DIM Commands| Alexa, dim `<Device Name>` to `<Position>`
DIM Commands | DIM Commands| Alexa, brighten `<Device Name>`
| Alexa, brighten `<Device Name>` to `<Position>` DIM Commands| Alexa, dim `<Device Name>`
| Alexa, dim `<Device Name>` to `<Position>` DIM Commands| Alexa, set `<Device Name>` to `<Position>`
| Alexa, brighten `<Device Name>`
| Alexa, dim `<Device Name>`
| Alexa, set `<Device Name>` to `<Position>`
To see what Alexa thinks you said, you can check in the home page for your Alexa. To see what Alexa thinks you said, you can check in the home page for your Alexa.
@@ -447,6 +448,8 @@ To view or remove devices that Alexa knows about, you can use the mobile app `Me
## Google Assistant ## Google Assistant
Google Home is supported as of v3.2.0 and forward, but only if the bridge is running on port 80. Google Home is supported as of v3.2.0 and forward, but only if the bridge is running on port 80.
**ISSUE: Google Home now seems to 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 / +` 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). 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 Click on `Philips Hue` under the `Add new` section. If ha-bridge is on the same network as the
@@ -477,7 +480,7 @@ New or removed devices are picked up automatically as soon as they are added/rem
No re-discovery step is necessary. No re-discovery step is necessary.
## Configuration REST API Usage ## 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: 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:
``` ```
{"var1":"value1","var2":"value2","var3:"value3"} {"var1":"value1","var2":"value2","var3:"value3"}
``` ```
@@ -509,8 +512,8 @@ contentBodyOff | string | This is the content body that you would like to send w
{ {
"name" : "bedroom light", "name" : "bedroom light",
"deviceType" : "switch", "deviceType" : "switch",
"onUrl" : [{"item":"http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1&DeviceNum=41","type":"veraDevice"}], "onUrl" : "[{\"item\":\"http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1&DeviceNum=41\",\"type\":\"veraDevice\"}]",
"offUrl" : [{"item":"http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&DeviceNum=41","type":"veraDevice"}] "offUrl" : "[{\"item\":\"http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&DeviceNum=41\",\"type\":\"veraDevice\"}]"
} }
``` ```
#### Dimming Control Example #### Dimming Control Example
@@ -520,8 +523,8 @@ e.g.
{ {
"name": "entry light", "name": "entry light",
"deviceType": "switch", "deviceType": "switch",
"offUrl": [{"item":"http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&DeviceNum=31","type":"veraDevice"}], "offUrl": "[{\"item\":\"http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&DeviceNum=31\",\"type\":\"veraDevice\"}]",
"onUrl": [{"item":"http://192.168.1.201:3480/data_request?id=action&output_format=json&DeviceNum=31&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=${intensity.percent}","type":"veraDevice"}] "onUrl": "[{\"item\":\"http://192.168.1.201:3480/data_request?id=action&output_format=json&DeviceNum=31&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=${intensity.percent}\",\"type\":\"veraDevice\"}]"
} }
``` ```
See the echo's documentation for the dimming phrase. See the echo's documentation for the dimming phrase.
@@ -533,8 +536,8 @@ e.g.
{ {
"name": "Thermostat, "name": "Thermostat,
"deviceType": "custom", "deviceType": "custom",
"offUrl": [{"item":"http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&DeviceNum=10","type":"veraDevice"}], "offUrl": "[{\"item\":\"http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&DeviceNum=10\",\"type\":\"veraDevice\"}]",
"onUrl": [{"item":"http://192.168.1.201:3480/data_request?id=action&output_format=json&DeviceNum=10&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=${intensity.math(X/4)}","type":"veraDevice"}] "onUrl": "[{\"item\":\"http://192.168.1.201:3480/data_request?id=action&output_format=json&DeviceNum=10&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=${intensity.math(X/4)}\",\"type\":\"veraDevice\"}]"
} }
``` ```
See the echo's documentation for the dimming phrase. See the echo's documentation for the dimming phrase.
@@ -546,8 +549,8 @@ e.g:
{ {
"name": "test device", "name": "test device",
"deviceType": "custom", "deviceType": "custom",
"offUrl": [{"item":"http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&DeviceNum=31","httpVerb":"POST","contentType" : "application/json","httpBody" : "{\"fooBar\":\"baz_off\"}], "offUrl": "[{\"item\":\"http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&DeviceNum=31\",\"httpVerb\":\"POST\",\"contentType\" : \"application/json\",\"httpBody\" : \"{\"fooBar\":\"baz_off\"}]",
"onUrl": [{"item":"http://192.168.1.201:3480/data_request?id=action&output_format=json&DeviceNum=31&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=${intensity.percent}","type":"httpDevice","httpVerb":"POST","contentType" : "application/json","httpBody" : "{\"fooBar\":\"baz_on\"}] "onUrl": "[{\"item\":\"http://192.168.1.201:3480/data_request?id=action&output_format=json&DeviceNum=31&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=${intensity.percent}\",\"type\":\"httpDevice\",\"httpVerb\":\"POST\",\"contentType\" : \"application/json\",\"httpBody\" : \"{\"fooBar\":\"baz_on\"}]"
} }
``` ```
#### Custom Usage URLs Example #### Custom Usage URLs Example
@@ -556,8 +559,8 @@ Anything that takes an action as a result of an HTTP request will probably work
{ {
"name": "night mode", "name": "night mode",
"deviceType": ""custom", "deviceType": ""custom",
"offUrl": [{"item":"http://192.168.1.201:3480/data_request?id=lu_action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=SetHouseMode&Mode=1","type":"httpDevice"}], "offUrl": "[{\"item\":\"http://192.168.1.201:3480/data_request?id=lu_action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=SetHouseMode&Mode=1\",\"type\":\"httpDevice\"}]",
"onUrl": [{"item":"http://192.168.1.201:3480/data_request?id=lu_action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=SetHouseMode&Mode=3","type":"httpDevice"}] "onUrl": "[{\"item\":\"http://192.168.1.201:3480/data_request?id=lu_action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=SetHouseMode&Mode=3\",\"type\":\"httpDevice\"}]"
} }
``` ```
Here is a UDP example that can send binary data. Here is a UDP example that can send binary data.
@@ -565,8 +568,8 @@ Here is a UDP example that can send binary data.
{ {
"name": "UDPPacket", "name": "UDPPacket",
"deviceType": "custom", "deviceType": "custom",
"offUrl": [{"item":"udp://192.168.1.1:8899/0x460055","type":"udpDevice"}], "offUrl": "[{\"item\":\"udp://192.168.1.1:8899/0x460055\",\"type\":\"udpDevice\"}]",
"onUrl": [{"item":"udp://192.168.1.1:8899/0x450055","type":"udpDevice"}] "onUrl": "[{\"item\":\"udp://192.168.1.1:8899/0x450055\",\"type\":\"udpDevice\"}]"
} }
``` ```
#### Response #### Response
@@ -625,8 +628,8 @@ contentBodyOff | string | This is the content body that you would like to send w
"id" : "6789", "id" : "6789",
"name" : "table light", "name" : "table light",
"deviceType" : "switch", "deviceType" : "switch",
"onUrl" : [{"item":"http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1&DeviceNum=41","type":"veraDevice"}], "onUrl" : "[{\"item\":\"http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1&DeviceNum=41\",\"type\":\"veraDevice\"}]",
"offUrl" : [{"item":"http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&DeviceNum=41","type":"veraDevice"}] "offUrl" : "[{\"item\":\"http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&DeviceNum=41\",\"type\":\"veraDevice\"}]"
} }
``` ```
#### Response #### Response
@@ -879,7 +882,7 @@ The example below is representative of some HUE device responses.
Name | Type | Description Name | Type | Description
-----|-------|------------- -----|-------|-------------
device | HUE lights object | The HUE light detail descriptor, see api for lights response below. device | HUE lights object | The HUE light detail descriptor, see API for lights response below.
huedeviceid | string | The id of the actual passthru HUE light id. huedeviceid | string | The id of the actual passthru HUE light id.
hueaddress | string | The address of the target HUE bridge. hueaddress | string | The address of the target HUE bridge.
huename | string | A name given to the target HUE bridge. huename | string | A name given to the target HUE bridge.
@@ -888,7 +891,7 @@ huename | string | A name given to the target HUE bridge.
[{"device":{"state":{"on":true,"bri":254,"hue":4444,"sat":254,"effect":"none","ct":0,"alert":"none","colormode":"hs","reachable":true,"xy":[0.0,0.0]},"type":"Extended color light","name":"Hue Lamp 1","modelid":"LCT001","uniqueid":"00:17:88:01:00:d4:12:08-0a","swversion":"65003148"},"huedeviceid":"1","hueaddress":"192.168.0.118:8000","huename":"HueEmul"},{"device":{"state":{"on":true,"bri":254,"hue":23536,"sat":144,"effect":"none","ct":201,"alert":"none","colormode":"hs","reachable":true,"xy":[0.346,0.3568]},"type":"Extended color light","name":"Hue Lamp 2","modelid":"LCT001","uniqueid":"00:17:88:01:00:d4:12:08-0b","swversion":"65003148"},"huedeviceid":"2","hueaddress":"192.168.0.118:8000","huename":"HueEmul"},{"device":{"state":{"on":true,"bri":254,"hue":65136,"sat":254,"effect":"none","ct":201,"alert":"none","colormode":"hs","reachable":true,"xy":[0.346,0.3568]},"type":"Extended color light","name":"Hue Lamp 3","modelid":"LCT001","uniqueid":"00:17:88:01:00:d4:12:08-0c","swversion":"65003148"},"huedeviceid":"3","hueaddress":"192.168.0.118:8000","huename":"HueEmul"}] [{"device":{"state":{"on":true,"bri":254,"hue":4444,"sat":254,"effect":"none","ct":0,"alert":"none","colormode":"hs","reachable":true,"xy":[0.0,0.0]},"type":"Extended color light","name":"Hue Lamp 1","modelid":"LCT001","uniqueid":"00:17:88:01:00:d4:12:08-0a","swversion":"65003148"},"huedeviceid":"1","hueaddress":"192.168.0.118:8000","huename":"HueEmul"},{"device":{"state":{"on":true,"bri":254,"hue":23536,"sat":144,"effect":"none","ct":201,"alert":"none","colormode":"hs","reachable":true,"xy":[0.346,0.3568]},"type":"Extended color light","name":"Hue Lamp 2","modelid":"LCT001","uniqueid":"00:17:88:01:00:d4:12:08-0b","swversion":"65003148"},"huedeviceid":"2","hueaddress":"192.168.0.118:8000","huename":"HueEmul"},{"device":{"state":{"on":true,"bri":254,"hue":65136,"sat":254,"effect":"none","ct":201,"alert":"none","colormode":"hs","reachable":true,"xy":[0.346,0.3568]},"type":"Extended color light","name":"Hue Lamp 3","modelid":"LCT001","uniqueid":"00:17:88:01:00:d4:12:08-0c","swversion":"65003148"},"huedeviceid":"3","hueaddress":"192.168.0.118:8000","huename":"HueEmul"}]
``` ```
## HUE REST API usage ## HUE REST API usage
This section will describe the REST api available for controlling the bridge based off of the HUE API. This Bridge does not support the full HUE API, only the calls that are supported with the HA Bridge are shown. The REST body examples are all formatted for easy reading, the actual body usage should be like this: This section will describe the REST API available for controlling the bridge based off of the HUE API. This Bridge does not support the full HUE API, only the calls that are supported with the HA Bridge are shown. The REST body examples are all formatted for easy reading, the actual body usage should be like this:
``` ```
{"var1":"value1","var2":"value2","var3:"value3"} {"var1":"value1","var2":"value2","var3:"value3"}
``` ```
@@ -997,7 +1000,7 @@ A response to a successful PUT request contains confirmation of the arguments pa
] ]
``` ```
### Update bridge internal light state ### Update bridge internal light state
Allows the user to set the internal state of the light on and off, modify the brightness. This is not a HUE API call and is special to the bridge as it keeps track of the state changes to the light from the api. It is intended to allow you to sync the bridge state with your HA system state. Allows the user to set the internal state of the light on and off, modify the brightness. This is not a HUE API call and is special to the bridge as it keeps track of the state changes to the light from the API. It is intended to allow you to sync the bridge state with your HA system state.
``` ```
PUT http://host:port/api/<username>/lights/<id>/bridgeupdatestate PUT http://host:port/api/<username>/lights/<id>/bridgeupdatestate
``` ```

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>4.5.0</version> <version>4.5.5</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>HA Bridge</name> <name>HA Bridge</name>

View File

@@ -212,26 +212,26 @@ public class BridgeSecurity {
Iterator<String> userIterator = theUserIds.iterator(); Iterator<String> userIterator = theUserIds.iterator();
while (userIterator.hasNext()) { while (userIterator.hasNext()) {
validUser = userIterator.next(); validUser = userIterator.next();
if (validUser.equals(aUser)) if (validUser.equals(aUser)) {
found = true; found = true;
log.debug("validateWhitelistUser: found a user <" + aUser + ">");
}
} }
} }
} }
if(!found && !strict) { if(!found && !strict) {
log.debug("validateWhitelistUser: a user was not found and it is not strict rules <" + aUser + "> being created");
newWhitelistUser(aUser, userDescription); newWhitelistUser(aUser, userDescription);
found = true; found = true;
} }
if (!found) { if (!found) {
return HueErrorResponse.createResponse("1", "/api/" + aUser, "unauthorized user", null, null, null).getTheErrors(); log.debug("validateWhitelistUser: a user was not found and it is strict rules <" + aUser + ">");
return HueErrorResponse.createResponse("1", "/api/" + aUser == null ? "" : aUser, "unauthorized user", null, null, null).getTheErrors();
} }
Object anUser = securityDescriptor.getWhitelist().remove(DEPRACATED_INTERNAL_USER);
if(anUser != null)
setSettingsChanged(true);
return null; return null;
} }

View File

@@ -12,6 +12,9 @@ public class BridgeSettingsDescriptor {
@SerializedName("upnpconfigaddress") @SerializedName("upnpconfigaddress")
@Expose @Expose
private String upnpconfigaddress; private String upnpconfigaddress;
@SerializedName("useupnpiface")
@Expose
private boolean useupnpiface;
@SerializedName("serverport") @SerializedName("serverport")
@Expose @Expose
private Integer serverport; private Integer serverport;
@@ -104,6 +107,7 @@ public class BridgeSettingsDescriptor {
public BridgeSettingsDescriptor() { public BridgeSettingsDescriptor() {
super(); super();
this.upnpstrict = true; this.upnpstrict = true;
this.useupnpiface = false;
this.traceupnp = false; this.traceupnp = false;
this.nestconfigured = false; this.nestconfigured = false;
this.veraconfigured = false; this.veraconfigured = false;
@@ -113,8 +117,12 @@ public class BridgeSettingsDescriptor {
this.halconfigured = false; this.halconfigured = false;
this.mqttconfigured = false; this.mqttconfigured = false;
this.hassconfigured = false; this.hassconfigured = false;
this.domoticzconfigured = false;
this.somfyconfigured = false;
this.lifxconfigured = false;
this.farenheit = true; this.farenheit = true;
this.whitelist = null; this.whitelist = null;
this.securityData = null;
this.settingsChanged = false; this.settingsChanged = false;
this.myechourl = "echo.amazon.com/#cards"; this.myechourl = "echo.amazon.com/#cards";
this.webaddress = "0.0.0.0"; this.webaddress = "0.0.0.0";
@@ -126,6 +134,12 @@ public class BridgeSettingsDescriptor {
public void setUpnpConfigAddress(String upnpConfigAddress) { public void setUpnpConfigAddress(String upnpConfigAddress) {
this.upnpconfigaddress = upnpConfigAddress; this.upnpconfigaddress = upnpConfigAddress;
} }
public boolean isUseupnpiface() {
return useupnpiface;
}
public void setUseupnpiface(boolean useupnpiface) {
this.useupnpiface = useupnpiface;
}
public Integer getServerPort() { public Integer getServerPort() {
return serverport; return serverport;
} }
@@ -385,8 +399,10 @@ public class BridgeSettingsDescriptor {
List<NamedIP> devicesList = this.getHaladdress().getDevices(); List<NamedIP> devicesList = this.getHaladdress().getDevices();
if(devicesList.get(0).getIp().contains(Configuration.DEFAULT_ADDRESS)) if(devicesList.get(0).getIp().contains(Configuration.DEFAULT_ADDRESS))
return false; return false;
if(this.getHaltoken() == null || this.getHaltoken().equals("")) if(devicesList.get(0).getPassword() == null || devicesList.get(0).getPassword().trim().isEmpty()) {
return false; if(this.getHaltoken() == null || this.getHaltoken().equals(""))
return false;
}
return true; return true;
} }
public Boolean isValidMQTT() { public Boolean isValidMQTT() {

View File

@@ -49,6 +49,7 @@ public class HABridge {
staticFileLocation("/public"); staticFileLocation("/public");
while(!bridgeSettings.getBridgeControl().isStop()) { while(!bridgeSettings.getBridgeControl().isStop()) {
bridgeSettings.buildSettings(); bridgeSettings.buildSettings();
bridgeSettings.getBridgeSecurity().removeTestUsers();
log.info("HA Bridge initializing...."); log.info("HA Bridge initializing....");
// sparkjava config directive to set ip address for the web server to listen on // sparkjava config directive to set ip address for the web server to listen on
ipAddress(bridgeSettings.getBridgeSettingsDescriptor().getWebaddress()); ipAddress(bridgeSettings.getBridgeSettingsDescriptor().getWebaddress());

View File

@@ -74,7 +74,8 @@ public class DeviceDescriptor{
@SerializedName("comments") @SerializedName("comments")
@Expose @Expose
private String comments; private String comments;
@SerializedName("deviceState")
@Expose
private DeviceState deviceState; private DeviceState deviceState;
public String getName() { public String getName() {

View File

@@ -61,6 +61,7 @@ public class DeviceRepository extends BackupHandler {
{ {
DeviceDescriptor list[] = gson.fromJson(jsonContent, DeviceDescriptor[].class); DeviceDescriptor list[] = gson.fromJson(jsonContent, DeviceDescriptor[].class);
for(int i = 0; i < list.length; i++) { for(int i = 0; i < list.length; i++) {
list[i].setDeviceState(null);
put(list[i].getId(), list[i]); put(list[i].getId(), list[i]);
if(Integer.decode(list[i].getId()) > nextId) { if(Integer.decode(list[i].getId()) > nextId) {
nextId = Integer.decode(list[i].getId()); nextId = Integer.decode(list[i].getId());

View File

@@ -2,6 +2,7 @@ package com.bwssystems.HABridge.hue;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.HashMap; import java.util.HashMap;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import org.apache.commons.lang3.Conversion; import org.apache.commons.lang3.Conversion;
@@ -83,7 +84,7 @@ public class BrightnessDecode {
replaceTarget = INTENSITY_PERCENT_HEX; replaceTarget = INTENSITY_PERCENT_HEX;
notDone = true; notDone = true;
} else if (request.contains(INTENSITY_DECIMAL_PERCENT)) { } else if (request.contains(INTENSITY_DECIMAL_PERCENT)) {
replaceValue = String.format("%1.2f", decimalBrightness); replaceValue = String.format(Locale.ROOT, "%1.2f", decimalBrightness);
replaceTarget = INTENSITY_DECIMAL_PERCENT; replaceTarget = INTENSITY_DECIMAL_PERCENT;
notDone = true; notDone = true;
} else if (request.contains(INTENSITY_MATH_CLOSE)) { } else if (request.contains(INTENSITY_MATH_CLOSE)) {

View File

@@ -14,6 +14,9 @@ public class DeviceDataDecode {
private static final String DEVICE_MAPTYPE = "${device.mapType}"; private static final String DEVICE_MAPTYPE = "${device.mapType}";
private static final String DEVICE_DEVICETYPE = "${device.deviceType}"; private static final String DEVICE_DEVICETYPE = "${device.deviceType}";
private static final String DEVICE_TARGETDEVICE = "${device.targetDevice}"; private static final String DEVICE_TARGETDEVICE = "${device.targetDevice}";
private static final String DEVICE_REQUESTERADDRESS = "${device.requesterAddress}";
private static final String DEVICE_DESCRIPTION = "${device.description}";
private static final String DEVICE_COMMENTS = "${device.comments}";
public static String replaceDeviceData(String request, DeviceDescriptor device) { public static String replaceDeviceData(String request, DeviceDescriptor device) {
if (request == null) { if (request == null) {
@@ -58,6 +61,21 @@ public class DeviceDataDecode {
notDone = true; notDone = true;
} }
if (request.contains(DEVICE_REQUESTERADDRESS)) {
request = request.replace(DEVICE_REQUESTERADDRESS, device.getRequesterAddress());
notDone = true;
}
if (request.contains(DEVICE_DESCRIPTION)) {
request = request.replace(DEVICE_DESCRIPTION, device.getDescription());
notDone = true;
}
if (request.contains(DEVICE_COMMENTS)) {
request = request.replace(DEVICE_COMMENTS, device.getComments());
notDone = true;
}
log.debug("Request <<" + request + ">>, not done: " + notDone); log.debug("Request <<" + request + ">>, not done: " + notDone);
} }
return request; return request;

View File

@@ -69,6 +69,7 @@ public class HueMulator {
public void setupServer() { public void setupServer() {
log.info("Hue emulator service started...."); log.info("Hue emulator service started....");
before(HUE_CONTEXT + "/*", (request, response) -> { before(HUE_CONTEXT + "/*", (request, response) -> {
log.debug("HueMulator GET called on api/* with request <" + request.pathInfo() + ">");
if(bridgeSettingMaster.getBridgeSecurity().isSecure()) { if(bridgeSettingMaster.getBridgeSecurity().isSecure()) {
String pathInfo = request.pathInfo(); String pathInfo = request.pathInfo();
if(pathInfo != null && pathInfo.contains(HUE_CONTEXT + "/devices")) { if(pathInfo != null && pathInfo.contains(HUE_CONTEXT + "/devices")) {
@@ -118,6 +119,17 @@ public class HueMulator {
log.debug("group add requested from " + request.ip() + " user " + request.params(":userid") + " with body " + request.body()); log.debug("group add requested from " + request.ip() + " user " + request.params(":userid") + " with body " + request.body());
return "[{\"success\":{\"id\":\"1\"}}]"; return "[{\"success\":{\"id\":\"1\"}}]";
}); });
// http://ip_address:port/api/:userid/groups/<groupid>/action
// Dummy handler
// Error forces Logitech Pop to fall back to individual light control
// instead of scene-based control.
put(HUE_CONTEXT + "/:userid/groups/:groupid/action", "application/json", (request, response) -> {
response.header("Access-Control-Allow-Origin", request.headers("Origin"));
response.type("application/json");
response.status(HttpStatus.SC_OK);
log.debug("put action to groups API from " + request.ip() + " user " + request.params(":userid") + " with body " + request.body());
return "[{\"error\":{\"address\": \"/groups/0/action/scene\", \"type\":7, \"description\": \"invalid value, dummy for parameter, scene\"}}]";
});
// http://ip_address:port/api/{userId}/scenes returns json objects of // http://ip_address:port/api/{userId}/scenes returns json objects of
// all scenes configured // all scenes configured
get(HUE_CONTEXT + "/:userid/scenes", "application/json", (request, response) -> { get(HUE_CONTEXT + "/:userid/scenes", "application/json", (request, response) -> {

View File

@@ -1,10 +1,11 @@
package com.bwssystems.HABridge.plugins.hal; package com.bwssystems.HABridge.plugins.hal;
import com.bwssystems.HABridge.NamedIP;
public class HalDevice { public class HalDevice {
private String haldevicetype; private String haldevicetype;
private String haldevicename; private String haldevicename;
private String haladdress; private NamedIP haladdress;
private String halname;
private DeviceElements buttons; private DeviceElements buttons;
public String getHaldevicetype() { public String getHaldevicetype() {
return haldevicetype; return haldevicetype;
@@ -18,18 +19,12 @@ public class HalDevice {
public void setHaldevicename(String haldevicename) { public void setHaldevicename(String haldevicename) {
this.haldevicename = haldevicename; this.haldevicename = haldevicename;
} }
public String getHaladdress() { public NamedIP getHaladdress() {
return haladdress; return haladdress;
} }
public void setHaladdress(String haladdress) { public void setHaladdress(NamedIP haladdress) {
this.haladdress = haladdress; this.haladdress = haladdress;
} }
public String getHalname() {
return halname;
}
public void setHalname(String halname) {
this.halname = halname;
}
public DeviceElements getButtons() { public DeviceElements getButtons() {
return buttons; return buttons;
} }

View File

@@ -13,8 +13,14 @@ import com.bwssystems.HABridge.BridgeSettings;
import com.bwssystems.HABridge.Home; import com.bwssystems.HABridge.Home;
import com.bwssystems.HABridge.NamedIP; import com.bwssystems.HABridge.NamedIP;
import com.bwssystems.HABridge.api.CallItem; import com.bwssystems.HABridge.api.CallItem;
import com.bwssystems.HABridge.api.hue.HueError;
import com.bwssystems.HABridge.api.hue.HueErrorResponse;
import com.bwssystems.HABridge.dao.DeviceDescriptor; import com.bwssystems.HABridge.dao.DeviceDescriptor;
import com.bwssystems.HABridge.hue.BrightnessDecode;
import com.bwssystems.HABridge.hue.DeviceDataDecode;
import com.bwssystems.HABridge.hue.MultiCommandUtil; import com.bwssystems.HABridge.hue.MultiCommandUtil;
import com.bwssystems.HABridge.hue.TimeDecode;
import com.google.gson.Gson;
public class HalHome implements Home { public class HalHome implements Home {
private static final Logger log = LoggerFactory.getLogger(HalHome.class); private static final Logger log = LoggerFactory.getLogger(HalHome.class);
@@ -30,7 +36,7 @@ public class HalHome implements Home {
public Object getItems(String type) { public Object getItems(String type) {
if(!validHal) if(!validHal)
return null; return null;
log.debug("consolidating devices for hues"); log.debug("consolidating devices for HALs");
List<HalDevice> theResponse = null; List<HalDevice> theResponse = null;
Iterator<String> keys = hals.keySet().iterator(); Iterator<String> keys = hals.keySet().iterator();
List<HalDevice> deviceList = new ArrayList<HalDevice>(); List<HalDevice> deviceList = new ArrayList<HalDevice>();
@@ -106,8 +112,63 @@ public class HalHome implements Home {
@Override @Override
public String deviceHandler(CallItem anItem, MultiCommandUtil aMultiUtil, String lightId, int intensity, public String deviceHandler(CallItem anItem, MultiCommandUtil aMultiUtil, String lightId, int intensity,
Integer targetBri,Integer targetBriInc, DeviceDescriptor device, String body) { Integer targetBri,Integer targetBriInc, DeviceDescriptor device, String body) {
// Not a device handler boolean halFound = false;
return null; String responseString = null;
String theUrl = anItem.getItem().getAsString();
if(theUrl != null && !theUrl.isEmpty () && theUrl.contains("http")) {
String intermediate = theUrl.substring(theUrl.indexOf("://") + 3);
String hostPortion = intermediate.substring(0, intermediate.indexOf('/'));
// String theUrlBody = intermediate.substring(intermediate.indexOf('/') + 1);
// String hostAddr = null;
// String port = null;
// if (hostPortion.contains(":")) {
// hostAddr = hostPortion.substring(0, intermediate.indexOf(':'));
// port = hostPortion.substring(intermediate.indexOf(':') + 1);
// } else
// hostAddr = hostPortion;
log.debug("executing HUE api request to Http "
+ (anItem.getHttpVerb() == null ? "GET" : anItem.getHttpVerb()) + ": "
+ anItem.getItem().getAsString());
String anUrl = null;
anUrl = BrightnessDecode.calculateReplaceIntensityValue(intermediate, intensity, targetBri, targetBriInc, false);
anUrl = DeviceDataDecode.replaceDeviceData(anUrl, device);
anUrl = TimeDecode.replaceTimeValue(anUrl);
for (Map.Entry<String, HalInfo> entry : hals.entrySet())
{
if(entry.getValue().getHalAddress().getIp().equals(hostPortion)) {
halFound = true;
if(entry.getValue().getHalAddress().getSecure()!= null && entry.getValue().getHalAddress().getSecure())
anUrl = "https://" + anUrl;
else
anUrl = "http://" + anUrl;
if(!anUrl.contains("?Token="))
anUrl = anUrl + "?Token=" + entry.getValue().getHalAddress().getPassword();
log.debug("executing HUE api request to Http "
+ (anItem.getHttpVerb() == null ? "GET" : anItem.getHttpVerb()) + ": "
+ anUrl);
if (entry.getValue().deviceCommand(anUrl) == null) {
log.warn("Error on calling hal to change device state: " + anUrl);
responseString = new Gson().toJson(HueErrorResponse.createResponse("6", "/lights/" + lightId,
"Error on calling url to change device state", "/lights/"
+ lightId + "state", null, null).getTheErrors(), HueError[].class);
}
}
}
}
if(!halFound) {
log.warn("No HAL found to call: " + theUrl);
responseString = new Gson().toJson(HueErrorResponse.createResponse("6", "/lights/" + lightId,
"No HAL found.", "/lights/"
+ lightId + "state", null, null).getTheErrors(), HueError[].class);
}
return responseString;
} }
@Override @Override

View File

@@ -35,13 +35,13 @@ public class HalInfo {
private static final String IRDATA_TYPE = "IrData"; private static final String IRDATA_TYPE = "IrData";
private HTTPHandler httpClient; private HTTPHandler httpClient;
private NamedIP halAddress; private NamedIP halAddress;
private String theToken;
public HalInfo(NamedIP addressName, String aGivenToken) { public HalInfo(NamedIP addressName, String aGivenToken) {
super(); super();
httpClient = new HTTPHandler(); httpClient = new HTTPHandler();
halAddress = addressName; halAddress = addressName;
theToken = aGivenToken; if(halAddress.getPassword() == null || halAddress.getPassword().trim().isEmpty())
halAddress.setPassword(aGivenToken);
} }
public List<HalDevice> getLights() { public List<HalDevice> getLights() {
@@ -98,12 +98,16 @@ public class HalInfo {
String theUrl = null; String theUrl = null;
String theData; String theData;
theUrl = "http://" + halAddress.getIp() + apiType + theToken; if(halAddress.getSecure()!= null && halAddress.getSecure())
theUrl = "https://";
else
theUrl = "http://";
theUrl = theUrl + halAddress.getIp() + apiType + halAddress.getPassword();
theData = httpClient.doHttpRequest(theUrl, null, null, null, null); theData = httpClient.doHttpRequest(theUrl, null, null, null, null);
if(theData != null) { if(theData != null) {
log.debug("GET " + deviceType + " HalApiResponse - data: " + theData); log.debug("GET " + deviceType + " HalApiResponse - data: " + theData);
theHalApiResponse = new Gson().fromJson(theData, DeviceElements.class); theHalApiResponse = new Gson().fromJson(theData, DeviceElements.class);
if(theHalApiResponse.getDeviceElements() == null) { if(theHalApiResponse == null || theHalApiResponse.getDeviceElements() == null) {
StatusDescription theStatus = new Gson().fromJson(theData, StatusDescription.class); StatusDescription theStatus = new Gson().fromJson(theData, StatusDescription.class);
if(theStatus.getStatus() == null) { if(theStatus.getStatus() == null) {
log.warn("Cannot get an devices for type " + deviceType + " for hal " + halAddress.getName() + " as response is not parsable."); log.warn("Cannot get an devices for type " + deviceType + " for hal " + halAddress.getName() + " as response is not parsable.");
@@ -121,8 +125,10 @@ public class HalInfo {
HalDevice aNewHalDevice = new HalDevice(); HalDevice aNewHalDevice = new HalDevice();
aNewHalDevice.setHaldevicetype(deviceType); aNewHalDevice.setHaldevicetype(deviceType);
aNewHalDevice.setHaldevicename(theDevice.getDeviceName()); aNewHalDevice.setHaldevicename(theDevice.getDeviceName());
aNewHalDevice.setHaladdress(halAddress.getIp()); NamedIP theaddress = new NamedIP();
aNewHalDevice.setHalname(halAddress.getName()); theaddress.setIp(halAddress.getIp());
theaddress.setName(halAddress.getName());
aNewHalDevice.setHaladdress(theaddress);
deviceList.add(aNewHalDevice); deviceList.add(aNewHalDevice);
} }
@@ -145,7 +151,11 @@ public class HalInfo {
deviceList = new ArrayList<HalDevice>(); deviceList = new ArrayList<HalDevice>();
while (theHalDevices.hasNext()) { while (theHalDevices.hasNext()) {
HalDevice theHalDevice = theHalDevices.next(); HalDevice theHalDevice = theHalDevices.next();
theUrl = "http://" + halAddress.getIp() + IRBUTTON_REQUEST + TextStringFormatter.forQuerySpaceUrl(theHalDevice.getHaldevicename()) + TOKEN_REQUEST + theToken; if(halAddress.getSecure()!= null && halAddress.getSecure())
theUrl = "https://";
else
theUrl = "http://";
theUrl = theUrl + halAddress.getIp() + IRBUTTON_REQUEST + TextStringFormatter.forQuerySpaceUrl(theHalDevice.getHaldevicename()) + TOKEN_REQUEST + halAddress.getPassword();
theData = httpClient.doHttpRequest(theUrl, null, null, null, null); theData = httpClient.doHttpRequest(theUrl, null, null, null, null);
if (theData != null) { if (theData != null) {
log.debug("GET IrData for IR Device " + theHalDevice.getHaldevicename() + " HalApiResponse - data: " + theData); log.debug("GET IrData for IR Device " + theHalDevice.getHaldevicename() + " HalApiResponse - data: " + theData);
@@ -177,6 +187,12 @@ public class HalInfo {
return deviceList; return deviceList;
} }
public String deviceCommand(String theUrl) {
String theData = null;
theData = httpClient.doHttpRequest(theUrl, null, null, null, null);
return theData;
}
public NamedIP getHalAddress() { public NamedIP getHalAddress() {
return halAddress; return halAddress;
} }
@@ -190,6 +206,5 @@ public class HalInfo {
httpClient.closeHandler(); httpClient.closeHandler();
httpClient = null; httpClient = null;
halAddress = null; halAddress = null;
theToken = null;
} }
} }

View File

@@ -25,6 +25,7 @@ public class UpnpListener {
private String responseAddress; private String responseAddress;
private boolean strict; private boolean strict;
private boolean traceupnp; private boolean traceupnp;
private boolean useUpnpIface;
private BridgeControlDescriptor bridgeControl; private BridgeControlDescriptor bridgeControl;
private String bridgeId; private String bridgeId;
private String bridgeSNUUID; private String bridgeSNUUID;
@@ -74,6 +75,7 @@ public class UpnpListener {
responseAddress = theSettings.getUpnpConfigAddress(); responseAddress = theSettings.getUpnpConfigAddress();
strict = theSettings.isUpnpStrict(); strict = theSettings.isUpnpStrict();
traceupnp = theSettings.isTraceupnp(); traceupnp = theSettings.isTraceupnp();
useUpnpIface = theSettings.isUseupnpiface();
bridgeControl = theControl; bridgeControl = theControl;
aHueConfig = HuePublicConfig.createConfig("temp", responseAddress, HueConstants.HUB_VERSION); aHueConfig = HuePublicConfig.createConfig("temp", responseAddress, HueConstants.HUB_VERSION);
bridgeId = aHueConfig.getBridgeid(); bridgeId = aHueConfig.getBridgeid();
@@ -114,7 +116,10 @@ public class UpnpListener {
else else
log.debug(name + " ... has addr " + addr); log.debug(name + " ... has addr " + addr);
if (InetAddressUtils.isIPv4Address(addr.getHostAddress())) { if (InetAddressUtils.isIPv4Address(addr.getHostAddress())) {
IPsPerNic++; if(!useUpnpIface)
IPsPerNic++;
else if(addr.getHostAddress().equals(responseAddress))
IPsPerNic++;
} }
} }
log.debug("Checking " + name + " to our interface set"); log.debug("Checking " + name + " to our interface set");

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -77,7 +77,7 @@ app.config (function ($locationProvider, $routeProvider) {
}) })
}); });
app.run( async function ($rootScope, $location, Auth, bridgeService) { app.run(function ($rootScope, $location, Auth, bridgeService) {
bridgeService.getHABridgeVersion(); bridgeService.getHABridgeVersion();
$rootScope.$on('securitySetupReceived', function(event, data) { $rootScope.$on('securitySetupReceived', function(event, data) {
@@ -248,7 +248,7 @@ app.service ('bridgeService', function ($rootScope, $http, $base64, $location, n
if (error.status === 401) if (error.status === 401)
$rootScope.$broadcast('securityReinit', 'done'); $rootScope.$broadcast('securityReinit', 'done');
else else
self.displayWarn("Cannot get testuser: ", error); self.displayWarn("Cannot get testuser: ", error);
} }
); );
} }
@@ -263,7 +263,7 @@ app.service ('bridgeService', function ($rootScope, $http, $base64, $location, n
if (error.status === 401) if (error.status === 401)
$rootScope.$broadcast('securityReinit', 'done'); $rootScope.$broadcast('securityReinit', 'done');
else else
self.displayWarn("Cannot get a user: ", error); self.displayWarn("Cannot get a user: ", error);
} }
); );
}; };
@@ -1134,6 +1134,7 @@ app.service ('bridgeService', function ($rootScope, $http, $base64, $location, n
this.testUrl = function (device, type, value) { this.testUrl = function (device, type, value) {
var msgDescription = "unknown"; var msgDescription = "unknown";
self.getTestUser();
var testUrl = this.state.huebase + "/" + this.state.testuser + "/lights/" + device.id + "/state"; var testUrl = this.state.huebase + "/" + this.state.testuser + "/lights/" + device.id + "/state";
var testBody = "{\"on\":"; var testBody = "{\"on\":";
if (type === "off") { if (type === "off") {
@@ -1151,8 +1152,13 @@ app.service ('bridgeService', function ($rootScope, $http, $base64, $location, n
msgDescription = "success " + angular.toJson(response.data); msgDescription = "success " + angular.toJson(response.data);
} }
if (typeof(response.data[0].error) !== 'undefined') { if (typeof(response.data[0].error) !== 'undefined') {
msgDescription = "error " + angular.toJson(response.data[0].error); if(reponse.data[0].error.indexOf("unauthorized") > -1) {
self.displayErrorMessage("Request Error, Pleae look in your habridge log: ", msgDescription); self.displayWarn("Authorization error, please retry...", null);
}
else {
msgDescription = "error " + angular.toJson(response.data[0].error);
self.displayErrorMessage("Request Error, Please look in your habridge log: ", msgDescription);
}
return; return;
} }
@@ -1285,11 +1291,11 @@ app.controller ('SystemController', function ($scope, $location, bridgeService,
} }
} }
}; };
$scope.addHarmonytoSettings = function (newharmonyname, newharmonyip) { $scope.addHarmonytoSettings = function (newharmonyname, newharmonyip, newharmonywebhook) {
if($scope.bridge.settings.harmonyaddress === undefined || $scope.bridge.settings.harmonyaddress === null) { if($scope.bridge.settings.harmonyaddress === undefined || $scope.bridge.settings.harmonyaddress === null) {
$scope.bridge.settings.harmonyaddress = { devices: [] }; $scope.bridge.settings.harmonyaddress = { devices: [] };
} }
var newharmony = {name: newharmonyname, ip: newharmonyip } var newharmony = {name: newharmonyname, ip: newharmonyip, webhook: newharmonywebhook}
$scope.bridge.settings.harmonyaddress.devices.push(newharmony); $scope.bridge.settings.harmonyaddress.devices.push(newharmony);
$scope.newharmonyname = null; $scope.newharmonyname = null;
$scope.newharmonyip = null; $scope.newharmonyip = null;
@@ -1317,11 +1323,11 @@ app.controller ('SystemController', function ($scope, $location, bridgeService,
} }
} }
}; };
$scope.addHaltoSettings = function (newhalname, newhalip) { $scope.addHaltoSettings = function (newhalname, newhalip, newhalsecure, newhaltoken) {
if($scope.bridge.settings.haladdress === undefined || $scope.bridge.settings.haladdress === null) { if($scope.bridge.settings.haladdress === undefined || $scope.bridge.settings.haladdress === null) {
$scope.bridge.settings.haladdress = { devices: [] }; $scope.bridge.settings.haladdress = { devices: [] };
} }
var newhal = {name: newhalname, ip: newhalip } var newhal = {name: newhalname, ip: newhalip, secure: newhalsecure, password: newhaltoken }
$scope.bridge.settings.haladdress.devices.push(newhal); $scope.bridge.settings.haladdress.devices.push(newhal);
$scope.newhalname = null; $scope.newhalname = null;
$scope.newhalip = null; $scope.newhalip = null;
@@ -2202,7 +2208,6 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
var preOffCmd = ""; var preOffCmd = "";
var nameCmd = ""; var nameCmd = "";
var aDeviceType; var aDeviceType;
var postCmd = "?Token=" + $scope.bridge.settings.haltoken;
if(haldevice.haldevicetype === "Group") { if(haldevice.haldevicetype === "Group") {
aDeviceType = "group"; aDeviceType = "group";
preOnCmd = "/GroupService!GroupCmd=On"; preOnCmd = "/GroupService!GroupCmd=On";
@@ -2227,29 +2232,25 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
nameCmd = "!DeviceName="; nameCmd = "!DeviceName=";
} }
if((dim_control.indexOf("byte") >= 0 || dim_control.indexOf("percent") >= 0 || dim_control.indexOf("math") >= 0) && aDeviceType === "switch") if((dim_control.indexOf("byte") >= 0 || dim_control.indexOf("percent") >= 0 || dim_control.indexOf("math") >= 0) && aDeviceType === "switch")
dimpayload = "http://" + haldevice.haladdress dimpayload = "http://" + haldevice.haladdress.ip
+ preDimCmd + preDimCmd
+ dim_control + dim_control
+ nameCmd + nameCmd
+ haldevice.haldevicename.replaceAll(" ", "%20") + haldevice.haldevicename.replaceAll(" ", "%20");
+ postCmd;
else else
dimpayload = "http://" + haldevice.haladdress dimpayload = "http://" + haldevice.haladdress.ip
+ preOnCmd + preOnCmd
+ nameCmd + nameCmd
+ haldevice.haldevicename.replaceAll(" ", "%20") + haldevice.haldevicename.replaceAll(" ", "%20");
+ postCmd; onpayload = "http://" + haldevice.haladdress.ip
onpayload = "http://" + haldevice.haladdress
+ preOnCmd + preOnCmd
+ nameCmd + nameCmd
+ haldevice.haldevicename.replaceAll(" ", "%20") + haldevice.haldevicename.replaceAll(" ", "%20");
+ postCmd; offpayload = "http://" + haldevice.haladdress.ip
offpayload = "http://" + haldevice.haladdress
+ preOffCmd + preOffCmd
+ nameCmd + nameCmd
+ haldevice.haldevicename.replaceAll(" ", "%20") + haldevice.haldevicename.replaceAll(" ", "%20");
+ postCmd; bridgeService.buildUrls(onpayload, dimpayload, offpayload, false, haldevice.haldevicename + "-" + haldevice.haladdress.name, haldevice.haldevicename, haldevice.haladdress.name, aDeviceType, "halDevice", null, null);
bridgeService.buildUrls(onpayload, dimpayload, offpayload, false, haldevice.haldevicename + "-" + haldevice.halname, haldevice.haldevicename, haldevice.halname, aDeviceType, "halDevice", null, null);
$scope.device = bridgeService.state.device; $scope.device = bridgeService.state.device;
if (!buildonly) { if (!buildonly) {
bridgeService.editNewDevice($scope.device); bridgeService.editNewDevice($scope.device);
@@ -2260,10 +2261,10 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
$scope.buildButtonUrls = function (haldevice, onbutton, offbutton, buildonly) { $scope.buildButtonUrls = function (haldevice, onbutton, offbutton, buildonly) {
var actionOn = angular.fromJson(onbutton); var actionOn = angular.fromJson(onbutton);
var actionOff = angular.fromJson(offbutton); var actionOff = angular.fromJson(offbutton);
onpayload = "http://" + haldevice.haladdress + "/IrService!IrCmd=Set!IrDevice=" + haldevice.haldevicename.replaceAll(" ", "%20") + "!IrButton=" + actionOn.DeviceName.replaceAll(" ", "%20") + "?Token=" + $scope.bridge.settings.haltoken; onpayload = "http://" + haldevice.haladdress.ip + "/IrService!IrCmd=Set!IrDevice=" + haldevice.haldevicename.replaceAll(" ", "%20") + "!IrButton=" + actionOn.DeviceName.replaceAll(" ", "%20");
offpayload = "http://" + haldevice.haladdress + "/IrService!IrCmd=Set!IrDevice=" + haldevice.haldevicename.replaceAll(" ", "%20") + "!IrButton=" + actionOff.DeviceName.replaceAll(" ", "%20") + "?Token=" + $scope.bridge.settings.haltoken; offpayload = "http://" + haldevice.haladdress.ip + "/IrService!IrCmd=Set!IrDevice=" + haldevice.haldevicename.replaceAll(" ", "%20") + "!IrButton=" + actionOff.DeviceName.replaceAll(" ", "%20");
bridgeService.buildUrls(onpayload, null, offpayload, false, haldevice.haldevicename + "-" + haldevice.halname + "-" + actionOn.DeviceName, haldevice.haldevicename, haldevice.halname, "button", "halButton", null, null); bridgeService.buildUrls(onpayload, null, offpayload, false, haldevice.haldevicename + "-" + haldevice.haladdress.name + "-" + actionOn.DeviceName, haldevice.haldevicename, haldevice.haladdress.name, "button", "halButton", null, null);
$scope.device = bridgeService.state.device; $scope.device = bridgeService.state.device;
if (!buildonly) { if (!buildonly) {
bridgeService.editNewDevice($scope.device); bridgeService.editNewDevice($scope.device);
@@ -2272,9 +2273,9 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
}; };
$scope.buildHALHomeUrls = function (haldevice, buildonly) { $scope.buildHALHomeUrls = function (haldevice, buildonly) {
onpayload = "http://" + haldevice.haladdress + "/ModeService!ModeCmd=Set!ModeName=Home?Token=" + $scope.bridge.settings.haltoken; onpayload = "http://" + haldevice.haladdress.ip + "/ModeService!ModeCmd=Set!ModeName=Home";
offpayload = "http://" + haldevice.haladdress + "/ModeService!ModeCmd=Set!ModeName=Away?Token=" + $scope.bridge.settings.haltoken; offpayload = "http://" + haldevice.haladdress.ip + "/ModeService!ModeCmd=Set!ModeName=Away";
bridgeService.buildUrls(onpayload, null, offpayload, false, haldevice.haldevicename + "-" + haldevice.halname + "-HomeAway", haldevice.haldevicename, haldevice.halname, "home", "halHome", null, null); bridgeService.buildUrls(onpayload, null, offpayload, false, haldevice.haldevicename + "-" + haldevice.haladdress.name + "-HomeAway", haldevice.haldevicename, haldevice.haladdress.name, "home", "halHome", null, null);
$scope.device = bridgeService.state.device; $scope.device = bridgeService.state.device;
if (!buildonly) { if (!buildonly) {
bridgeService.editNewDevice($scope.device); bridgeService.editNewDevice($scope.device);
@@ -2283,22 +2284,19 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
}; };
$scope.buildHALHeatUrls = function (haldevice, buildonly) { $scope.buildHALHeatUrls = function (haldevice, buildonly) {
onpayload = "http://" + haldevice.haladdress onpayload = "http://" + haldevice.haladdress.ip
+ "/HVACService!HVACCmd=Set!HVACName=" + "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20") + haldevice.haldevicename.replaceAll(" ", "%20")
+ "!HVACMode=Heat?Token=" + "!HVACMode=Heat";
+ $scope.bridge.settings.haltoken; dimpayload = "http://" + haldevice.haladdress.ip
dimpayload = "http://" + haldevice.haladdress
+ "/HVACService!HVACCmd=Set!HVACName=" + "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20") + haldevice.haldevicename.replaceAll(" ", "%20")
+ "!HVACMode=Heat!HeatSpValue=${intensity.percent}?Token=" + "!HVACMode=Heat!HeatSpValue=${intensity.percent}";
+ $scope.bridge.settings.haltoken; offpayload = "http://" + haldevice.haladdress.ip
offpayload = "http://" + haldevice.haladdress
+ "/HVACService!HVACCmd=Set!HVACName=" + "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20") + haldevice.haldevicename.replaceAll(" ", "%20")
+ "!HVACMode=Off?Token=" + "!HVACMode=Off";
+ $scope.bridge.settings.haltoken; bridgeService.buildUrls(onpayload, dimpayload, offpayload, false, haldevice.haldevicename + "-" + haldevice.haladdress.name + "-SetHeat", haldevice.haldevicename + " Heat", haldevice.haladdress.name, "thermo", "halThermoSet", null, null);
bridgeService.buildUrls(onpayload, dimpayload, offpayload, false, haldevice.haldevicename + "-" + haldevice.halname + "-SetHeat", haldevice.haldevicename + " Heat", haldevice.halname, "thermo", "halThermoSet", null, null);
$scope.device = bridgeService.state.device; $scope.device = bridgeService.state.device;
if (!buildonly) { if (!buildonly) {
bridgeService.editNewDevice($scope.device); bridgeService.editNewDevice($scope.device);
@@ -2307,22 +2305,19 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
}; };
$scope.buildHALCoolUrls = function (haldevice, buildonly) { $scope.buildHALCoolUrls = function (haldevice, buildonly) {
onpayload = "http://" + haldevice.haladdress onpayload = "http://" + haldevice.haladdress.ip
+ "/HVACService!HVACCmd=Set!HVACName=" + "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20") + haldevice.haldevicename.replaceAll(" ", "%20")
+ "!HVACMode=Cool?Token=" + "!HVACMode=Cool";
+ $scope.bridge.settings.haltoken; dimpayload = "http://" + haldevice.haladdress.ip
dimpayload = "http://" + haldevice.haladdress
+ "/HVACService!HVACCmd=Set!HVACName=" + "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20") + haldevice.haldevicename.replaceAll(" ", "%20")
+ "!HVACMode=Cool!CoolSpValue=${intensity.percent}?Token=" + "!HVACMode=Cool!CoolSpValue=${intensity.percent}";
+ $scope.bridge.settings.haltoken; offpayload = "http://" + haldevice.haladdress.ip
offpayload = "http://" + haldevice.haladdress
+ "/HVACService!HVACCmd=Set!HVACName=" + "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20") + haldevice.haldevicename.replaceAll(" ", "%20")
+ "!HVACMode=Off?Token=" + "!HVACMode=Off";
+ $scope.bridge.settings.haltoken; bridgeService.buildUrls(onpayload, dimpayload, offpayload, false, haldevice.haldevicename + "-" + haldevice.haladdress.name + "-SetCool", haldevice.haldevicename + " Cool", haldevice.haladdress.name, "thermo", "halThermoSet", null, null);
bridgeService.buildUrls(onpayload, dimpayload, offpayload, false, haldevice.haldevicename + "-" + haldevice.halname + "-SetCool", haldevice.haldevicename + " Cool", haldevice.halname, "thermo", "halThermoSet", null, null);
$scope.device = bridgeService.state.device; $scope.device = bridgeService.state.device;
if (!buildonly) { if (!buildonly) {
bridgeService.editNewDevice($scope.device); bridgeService.editNewDevice($scope.device);
@@ -2331,16 +2326,15 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
}; };
$scope.buildHALAutoUrls = function (haldevice, buildonly) { $scope.buildHALAutoUrls = function (haldevice, buildonly) {
onpayload = "http://" + haldevice.haladdress onpayload = "http://" + haldevice.haladdress.ip
+ "/HVACService!HVACCmd=Set!HVACName=" + "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20") + haldevice.haldevicename.replaceAll(" ", "%20")
+ "!HVACMode=Auto?Token=" + "!HVACMode=Auto";
+ $scope.bridge.settings.haltoken; offpayload = "http://" + haldevice.haladdress.ip
offpayload = "http://" + haldevice.haladdress
+ "/HVACService!HVACCmd=Set!HVACName=" + "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20") + haldevice.haldevicename.replaceAll(" ", "%20")
+ "!HVACMode=Off?Token=" + "!HVACMode=Off";
bridgeService.buildUrls(onpayload, null, offpayload, false, haldevice.haldevicename + "-" + haldevice.halname + "-SetAuto", haldevice.haldevicename + " Auto", haldevice.halname, "thermo", "halThermoSet", null, null); bridgeService.buildUrls(onpayload, null, offpayload, false, haldevice.haldevicename + "-" + haldevice.haladdress.name + "-SetAuto", haldevice.haldevicename + " Auto", haldevice.haladdress.name, "thermo", "halThermoSet", null, null);
$scope.device = bridgeService.state.device; $scope.device = bridgeService.state.device;
if (!buildonly) { if (!buildonly) {
bridgeService.editNewDevice($scope.device); bridgeService.editNewDevice($scope.device);
@@ -2349,17 +2343,15 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
}; };
$scope.buildHALOffUrls = function (haldevice, buildonly) { $scope.buildHALOffUrls = function (haldevice, buildonly) {
onpayload = "http://" + haldevice.haladdress onpayload = "http://" + haldevice.haladdress.ip
+ "/HVACService!HVACCmd=Set!HVACName=" + "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20") + haldevice.haldevicename.replaceAll(" ", "%20")
+ "!HVACMode=Auto?Token=" + "!HVACMode=Auto";
+ $scope.bridge.settings.haltoken; offpayload = "http://" + haldevice.haladdress.ip
offpayload = "http://" + haldevice.haladdress
+ "/HVACService!HVACCmd=Set!HVACName=" + "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20") + haldevice.haldevicename.replaceAll(" ", "%20")
+ "!HVACMode=Off?Token=" + "!HVACMode=Off";
$scope.device.offUrl = "http://" + haldevice.haladdress bridgeService.buildUrls(onpayload, null, offpayload, false, haldevice.haldevicename + "-" + haldevice.haladdress.name + "-TurnOff", haldevice.haldevicename + " Thermostat", haldevice.haladdress.name, "thermo", "halThermoSet", null, null);
bridgeService.buildUrls(onpayload, null, offpayload, false, haldevice.haldevicename + "-" + haldevice.halname + "-TurnOff", haldevice.haldevicename + " Thermostat", haldevice.halname, "thermo", "halThermoSet", null, null);
$scope.device = bridgeService.state.device; $scope.device = bridgeService.state.device;
if (!buildonly) { if (!buildonly) {
bridgeService.editNewDevice($scope.device); bridgeService.editNewDevice($scope.device);
@@ -2368,17 +2360,15 @@ app.controller('HalController', function ($scope, $location, bridgeService, ngDi
}; };
$scope.buildHALFanUrls = function (haldevice, buildonly) { $scope.buildHALFanUrls = function (haldevice, buildonly) {
onpayload = "http://" + haldevice.haladdress onpayload = "http://" + haldevice.haladdress.ip
+ "/HVACService!HVACCmd=Set!HVACName=" + "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20") + haldevice.haldevicename.replaceAll(" ", "%20")
+ "!FanMode=On?Token=" + "!FanMode=On";
+ $scope.bridge.settings.haltoken; offpayload = "http://" + haldevice.haladdress.ip
offpayload = "http://" + haldevice.haladdress
+ "/HVACService!HVACCmd=Set!HVACName=" + "/HVACService!HVACCmd=Set!HVACName="
+ haldevice.haldevicename.replaceAll(" ", "%20") + haldevice.haldevicename.replaceAll(" ", "%20")
+ "!FanMode=Auto?Token=" + "!FanMode=Auto";
+ $scope.bridge.settings.haltoken; bridgeService.buildUrls(onpayload, null, offpayload, false, haldevice.haldevicename + "-" + haldevice.haladdress.name + "-SetFan", haldevice.haldevicename + " Fan", haldevice.haladdress.name, "thermo", "halThermoSet", null, null);
bridgeService.buildUrls(onpayload, null, offpayload, false, haldevice.haldevicename + "-" + haldevice.halname + "-SetFan", haldevice.haldevicename + " Fan", haldevice.halname, "thermo", "halThermoSet", null, null);
$scope.device = bridgeService.state.device; $scope.device = bridgeService.state.device;
if (!buildonly) { if (!buildonly) {
bridgeService.editNewDevice($scope.device); bridgeService.editNewDevice($scope.device);
@@ -3383,7 +3373,6 @@ app.controller('LoginController', function ($scope, $location, Auth) {
$scope.logout = function() { $scope.logout = function() {
Auth.logout(); Auth.logout();
$scope.loggedIn = Auth.isLoggedIn(); $scope.loggedIn = Auth.isLoggedIn();
bridgeService.displaySuccess("User Logged Out");
$location.path("/login"); $location.path("/login");
}; };
}); });

View File

@@ -43,6 +43,7 @@
<th sortable-header col="id" comparator-fn="comparatorUniqueId">ID</th> <th sortable-header col="id" comparator-fn="comparatorUniqueId">ID</th>
<th sortable-header col="name">Name</th> <th sortable-header col="name">Name</th>
<th sortable-header col="description">Description</th> <th sortable-header col="description">Description</th>
<th sortable-header col="devicestate">Device State</th>
<th sortable-header col="deviceType">Type</th> <th sortable-header col="deviceType">Type</th>
<th sortable-header col="targetDevice">Target</th> <th sortable-header col="targetDevice">Target</th>
<th sortable-header col="inactive">Inactive</th> <th sortable-header col="inactive">Inactive</th>
@@ -55,6 +56,7 @@
<td>{{device.id}}</td> <td>{{device.id}}</td>
<td>{{device.name}}</td> <td>{{device.name}}</td>
<td class="cr">{{device.description}}</td> <td class="cr">{{device.description}}</td>
<td class="cr">on={{device.deviceState.on}},bri={{device.deviceState.on}},hue={{device.deviceState.hue}},sat={{device.deviceState.sat}},effect={{device.deviceState.effect}},ct={{device.deviceState.ct}},alert={{device.deviceState.alert}},colormode={{device.deviceState.colormode}},reachable={{device.deviceState.reachable}},XYList={{device.deviceState.xy}}</td>
<td>{{device.deviceType}}</td> <td>{{device.deviceType}}</td>
<td>{{device.targetDevice}}</td> <td>{{device.targetDevice}}</td>
<td>{{device.inactive}}</td> <td>{{device.inactive}}</td>

View File

@@ -76,7 +76,7 @@
ng-click="toggleSelection(haldevice.haldevicename)"> ng-click="toggleSelection(haldevice.haldevicename)">
{{haldevice.haldevicename}}</td> {{haldevice.haldevicename}}</td>
<td>{{haldevice.haldevicetype}}</td> <td>{{haldevice.haldevicetype}}</td>
<td>{{haldevice.halname}}</td> <td>{{haldevice.haladdress.name}}</td>
<td> <td>
<select name="button-on" id="button-on" ng-model="button_on"> <select name="button-on" id="button-on" ng-model="button_on">
<option ng-repeat="aButtonOn in haldevice.buttons.DeviceElements" <option ng-repeat="aButtonOn in haldevice.buttons.DeviceElements"

View File

@@ -82,6 +82,12 @@
ng-model="bridge.settings.upnpconfigaddress" ng-model="bridge.settings.upnpconfigaddress"
placeholder="192.168.1.1"></td> placeholder="192.168.1.1"></td>
</tr> </tr>
<tr>
<td>Use UPNP Address Interface Only</td>
<td><input type="checkbox"
ng-model="bridge.settings.useupnpiface" ng-true-value=true
ng-false-value=false> {{bridge.settings.useupnpiface}}</td>
</tr>
<tr> <tr>
<td>Web Server IP Address</td> <td>Web Server IP Address</td>
<td><input id="bridge-settings-webaddress" <td><input id="bridge-settings-webaddress"
@@ -113,16 +119,20 @@
</tr> </tr>
</thead> </thead>
<tr ng-repeat="vera in bridge.settings.veraaddress.devices"> <tr ng-repeat="vera in bridge.settings.veraaddress.devices">
<td>{{vera.name}}</td> <td><input id="bridge-settings-next-vera-name"
<td>{{vera.ip}}</td> class="form-control" type="text" ng-model="vera.name"
placeholder="A Vera"></td>
<td><input id="bridge-settings-next-vera-ip"
class="form-control" type="text" ng-model="vera.ip"
placeholder="192.168.1.2"></td>
<td><button class="btn btn-danger" type="submit" <td><button class="btn btn-danger" type="submit"
ng-click="removeVeratoSettings(vera.name, vera.ip)">Del</button></td> ng-click="removeVeratoSettings(vera.name, vera.ip)">Del</button></td>
</tr> </tr>
<tr> <tr>
<td><input id="bridge-settings-next-vera-name" <td><input id="bridge-settings-new-vera-name"
class="form-control" type="text" ng-model="newveraname" class="form-control" type="text" ng-model="newveraname"
placeholder="A Vera"></td> placeholder="A Vera"></td>
<td><input id="bridge-settings-next-vera-ip" <td><input id="bridge-settings-new-vera-ip"
class="form-control" type="text" ng-model="newveraip" class="form-control" type="text" ng-model="newveraip"
placeholder="192.168.1.2"></td> placeholder="192.168.1.2"></td>
<td><button class="btn btn-success" type="submit" <td><button class="btn btn-success" type="submit"
@@ -137,30 +147,36 @@
<thead> <thead>
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>IP</th> <th>IP</th>
<th>Webhook</th> <th>Webhook</th>
<th>Manage</th> <th>Manage</th>
</tr> </tr>
</thead> </thead>
<tr ng-repeat="harmony in bridge.settings.harmonyaddress.devices"> <tr ng-repeat="harmony in bridge.settings.harmonyaddress.devices">
<td>{{harmony.name}}</td> <td><input id="bridge-settings-next-harmony-name"
<td>{{harmony.ip}}</td> class="form-control" type="text" ng-model="harmony.name"
<td>{{harmony.webhook}}</td> placeholder="A Harmony"></td>
<td><input id="bridge-settings-next-harmony-ip"
class="form-control" type="text" ng-model="harmony.ip"
placeholder="192.168.1.3"></td>
<td><input id="bridge-settings-next-harmony-webhook"
class="form-control" type="text" ng-model="harmony.webhook"
placeholder="http://hook?a=${activity.label}"></td>
<td><button class="btn btn-danger" type="submit" <td><button class="btn btn-danger" type="submit"
ng-click="removeHarmonytoSettings(harmony.name, harmony.ip, harmony.webhook)">Del</button></td> ng-click="removeHarmonytoSettings(harmony.name, harmony.ip)">Del</button></td>
</tr> </tr>
<tr> <tr>
<td><input id="bridge-settings-next-harmony-name" <td><input id="bridge-settings-new-harmony-name"
class="form-control" type="text" ng-model="newharmonyname" class="form-control" type="text" ng-model="newharmonyname"
placeholder="A Harmony"></td> placeholder="A Harmony"></td>
<td><input id="bridge-settings-next-harmony-ip" <td><input id="bridge-settings-new-harmony-ip"
class="form-control" type="text" ng-model="newharmonyip" class="form-control" type="text" ng-model="newharmonyip"
placeholder="192.168.1.3"></td> placeholder="192.168.1.3"></td>
<td><input id="bridge-settings-next-harmony-webhook" <td><input id="bridge-settings-new-harmony-webhook"
class="form-control" type="text" ng-model="newharmonywebhook" class="form-control" type="text" ng-model="newharmonywebhook"
placeholder="http://hook?a=${activity.label}"></td> placeholder="http://hook?a=${activity.label}"></td>
<td><button class="btn btn-success" type="submit" <td><button class="btn btn-success" type="submit"
ng-click="addHarmonytoSettings(newharmonyname, newharmonyip, newharmonywebhook)">Add</button></td> ng-click="addHarmonytoSettings(newharmonyname, newharmonyip, newharmonywebhook)">Add</button></td>
</tr> </tr>
</table></td> </table></td>
</tr> </tr>
@@ -176,20 +192,24 @@
</tr> </tr>
</thead> </thead>
<tr ng-repeat="hue in bridge.settings.hueaddress.devices"> <tr ng-repeat="hue in bridge.settings.hueaddress.devices">
<td>{{hue.name}}</td>
<td>{{hue.ip}}</td>
<td><button class="btn btn-danger" type="submit"
ng-click="removeHuetoSettings(hue.name, hue.ip)">Del</button></td>
</tr>
<tr>
<td><input id="bridge-settings-next-hue-name" <td><input id="bridge-settings-next-hue-name"
class="form-control" type="text" ng-model="newhuename" class="form-control" type="text" ng-model="hue.name"
placeholder="A Hue"></td> placeholder="A Hue"></td>
<td><input id="bridge-settings-next-hue-ip" <td><input id="bridge-settings-next-hue-ip"
class="form-control" type="text" ng-model="hue.ip"
placeholder="192.168.1.3"></td>
<td><button class="btn btn-danger" type="submit"
ng-click="removeHuetoSettings(hue.name, hue.ip)">Del</button></td>
</tr>
<tr>
<td><input id="bridge-settings-new-hue-name"
class="form-control" type="text" ng-model="newhuename"
placeholder="A Hue"></td>
<td><input id="bridge-settings-new-hue-ip"
class="form-control" type="text" ng-model="newhueip" class="form-control" type="text" ng-model="newhueip"
placeholder="192.168.1.3"></td> placeholder="192.168.1.3"></td>
<td><button class="btn btn-success" type="submit" <td><button class="btn btn-success" type="submit"
ng-click="addHuetoSettings(newhuename, newhueip)">Add</button></td> ng-click="addHuetoSettings(newhuename, newhueip)">Add</button></td>
</tr> </tr>
</table></td> </table></td>
</tr> </tr>
@@ -201,29 +221,47 @@
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>IP</th> <th>IP</th>
<th>Token</th>
<th>Use SSL</th>
<th>Manage</th> <th>Manage</th>
</tr> </tr>
</thead> </thead>
<tr ng-repeat="hal in bridge.settings.haladdress.devices"> <tr ng-repeat="hal in bridge.settings.haladdress.devices">
<td>{{hal.name}}</td> <td><input id="bridge-settings-next-hal-name"
<td>{{hal.ip}}</td> class="form-control" type="text" ng-model="hal.name"
placeholder="A Hal"></td>
<td><input id="bridge-settings-next-hal-ip"
class="form-control" type="text" ng-model="hal.ip"
placeholder="192.168.1.3:82"></td>
<td><input id="bridge-settings-next-haltoken" class="form-control"
type="password" ng-model="hal.password"
placeholder="thetoken"></td>
<td><input type="checkbox"
ng-model="hal.secure" ng-true-value=true
ng-false-value=false></td>
<td><button class="btn btn-danger" type="submit" <td><button class="btn btn-danger" type="submit"
ng-click="removeHaltoSettings(hal.name, hal.ip)">Del</button></td> ng-click="removeHaltoSettings(hal.name, hal.ip)">Del</button></td>
</tr> </tr>
<tr> <tr>
<td><input id="bridge-settings-next-hal-name" <td><input id="bridge-settings-new-hal-name"
class="form-control" type="text" ng-model="newhalname" class="form-control" type="text" ng-model="newhalname"
placeholder="A Hal"></td> placeholder="A Hal"></td>
<td><input id="bridge-settings-next-hal-ip" <td><input id="bridge-settings-new-hal-ip"
class="form-control" type="text" ng-model="newhalip" class="form-control" type="text" ng-model="newhalip"
placeholder="192.168.1.3:82"></td> placeholder="192.168.1.3:82"></td>
<td><input id="bridge-settings-new-haltoken" class="form-control"
type="password" ng-model="newhaltoken"
placeholder="thetoken"></td>
<td><input type="checkbox"
ng-model="newhalsecure" ng-true-value=true
ng-false-value=false></td>
<td><button class="btn btn-success" type="submit" <td><button class="btn btn-success" type="submit"
ng-click="addHaltoSettings(newhalname, newhalip)">Add</button></td> ng-click="addHaltoSettings(newhalname, newhalip, newhalsecure, newhaltoken)">Add</button></td>
</tr> </tr>
</table></td> </table></td>
</tr> </tr>
<tr> <tr>
<td>HAL Token</td> <td>HAL Token (please use token on individual HAL entry)</td>
<td><input id="bridge-settings-haltoken" class="form-control" <td><input id="bridge-settings-haltoken" class="form-control"
type="password" ng-model="bridge.settings.haltoken" type="password" ng-model="bridge.settings.haltoken"
placeholder="thetoken"></td> placeholder="thetoken"></td>
@@ -242,26 +280,32 @@
</tr> </tr>
</thead> </thead>
<tr ng-repeat="mqtt in bridge.settings.mqttaddress.devices"> <tr ng-repeat="mqtt in bridge.settings.mqttaddress.devices">
<td>{{mqtt.name}}</td> <td><input id="bridge-settings-next-mqtt-name"
<td>{{mqtt.ip}}</td> class="form-control" type="text" ng-model="mqtt.name"
<td>{{mqtt.username}}</td> placeholder="A MQTT Client ID"></td>
<td ng-if="mqtt.password">*******</td> <td><input id="bridge-settings-next-mqtt-ip"
<td ng-if="!mqtt.password"> </td> class="form-control" type="text" ng-model="mqtt.ip"
placeholder="MQTT Broker IP and port"></td>
<td><input id="bridge-settings-next-mqtt-username"
class="form-control" type="text" ng-model="mqtt.username"
placeholder="MQTT Broker username (optional)"></td>
<td><input id="bridge-settings-next-mqtt-password"
class="form-control" type="password" ng-model="mqtt.password"
placeholder="MQTT Broker password (opt)"></td>
<td><button class="btn btn-danger" type="submit" <td><button class="btn btn-danger" type="submit"
ng-click="removeMQTTtoSettings(mqtt.name, mqtt.ip)">Del</button></td> ng-click="removeMQTTtoSettings(mqtt.name, mqtt.ip)">Del</button></td>
</tr> </tr>
<tr> <tr>
<td><input id="bridge-settings-next-mqtt-name" <td><input id="bridge-settings-new-mqtt-name"
class="form-control" type="text" ng-model="newmqttname" class="form-control" type="text" ng-model="newmqttname"
placeholder="A MQTT Client ID"></td> placeholder="A MQTT Client ID"></td>
<td><input id="bridge-settings-next-mqtt-ip" <td><input id="bridge-settings-new-mqtt-ip"
class="form-control" type="text" ng-model="newmqttip" class="form-control" type="text" ng-model="newmqttip"
placeholder="MQTT Broker IP and port"></td> placeholder="MQTT Broker IP and port"></td>
<td><input id="bridge-settings-next-mqtt-username" <td><input id="bridge-settings-new-mqtt-username"
class="form-control" type="text" ng-model="newmqttusername" class="form-control" type="text" ng-model="newmqttusername"
placeholder="MQTT Broker username (optional)"></td> placeholder="MQTT Broker username (optional)"></td>
<td><input id="bridge-settings-next-mqtt-password" <td><input id="bridge-settings-new-mqtt-password"
class="form-control" type="password" ng-model="newmqttpassword" class="form-control" type="password" ng-model="newmqttpassword"
placeholder="MQTT Broker password (opt)"></td> placeholder="MQTT Broker password (opt)"></td>
<td><button class="btn btn-success" type="submit" <td><button class="btn btn-success" type="submit"
@@ -284,26 +328,35 @@
</tr> </tr>
</thead> </thead>
<tr ng-repeat="hass in bridge.settings.hassaddress.devices"> <tr ng-repeat="hass in bridge.settings.hassaddress.devices">
<td>{{hass.name}}</td> <td><input id="bridge-settings-next-hass-name"
<td>{{hass.ip}}</td> class="form-control" type="text" ng-model="hass.name"
<td>{{hass.port}}</td> placeholder="A HomeAssistant"></td>
<td ng-if="hass.password">*******</td> <td><input id="bridge-settings-next-hass-ip"
<td ng-if="!hass.password"> </td> class="form-control" type="text" ng-model="hass.ip"
<td>{{hass.secure}}</td> placeholder="192.168.1.3"></td>
<td><input id="bridge-settings-next-hass-port"
class="form-control" type="text" ng-model="hass.port"
placeholder="8123"></td>
<td><input id="bridge-settings-next-hass-password"
class="form-control" type="password" ng-model="hass.password"
placeholder="Home Assistant password (opt)"></td>
<td><input type="checkbox"
ng-model="hass.secure" ng-true-value=true
ng-false-value=false></td>
<td><button class="btn btn-danger" type="submit" <td><button class="btn btn-danger" type="submit"
ng-click="removeHasstoSettings(hass.name, hass.ip)">Del</button></td> ng-click="removeHasstoSettings(hass.name, hass.ip)">Del</button></td>
</tr> </tr>
<tr> <tr>
<td><input id="bridge-settings-next-hass-name" <td><input id="bridge-settings-new-hass-name"
class="form-control" type="text" ng-model="newhassname" class="form-control" type="text" ng-model="newhassname"
placeholder="A HomeAssistant"></td> placeholder="A HomeAssistant"></td>
<td><input id="bridge-settings-next-hass-ip" <td><input id="bridge-settings-new-hass-ip"
class="form-control" type="text" ng-model="newhassip" class="form-control" type="text" ng-model="newhassip"
placeholder="192.168.1.3"></td> placeholder="192.168.1.3"></td>
<td><input id="bridge-settings-next-hass-port" <td><input id="bridge-settings-new-hass-port"
class="form-control" type="text" ng-model="newhassport" class="form-control" type="text" ng-model="newhassport"
placeholder="8123"></td> placeholder="8123"></td>
<td><input id="bridge-settings-next-hass-password" <td><input id="bridge-settings-new-hass-password"
class="form-control" type="password" ng-model="newhasspassword" class="form-control" type="password" ng-model="newhasspassword"
placeholder="Home Assistant password (opt)"></td> placeholder="Home Assistant password (opt)"></td>
<td><input type="checkbox" <td><input type="checkbox"
@@ -329,29 +382,38 @@
</tr> </tr>
</thead> </thead>
<tr ng-repeat="domoticz in bridge.settings.domoticzaddress.devices"> <tr ng-repeat="domoticz in bridge.settings.domoticzaddress.devices">
<td>{{domoticz.name}}</td> <td><input id="bridge-settings-next-domoticz-name"
<td>{{domoticz.ip}}</td> class="form-control" type="text" ng-model="domoticz.name"
<td>{{domoticz.port}}</td> placeholder="A Domoticz"></td>
<td>{{domoticz.username}}</td> <td><input id="bridge-settings-next-domoticz-ip"
<td ng-if="domoticz.password">*******</td> class="form-control" type="text" ng-model="domoticz.ip"
<td ng-if="!domoticz.password"> </td> placeholder="192.168.1.3"></td>
<td><input id="bridge-settings-next-domoticz-port"
class="form-control" type="text" ng-model="domoticz.port"
placeholder="8080"></td>
<td><input id="bridge-settings-next-domoticz-username"
class="form-control" type="text" ng-model="domoticz.username"
placeholder="Domoticz username"></td>
<td><input id="bridge-settings-next-domoticz-password"
class="form-control" type="password" ng-model="domoticz.password"
placeholder="Domoticz password (opt)"></td>
<td><button class="btn btn-danger" type="submit" <td><button class="btn btn-danger" type="submit"
ng-click="removeDomoticztoSettings(domoticz.name, domoticz.ip)">Del</button></td> ng-click="removeDomoticztoSettings(domoticz.name, domoticz.ip)">Del</button></td>
</tr> </tr>
<tr> <tr>
<td><input id="bridge-settings-next-domoticz-name" <td><input id="bridge-settings-new-domoticz-name"
class="form-control" type="text" ng-model="newdomoticzname" class="form-control" type="text" ng-model="newdomoticzname"
placeholder="A Domoticz"></td> placeholder="A Domoticz"></td>
<td><input id="bridge-settings-next-domoticz-ip" <td><input id="bridge-settings-new-domoticz-ip"
class="form-control" type="text" ng-model="newdomoticzip" class="form-control" type="text" ng-model="newdomoticzip"
placeholder="192.168.1.3"></td> placeholder="192.168.1.3"></td>
<td><input id="bridge-settings-next-domoticz-port" <td><input id="bridge-settings-new-domoticz-port"
class="form-control" type="text" ng-model="newdomoticzport" class="form-control" type="text" ng-model="newdomoticzport"
placeholder="8080"></td> placeholder="8080"></td>
<td><input id="bridge-settings-next-domoticz-username" <td><input id="bridge-settings-new-domoticz-username"
class="form-control" type="text" ng-model="newdomoticzusername" class="form-control" type="text" ng-model="newdomoticzusername"
placeholder="Domoticz username"></td> placeholder="Domoticz username"></td>
<td><input id="bridge-settings-next-domoticz-password" <td><input id="bridge-settings-new-domoticz-password"
class="form-control" type="password" ng-model="newdomoticzpassword" class="form-control" type="password" ng-model="newdomoticzpassword"
placeholder="Domoticz password (opt)"></td> placeholder="Domoticz password (opt)"></td>
<td><button class="btn btn-success" type="submit" <td><button class="btn btn-success" type="submit"
@@ -373,25 +435,32 @@
</tr> </tr>
</thead> </thead>
<tr ng-repeat="somfy in bridge.settings.somfyaddress.devices"> <tr ng-repeat="somfy in bridge.settings.somfyaddress.devices">
<td>{{somfy.name}}</td> <td><input id="bridge-settings-next-somfy-name"
<td>{{somfy.ip}}</td> class="form-control" type="text" ng-model="somfy.name"
<td>{{somfy.username}}</td> placeholder="A Somfy"></td>
<td ng-if="somfy.password">*******</td> <td><input id="bridge-settings-next-somfy-ip"
<td ng-if="!somfy.password"> </td> class="form-control" type="text" ng-model="somfy.ip"
placeholder="https://www.tahomalink.com"></td>
<td><input id="bridge-settings-next-somfy-username"
class="form-control" type="text" ng-model="somfy.username"
placeholder="Somfy username"></td>
<td><input id="bridge-settings-next-somfy-password"
class="form-control" type="password" ng-model="somfy.password"
placeholder="Somfy password"></td>
<td><button class="btn btn-danger" type="submit" <td><button class="btn btn-danger" type="submit"
ng-click="removeSomfytoSettings(somfy.name, somfy.ip)">Del</button></td> ng-click="removeSomfytoSettings(somfy.name, somfy.ip)">Del</button></td>
</tr> </tr>
<tr> <tr>
<td><input id="bridge-settings-next-somfy-name" <td><input id="bridge-settings-new-somfy-name"
class="form-control" type="text" ng-model="newsomfyname" class="form-control" type="text" ng-model="newsomfyname"
placeholder="A Somfy"></td> placeholder="A Somfy"></td>
<td><input id="bridge-settings-next-somfy-ip" <td><input id="bridge-settings-new-somfy-ip"
class="form-control" type="text" ng-model="newsomfyip" class="form-control" type="text" ng-model="newsomfyip"
placeholder="https://www.tahomalink.com"></td> placeholder="https://www.tahomalink.com"></td>
<td><input id="bridge-settings-next-somfy-username" <td><input id="bridge-settings-new-somfy-username"
class="form-control" type="text" ng-model="newsomfyusername" class="form-control" type="text" ng-model="newsomfyusername"
placeholder="Somfy username"></td> placeholder="Somfy username"></td>
<td><input id="bridge-settings-next-somfy-password" <td><input id="bridge-settings-new-somfy-password"
class="form-control" type="password" ng-model="newsomfypassword" class="form-control" type="password" ng-model="newsomfypassword"
placeholder="Somfy password"></td> placeholder="Somfy password"></td>
<td><button class="btn btn-success" type="submit" <td><button class="btn btn-success" type="submit"