Compare commits

...

15 Commits

Author SHA1 Message Date
BWS Systems
ff2973e473 Update Readme for https 2019-07-12 09:11:53 -05:00
BWS Systems
743656cab3 Updated mDNS host and naming 2019-07-11 13:41:34 -05:00
BWS Systems
53be3ba213 Added https to web and api that will use java keytool 2019-07-10 16:07:22 -05:00
BWS Systems
a5ee0aafc8 Update upnp original to be like v3.5.1 2019-07-02 10:57:46 -05:00
BWS Systems
aed8ffa8d3 Remove extra SEARCH response, use upnp original for udp send change 2019-07-01 15:47:23 -05:00
BWS Systems
369e5a25e6 Fixed bulk add and sort on moziot page 2019-06-28 15:05:57 -05:00
BWS Systems
3fe19f5d4e Updated a few issues
Updated the hue uniqueid generation. Updated the moziot login handling. updated upnp response message to have hue-bridgeId in capital letters - HUE-BRIDGEID
2019-06-28 15:02:28 -05:00
BWS Systems
5736bb92db Issue with tabs in moziot page 2019-06-28 10:11:32 -05:00
BWS Systems
b61f334826 updated tab issues and buildUrls call in app.js 2019-06-28 10:05:19 -05:00
BWS Systems
556a5fef1c Mozilla IOT changed Thing JSON object already for name to title 2019-06-27 16:00:05 -05:00
BWS Systems
4b0152060f Fix HomeGenie response review for errors. Updated Readme, removed the row index from the devices tab 2019-06-27 10:55:40 -05:00
BWS Systems
fcb31b8f76 Update for HomeGenie type handling 2019-06-26 14:05:36 -05:00
BWS Systems
0205633684 Update version to next release as the tag is on the wrong branch 2019-06-25 09:49:55 -05:00
BWS Systems
7b48590807 updated upnp notify to add root and basic schemas 2019-06-25 09:27:10 -05:00
BWS Systems
5f7cd70710 Added back to top button on long scroll 2019-06-17 13:04:07 -05:00
27 changed files with 791 additions and 239 deletions

121
README.md
View File

@@ -1,5 +1,5 @@
# ha-bridge
Emulates Philips Hue API to other home automation gateways such as an Amazon Echo/Dot Gen 1 (gen 2 has issues discovering ha-bridge) 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.
Emulates Philips Hue API to other home automation gateways such as an Amazon Echo/Dot or other systems that support Philips Hue local network discovery. The ha-bridge is not part of meethue.philips.com so the cloud sign in does not apply to this system. The Bridge handles basic commands such as "On", "Off", "Brightness" and "Color" 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.
@@ -35,15 +35,13 @@ A Custom implementation path looks like this:
**NOTE: This software does not control Philips Hue devices directly. A physical Philips Hue Hub is required for that, by which the ha-bridge can then proxy all of your real Hue bridges behind this bridge.**
**ISSUE: Amazon Echo (2nd Generation) has issues finding the ha-bridge. The only workaround is to have a first generation Echo or Dot on your network that finds the ha-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.**
**ISSUE: Google Home does NOT support local connection to Philips Hue Hubs and requires that it connect to meethue.com. Since the ha-bridge only emulates the local API, and is not associated with Philips, this method will not work. If you have an older Google Home application, this may still work. YMMV.**
**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 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, Home Assistant, Domoticz, MQTT, HAL, Fibaro, HomeWizard, LIFX, OpenHAB, FHEM, Broadlink 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, Home Assistant, Domoticz, MQTT, HAL, Fibaro, HomeWizard, LIFX, OpenHAB, FHEM, Broadlink, Mozilla IOT, HomeGenie 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 and executing programs/scripts 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.
This bridge was built to help put the Internet of Things together.
## Build
@@ -264,15 +262,27 @@ java -jar -Dexec.garden=C:\Users\John\bin
```
## HA Bridge Usage and Configuration
This section will cover the basics of configuration and where this configuration can be done. This requires that you have started your bridge process and then have pointed your
favorite web interface by going to the http://<my ip address>:<port> or http://localhost:<port> with port you have assigned. The default quick link is http://localhost for your reference.
favorite web interface by going to the `http://<my ip address>:<port>` or `http://localhost:<port>` with port you have assigned. The default quick link is http://localhost for your reference.
### The Bridge Devices Tab
This screen allows you to see your devices you have configured for the ha-bridge to present to a controller, such as an Amazon Echo/Dot. It gives you a count of devices as there have been reports that the Echo only supports a limited number, but has been growing as of late, YMMV. You can test each device from this page as this calls the ha-bridge just as a controller would, i.e. the Echo. This is useful to make sure your configuration for each device is correct and for trouble shooting. You can also manages your devices as well by editing and making a new device copy as well as deleting it.
This screen allows you to see your devices you have configured for the ha-bridge to present to a controller, such as an Amazon Echo/Dot. You can test each device from this page as this calls the ha-bridge just as a controller would, i.e. the Echo. This is useful to make sure your configuration for each device is correct and for trouble shooting. You can also manage your devices as well by editing and making a new device copy as well as deleting it.
At the bottom of the screen is the "Bridge Device DB Backup" which can be accessed with clicking on the `+` to expand this frame. Here you can backup and restore configurations that you have saved. These configs can be named or by clicking the `Backup Device DB' button will create a backup and name it for you. You can manage these backups by restoring them or deleting them.
Each of the columns are sortable by the use of the little arrow in the upper left corner of the heading.
If you click on the ID number on a Device, this will toggle the ID number to lock/unlock that is used during renumbering. When the ID is '<b>Bolded</b>', it is locked. You can also hover your mouse to see the state. This allows you to renumber a part of your devices and keep the ID for others. All IDs will be unique.
There is a new feature for the Devices that can be selected on the 'Startup' column. If you choose to have certain devices executed when the bridge is started or restarted. You can can click this field to bring up the dialog which will allow you to enter what you want the device to do on startup. The default is to do nothing.
At the bottom of the screen is the "Bridge Device DB Backup" which can be accessed with clicking on the `+` to expand this frame. Here you can backup and restore configurations that you have saved. These configs can be named or by clicking the `Backup Device DB' button will create a backup and name it for you. You can manage these backups by restoring them, deleting them, downloading them by clicking on the file name and uploading a saved device DB backup on your local machine.
#### Renumber Devices
This changes the numbering of the added devices to start at 1 and goes up from there. It was originally intended for a conversion from the previous system version that used large numbers and was not necessary. This also allows the system to try and number sequentially. If you use this button, you will need to re-discover your devices as their ID's will have changed.
This changes the numbering of the added devices to start at the nmuber given in the 'Bridge Control' tab field 'ID Seed' and the default is 100 and goes up from there. It was originally intended for a conversion from the previous system version that used large numbers and was not necessary. This also allows the system to try and number sequentially. If you use this button, you will need to re-discover your devices as their ID's will have changed.
#### Link
If this is present, you have enabled the Hue link button feature for the ha-bridge. If you want a new system to recognize the ha-bridge, you will need to press this button when you are doing a discovery.
#### Manage Links
If this is present, you have enabled the Hue link button feature for the ha-bridge. This button will bring up a dialog which contains all of the registered users created by linking the ha-bridge with a device. This allows you to revoke control for a created user so that it cannot access the ha-bridge by deleting that link user.
#### Show devices visible to
This filter is to sort devices that have an IP filter set. Type in the IP that is used in your device filter field.
#### Filter device type
This filter is for a quick method to find specific devices by their type listed in the dropdown.
### The Bridge Control Tab
This is where all of the configuration occurs for what ports and IP's the bridge runs on. It also contains the configurations for target devices so that Helper Tabs for configuration can be added as well as the connection information to control those devices.
#### Bridge server
@@ -280,11 +290,35 @@ This field is used to test the bridge server with the UPNP IP Address and to mak
#### 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.
#### 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. The settings are the https enablement with the Keyfile path and password and described below, enabling Hue like operation to secure the Hue API with the internally generated user for the calls that are done after the link button. Another is to secure the hue API with a username/password that is created as well. The last one is the path to the exec garden if used for only allowing scripts and programs to be executed from this location only. 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.
The use https selection will require you to generate a java keytool keystore file for the ha-bridge to use. This will require the path to the keyfile and the password that was used to secure the keyfile. There are mulitple ways to add the key file. The basic way is to generate a self signed keystore using keytool as follows:
Step 1. Open the command console
Step 2. Run this command (Where indicate the number of days for which the certificate will be valid)
keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass ```<password>``` -validity 365 -keysize 2048
Step 3. Enter a password for the keystore. Note this ```<password>``` as you require this for configuring the server
Step 4. When prompted for first name and last name, enter the domain name of the server. For example, myserver or myserver.mycompany.com.
Step 5. Enter the other details, such as Organizational Unit, Organization, City, State, and Country.
Step 6. When prompted with Enter key ```<password>``` for , press Enter to use the same ```<password>``` as the keystore ```<password>```
Step 7. Run this command to verify the contents of the keystore
keytool -list -v -keystore selfsigned.jks
Step 8. When prompted, enter the keystore password note in Step 3. The basic information about the generated certificate is displayed. Verify that the Owner and Issuer are the same. Also, you should see the information you provided in Step 4 and 5.
The second way is to acquire a certified certificate to use in the keyfile. Such way to get one is use letsencrypt. Once you have the certifcate files you can follow this to create the keystore: https://community.letsencrypt.org/t/tutorial-java-keystores-jks-with-lets-encrypt/34754.
The easiest place to keep the keystore files is in your ha bridge data directory.
#### 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.
#### 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
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
@@ -298,9 +332,9 @@ The server defaults to running on port 80. To override what the default is, spec
#### UPNP Response Port
The upnp response port that will be used. The default is 50000.
#### Vera Names and IP Addresses
Provide IP Addresses of your Veras that you want to utilize with the bridge. Also, give a meaningful name to each one so it is easy to decipher in the helper tab. When these names and IP's are given, the bridge will be able to control the devices or scenes by the call it receives and send it to the target Vera and device/scene you configure.
Provide IP Addresses of your Veras that you want to utilize with the bridge. Also, give a meaningful name to each one so it is easy to decipher in the helper tab. When these names and IP's are given, the bridge will be able to control the devices or scenes by the call it receives and send it to the target Vera device/scene you configure.
#### Fibaro Names and IP Addresses
Provide IP Addresses of your Fibaros that you want to utilize with the bridge. Also, give a meaningful name to each one so it is easy to decipher in the helper tab. When these names and IP's are given, the bridge will be able to control the devices or scenes by the call it receives and send it to the target Fibaro and device/scene you configure. There are filter switches available to limit some of the returns for devices and scenes such as use save logs, use user description, use only Lili command and a switch that cleans up format Trash Chars. The default filters are false for everything but Trash Chars.
Provide IP Addresses of your Fibaros that you want to utilize with the bridge. Also, give a meaningful name to each one so it is easy to decipher in the helper tab. When these names and IP's are given, the bridge will be able to control the devices or scenes by the call it receives and send it to the target Fibaro device/scene you configure. There are filter switches available to limit some of the returns for devices and scenes such as use save logs, use user description, use only Lili command and a switch that cleans up format Trash Chars. The default filters are false for everything but Trash Chars.
#### Harmony Names and IP Addresses
Provide IP Addresses of your Harmony Hubs that you want to utilize with the bridge. Also, give a meaningful name to each one so it is easy to decipher in the helper tab. When these names and IP's are given, the bridge will be able to control the activity or buttons by the call it receives and send it to the target Harmony Hub and activity/button you configure. Also, an option of webhook can be called when the activity changes on the harmony hub that will send an HTTP GET call to the the address of your choosing. This can contain the replacement variables of ${activity.id} and/or ${activity.label}. Example : http://192.168.0.1/activity/${activity.id}/${activity.label} OR http://hook?a=${activity.label}
#### Hue Names and IP Addresses
@@ -308,27 +342,27 @@ Provide IP Addresses of your Hue Bridges that you want to proxy through the brid
Don't forget - You will need to push the link button when you got to the Hue Tab the first time after the process comes up. (The user name is not persistent when the process comes up.)
#### HAL Names and IP Addresses
Provide IP Addresses of your HAL Systems that you want to utilize with the bridge. Also, give a meaningful name to each one so it is easy to decipher in the helper tab. When these names and IP's are given, the bridge will be able to control the devices or scenes by the call it receives and send it to the target HAL and device/scene you configure.
Provide IP Addresses of your HAL Systems that you want to utilize with the bridge. Also, give a meaningful name to each one so it is easy to decipher in the helper tab. When these names and IP's are given, the bridge will be able to control the devices or scenes by the call it receives and send it to the target HAL device you configure.
#### MQTT Client IDs and IP Addresses
Provide Client ID and IP Addresses and ports of your MQTT Brokers that you want to utilize with the bridge. Also, you can provide the username and password if you have secured your MQTT broker which is optional. When these Client ID and IP's are given, the bridge will be able to publish MQTT messages by the call it receives and send it to the target MQTT Broker you configure. The MQTT Messages Tab will become available to help you build messages.
#### Home Assistant Names and IP Addresses
<Provide IP Addresses and ports of your Home Assistant that you want to utilize with the bridge. Also, give a meaningful name to each one so it is easy to decipher in the helper tab. When these names and IP's are given, the bridge will be able to control the devices or scenes by the call it receives and send it to the target Home Assistant and device/scene you configure.
<Provide IP Addresses and ports of your Home Assistant that you want to utilize with the bridge. Also, give a meaningful name to each one so it is easy to decipher in the helper tab. When these names and IP's are given, the bridge will be able to control the devices or scenes by the call it receives and send it to the target Home Assistant device you configure.
#### HomeWizard Gateways Names and IP Addresses
Provide IP Addresses of your HomeWizard Systems that you want to utilize with the bridge. Also, give a meaningful name to each one so it is easy to decipher in the helper tab. When these names and IP's are given, the bridge will be able to control the devices or scenes by the call it receives and send it to the target HomeWizard and device/scene you configure.
Provide IP Addresses of your HomeWizard Systems that you want to utilize with the bridge. Also, give a meaningful name to each one so it is easy to decipher in the helper tab. When these names and IP's are given, the bridge will be able to control the devices or scenes by the call it receives and send it to the target HomeWizard device you configure.
#### Domoticz Names and IP Addresses
Provide IP Addresses of your Domoticz Systems that you want to utilize with the bridge. Also, give a meaningful name to each one so it is easy to decipher in the helper tab. When these names and IP's are given, the bridge will be able to control the devices or scenes by the call it receives and send it to the target Domoticz and device/scene you configure.
Provide IP Addresses of your Domoticz Systems that you want to utilize with the bridge. Also, give a meaningful name to each one so it is easy to decipher in the helper tab. When these names and IP's are given, the bridge will be able to control the devices or scenes by the call it receives and send it to the target Domoticz device you configure.
#### Somfy Tahoma Names and IP Addresses
Provide user name and password used to login to www.tahomalink.com. This needs to be provided if you're using the Somfy Tahoma features (for connecting to IO Homecontrol used by Velux among others). There is no need to give any IP address or host information as this contacts your cloud account. *Note:* you have to 'turn on' a window to open it, and 'turn off' to close.
#### OpenHAB Names and IP Addresses
Provide IP Addresses of your OpenHAB Systems that you want to utilize with the bridge. Also, give a meaningful name to each one so it is easy to decipher in the helper tab. When these names and IP's are given, the bridge will be able to control the devices or scenes by the call it receives and send it to the target OpenHAB and device/scene you configure.
Provide IP Addresses of your OpenHAB Systems that you want to utilize with the bridge. Also, give a meaningful name to each one so it is easy to decipher in the helper tab. When these names and IP's are given, the bridge will be able to control the devices or scenes by the call it receives and send it to the target OpenHAB device you configure.
#### FHEM Names and IP Addresses
Provide IP Addresses of your FHEM Systems that you want to utilize with the bridge. Also, give a meaningful name to each one so it is easy to decipher in the helper tab. When these names and IP's are given, the bridge will be able to control the devices or scenes by the call it receives and send it to the target FHEM and device/scene you configure.
Provide IP Addresses of your FHEM Systems that you want to utilize with the bridge. Also, give a meaningful name to each one so it is easy to decipher in the helper tab. When these names and IP's are given, the bridge will be able to control the devices or scenes by the call it receives and send it to the target FHEM device you configure.
#### Mozilla IOT Names and IP Addresses
Provide IP Addresses of your Mozilla IOT Systems that you want to utilize with the bridge. Also, give a meaningful name to each one so it is easy to decipher in the helper tab. When these names and IP's are given, the bridge will be able to control the devices by the call it receives and send it to the target Mozilla IOT device you configure.
#### HomeGenie Names and IP Addresses
Provide IP Addresses of your HomeGenie Systems that you want to utilize with the bridge. Also, give a meaningful name to each one so it is easy to decipher in the helper tab. When these names and IP's are given, the bridge will be able to control the devices by the call it receives and send it to the target HomeGenie device you configure. There is an extra Other Types field that you can add types that are not within the defualt of "light", "Switch" and "Dimmer" that you may want to control.
#### Nest Username
The user name of the home.nest.com account for the Nest user. This needs to be given if you are using the Nest features. There is no need to give any ip address or host information as this contacts your cloud account.
#### Nest Password
The password for the user name of the home.nest.com account for the Nest user. This needs to be given if you are using the Nest features.
#### Nest Temp Fahrenheit
This setting allows the value being sent into the bridge to be interpreted as Fahrenheit or Celsius. The default is to have Fahrenheit.
Provide the username and password of the home.nest.com account for the Nest user. This needs to be given if you are using the Nest features. There is no need to give any ip address or host information as this contacts your cloud account. Also, you can set Nest Temp Fahrenheit that allows the value being sent into the bridge to be interpreted as Fahrenheit or Celsius. The default is to have Fahrenheit.
#### LIFX Support
This setting will have the ha-bridge look for LIFX devices on your network. Since this is broadcast based, there is no other info needed.
#### Broadlink Support
@@ -343,12 +377,16 @@ This setting is the time used in between button presses when there is multiple b
This controls how many log messages will be kept and displayed on the log tab. This does not affect what is written to the standard output for logging. The default is 512. Changing this will incur more memory usage of the process.
#### Trace UPNP Calls
Turn on tracing for upnp discovery messages to the log. The default is false.
#### Trace State Changes
Turn on tracing for calls to the ha-bridge and send these information messages to the log for debugging. This a quick way to watch the state changes without turning the HueMulator debugging. The default is false.
#### UPNP Send Delay
This setting is for the upnp spec to delay a certain amount between upnp response messages sent back to a client. This is defaulted to 650ms and can be tuned to any value up to 1500ms.
#### ID Seed
The seed that starts numbering from this value and is used in the 'Renumbering' button on the 'Bridge Devices' tab. The defaul for this value is 100.
#### My Echo URL
This sets the URL that is used in the menu bar to ge to your echo. For certain countries, this needs to be set to a different URL.
At the bottom of the screen is the "Bridge Settings Backup" which can be accessed with clicking on the `+` to expand this frame. Here you can backup and restore configurations that you have saved. These configs can be named or by clicking the `Backup Settings' button will create a backup and name it for you. You can manage these backups by restoring them or deleting them.
At the bottom of the screen is the "Bridge Settings Backup" which can be accessed with clicking on the `+` to expand this frame. Here you can backup and restore configurations that you have saved. These configs can be named or by clicking the `Backup Settings' button will create a backup and name it for you. You can manage these backups by restoring them, deleting them, downloading them by clicking on the file name and uploading a saved configuration backup on your local machine.
### The Logs Tab
This screen displays the last 512 or number of rows defined in the config screen of the log so you don't have to go to the output of your process. The `Update Log` button refreshes the log as this screen does not auto refresh. FYI, when the trace upnp setting is turned on in the configuration, the messages will show here.
@@ -358,13 +396,13 @@ You must configure devices before you will have anything for the Echo or other c
#### Helpers
The easy way to get devices configured is with the use of the helpers for the Vera or Harmony, Nest, Hue and others to create devices that the bridge will present.
For the Helpers, each item being presented from the target system has a button such as `Build Item`, `Build A Button` or specific tasks such as `Temp` for thermostats that is used to create the specific device parameters. The build action buttons will put you into the edit screen. The next thing to check is the name for the bridge device that it is something that makes sense especially if you using the ha-bridge with an Echo or Google Home as this is what the Echo or Google Home will interpret as the device you want. Also, you can go back to any helper tab and click a build action button to add another item for a multi-command. After you are done in the edit tab, click the `Add Bridge Device` to finish that selection setup.
For the Helpers, each item being presented from the target system has a button such as `Build Item`, `Build A Button` or specific tasks such as `Temp` for thermostats that is used to create the specific device parameters. The build action buttons will put you into the edit screen. The next thing to check is the name for the bridge device that it is something that makes sense especially if you using the ha-bridge with an Echo or Google Home as this is what the Echo or Google Home will interpret as the device you want. Also, you can go back to any helper tab and click a build action button to add another item for a multi-command. After you are done in the edit tab, click the `Add Bridge Device` to finish that selection setup. OR you can go back to any helper and use `Build Item` or as such to add another item into the current device being shown in the `Add/Edit` tab. This allows you to create custom devices that execute many devices at once.
The helper tabs will also show you what you have already configured for that target type. Click on the `+` and you will see them and be able to delete them.
#### The Add/Edit Tab
Another way to add a device is through the Manual Add Tab. This allows you to manually enter the name, the on and off URLs and select if there are custom handling with the type of call that can be made. This allows for control of anything that has a distinct request that can be executed so you are not limited to the Vera, Harmony, Nest or other Hue.
This is the main device editing page to modify details or you can add a device through this tab. This allows you to manually enter the name, the on/dim/off/color items and select if there are custom handling with the type of call that can be made. This allows for control of anything that has a distinct request that can be executed so you are not limited to the Vera, Harmony, Nest or other Hue.
There is a new format for the on/dim/off URL areas. The new editor handles the intricacies of the components, but is broken down here for explanation.
There is a new format for the on/dim/off/color URL areas. The new editor handles the intricacies of the components, but is broken down here for explanation.
It is imperative when adding a line by hand that you hit the ```Add``` button at the end of the line before adding or updating the whole entry.
@@ -443,34 +481,15 @@ Examples:
```
#### Multiple Call Construct
Also available is the ability to specify multiple commands in the On URL, Dim URL and Off URL areas by adding Json constructs listed here. This is only for the types of tcp, udp, http, https or a new exec type. Also within the item format you can specify delay in milliseconds and count per item. These new parameters work on device buttons for the Harmony as well.
Format Example in the URL areas:
```
[{"item":"http://192.168.1.1:8180/do/this/thing","type":"httpDevice"},
{"item":"http://192.168.1.1:8180/do/the/next/thing","delay":1000,"count":2,"type":"httpDevice"},
{"item":"http://192.168.1.1:8180/do/another/thing","type":"httpDevice"}]
[{"item":"udp://192.168.1.1:5000/0x450555","type":"udpDevice"},
{"item":"udp://192.168.1.1:5000/0x45${intensity.percent}55","type":"udpDevice"}]
[{"item":"udp://192.168.1.1:5000/0x450555","type":"udpDevice"},
{"item":"http://192.168.1.1:8180/do/this/thing","type":"httpDevice"},
{"item":"tcp://192.168.2.1/sendthisdata","type":"tcpDevice"},
{"item":"https://192.168.12.1/do/this/secure/thing","type":"httpDevice"},
{"item":"exec://notepad.exe","type":"cmdDevice"}]
```
Also available is the ability to specify multiple commands in the On Items, Dim Items, Off Items and Color Items by adding a new line to the item. When doing this manually, make sure to hit the `Add` button to the right of the row. If you do not hit the add button, it will not save when the add or update device buttons are selected. You can also add by going to a helper tab after you have entered the `Add/Edit` tab and using the helpers 'Build' buttons to add a new item line in the respected On/Dim/Off/Color items areas.
#### Script or Command Execution
The release as of v2.0.0 will now support the execution of a local script or program. This will blindly fire off a process to run and is bound by the privileges of the java process.
To configure this type of manual add, you will need to select the Device type of "Execute Script/Program".
In the URL areas, the format of the execution is just providing what command line you would like to run, or using the multiple call item construct described above.
```
[{"item":"exec://C:\\Users\\John\\Documents\\Applications\\putty.exe 192.168.1.1","type":"cmdDevice"},{"item":"exec://notepad.exe","type":"cmdDevice"}]
[{"item":"/home/pi/scripts/dothisscript.sh","type":"cmdDevice"}]
```
If you are running a script on a system, you will need to provide the shell interface it will use before the script such as `sh` or `cmd.exe`.
#### Value Passing Controls
There are multiple replacement constructs available to be put into any of the calls except Harmony items, Net Items and HAL items. These constructs are: "${time.format(Java time format string)}", "${intensity.percent}", "${intensity.percent.hex}", "${intensity.decimal_percent}", "${intensity.byte}", "${intensity.byte.hex}", "${intensity.math(using X in your calc)}" and "${intensity.math(using X in your calc).hex}".
@@ -523,7 +542,7 @@ To view or remove devices that Alexa knows about, you can use the mobile app `Me
## Google Assistant
Google Home is supported as of v3.2.0 and forward, but only if the bridge is running on port 80.
**ISSUE: Google Home 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.**
**ISSUE: Google Home does NOT support local connection to Philips Hue Hubs and requires that it connect to meethue.com. Since the ha-bridge only emulates the local API, and is not associated with Philips, this method will not work. If you have an older Google Home application, this may still work. YMMV.**
Use the Google Home app on a phone to add new "home control" devices by going into `Settings / Home Control / +`
as described [here](https://support.google.com/googlehome/answer/7124115?hl=en&ref_topic=7125624#homecontrol).

View File

@@ -5,7 +5,7 @@
<groupId>com.bwssystems.HABridge</groupId>
<artifactId>ha-bridge</artifactId>
<version>5.3.0RC3</version>
<version>5.3.0RC10</version>
<packaging>jar</packaging>
<name>HA Bridge</name>
@@ -134,6 +134,11 @@
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
</dependency>
<dependency>
<groupId>org.jmdns</groupId>
<artifactId>jmdns</artifactId>
<version>3.5.5</version>
</dependency>
</dependencies>
<build>
@@ -269,4 +274,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

View File

@@ -38,7 +38,7 @@ public class BridgeSecurity {
(byte) 0xde, (byte) 0x33, (byte) 0x10, (byte) 0x12,
(byte) 0xde, (byte) 0x33, (byte) 0x10, (byte) 0x12,
};
private char[] habridgeKey;
private static char[] habridgeKey;
private String execGarden;
private BridgeSecurityDescriptor securityDescriptor;
private boolean settingsChanged;
@@ -146,7 +146,16 @@ public class BridgeSecurity {
public String getExecGarden() {
return execGarden;
}
public void setUseLinkButton(boolean useThis) {
String getKeyfilePath() {
return securityDescriptor.getKeyfilePath();
}
String getKeyfilePassword() {
return securityDescriptor.getKeyfilePassword();
}
private void setUseLinkButton(boolean useThis) {
securityDescriptor.setUseLinkButton(useThis);
settingsChanged = true;
}
@@ -155,16 +164,77 @@ public class BridgeSecurity {
return securityDescriptor.isSecureHueApi();
}
public void setSecureHueApi(boolean theState) {
securityDescriptor.setSecureHueApi(theState);
public boolean isUseHttps() {
return securityDescriptor.isUseHttps();
}
public boolean isKeyfilePW() {
if(securityDescriptor.getKeyfilePassword() != null && !securityDescriptor.getKeyfilePassword().trim().isEmpty()) {
return true;
}
return false;
}
private void setSecureHueApi(boolean theState) {
securityDescriptor.setSecureHueApi(theState);
settingsChanged = true;
}
private void setUseHttps(boolean usehttps, String keyfilepath, String keyfilepassword) {
if(usehttps) {
if(!isUseHttps()) {
securityDescriptor.setKeyfilePath(keyfilepath);
securityDescriptor.setKeyfilePassword(keyfilepassword);
securityDescriptor.setUseHttps(usehttps);
settingsChanged = true;
} else {
if(!keyfilepassword.equals("########")) {
securityDescriptor.setKeyfilePassword(keyfilepassword);
settingsChanged = true;
}
if(!securityDescriptor.getKeyfilePath().equals(keyfilepath)) {
securityDescriptor.setKeyfilePath(keyfilepath);
settingsChanged = true;
}
}
} else {
if(isUseHttps()) {
securityDescriptor.setKeyfilePassword("");
securityDescriptor.setKeyfilePath("");
securityDescriptor.setUseHttps(usehttps);
settingsChanged = true;
}
}
}
public SecurityInfo getSecurityInfo() {
SecurityInfo theInfo = new SecurityInfo();
theInfo.setUseLinkButton(isUseLinkButton());
theInfo.setSecureHueApi(isSecureHueApi());
theInfo.setSecure(isSecure());
theInfo.setUseHttps(isUseHttps());
theInfo.setKeyfilePath(securityDescriptor.getKeyfilePath());
if(isKeyfilePW()) {
theInfo.setKeyfilePassword("########");
}
else {
theInfo.setKeyfilePassword("");
}
if(isSecure()) {
theInfo.setExecGarden(execGarden);
}
return theInfo;
}
public void setSecurityDataByInfo(SecurityInfo theInfo) {
setUseLinkButton(theInfo.isUseLinkButton());
setSecureHueApi(theInfo.isSecureHueApi());
setUseHttps(theInfo.isUseHttps(), theInfo.getKeyfilePath(), theInfo.getKeyfilePassword());
}
public LoginResult validatePassword(User targetUser) throws IOException {
LoginResult result = new LoginResult();
if(targetUser != null && targetUser.getUsername() != null) {
@@ -324,7 +394,7 @@ public class BridgeSecurity {
}
}
private String encrypt(String property) throws GeneralSecurityException, UnsupportedEncodingException {
static String encrypt(String property) throws GeneralSecurityException, UnsupportedEncodingException {
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("PBEWithMD5AndDES");
SecretKey key = keyFactory.generateSecret(new PBEKeySpec(habridgeKey));
Cipher pbeCipher = Cipher.getInstance("PBEWithMD5AndDES");
@@ -336,7 +406,7 @@ public class BridgeSecurity {
return Base64.getEncoder().encodeToString(bytes);
}
private String decrypt(String property) throws GeneralSecurityException, IOException {
static String decrypt(String property) throws GeneralSecurityException, IOException {
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("PBEWithMD5AndDES");
SecretKey key = keyFactory.generateSecret(new PBEKeySpec(habridgeKey));
Cipher pbeCipher = Cipher.getInstance("PBEWithMD5AndDES");

View File

@@ -9,7 +9,10 @@ public class BridgeSecurityDescriptor {
private String execGarden;
private boolean secureHueApi;
private Map<String, WhitelistEntry> whitelist;
private boolean useHttps;
private String keyfilePassword;
private String keyfilePath;
public BridgeSecurityDescriptor() {
super();
this.setUseLinkButton(false);
@@ -67,4 +70,28 @@ public class BridgeSecurityDescriptor {
return secureFlag;
}
public boolean isUseHttps() {
return useHttps;
}
public void setUseHttps(boolean useHttps) {
this.useHttps = useHttps;
}
public String getKeyfilePassword() {
return keyfilePassword;
}
public void setKeyfilePassword(String keyfilePassword) {
this.keyfilePassword = keyfilePassword;
}
public String getKeyfilePath() {
return keyfilePath;
}
public void setKeyfilePath(String keyfilePath) {
this.keyfilePath = keyfilePath;
}
}

View File

@@ -129,6 +129,9 @@ public class BridgeSettingsDescriptor {
@SerializedName("seedid")
@Expose
private Integer seedid;
@SerializedName("haaddressessecured")
@Expose
private boolean haaddressessecured;
// @SerializedName("activeloggers")
// @Expose
// private List<NameValue> activeloggers;
@@ -188,6 +191,7 @@ public class BridgeSettingsDescriptor {
this.tracestate = false;
this.upnporiginal = false;
this.seedid = 100;
this.haaddressessecured = false;
}
public String getUpnpConfigAddress() {
@@ -255,6 +259,7 @@ public class BridgeSettingsDescriptor {
}
public IpList getVeraAddress() {
return veraaddress;
}
@@ -835,4 +840,11 @@ public class BridgeSettingsDescriptor {
return true;
}
public boolean isHaaddressessecured() {
return haaddressessecured;
}
public void setHaaddressessecured(boolean haaddressessecured) {
this.haaddressessecured = haaddressessecured;
}
}

View File

@@ -54,9 +54,13 @@ public class HABridge {
bridgeSettings = new BridgeSettings();
// sparkjava config directive to set html static file location for Jetty
while(!bridgeSettings.getBridgeControl().isStop()) {
bridgeSettings.buildSettings();
bridgeSettings.getBridgeSecurity().removeTestUsers();
log.info("HA Bridge (v{}) initializing....", theVersion.getVersion() );
bridgeSettings.buildSettings();
if(bridgeSettings.getBridgeSecurity().isUseHttps()) {
secure(bridgeSettings.getBridgeSecurity().getKeyfilePath(), bridgeSettings.getBridgeSecurity().getKeyfilePassword(), null, null);
log.info("Using https for web and api calls");
}
bridgeSettings.getBridgeSecurity().removeTestUsers();
// sparkjava config directive to set ip address for the web server to listen on
ipAddress(bridgeSettings.getBridgeSettingsDescriptor().getWebaddress());
// sparkjava config directive to set port for the web server to listen on

View File

@@ -4,6 +4,10 @@ public class SecurityInfo {
private boolean useLinkButton;
private boolean secureHueApi;
private boolean isSecure;
private String execGarden;
private boolean useHttps;
private String keyfilePath;
private String keyfilePassword;
public boolean isUseLinkButton() {
return useLinkButton;
@@ -23,4 +27,36 @@ public class SecurityInfo {
public void setSecure(boolean isSecure) {
this.isSecure = isSecure;
}
public boolean isUseHttps() {
return useHttps;
}
public void setUseHttps(boolean useHttps) {
this.useHttps = useHttps;
}
public String getKeyfilePath() {
return keyfilePath;
}
public void setKeyfilePath(String keyfilePath) {
this.keyfilePath = keyfilePath;
}
public String getExecGarden() {
return execGarden;
}
public void setExecGarden(String execGarden) {
this.execGarden = execGarden;
}
public String getKeyfilePassword() {
return keyfilePassword;
}
public void setKeyfilePassword(String keyfilePassword) {
this.keyfilePassword = keyfilePassword;
}
}

View File

@@ -314,8 +314,7 @@ public class SystemControl {
post(SYSTEM_CONTEXT + "/changesecurityinfo", (request, response) -> {
log.debug("changesecurityinfo....");
SecurityInfo theInfo = new Gson().fromJson(request.body(), SecurityInfo.class);
bridgeSettings.getBridgeSecurity().setUseLinkButton(theInfo.isUseLinkButton());
bridgeSettings.getBridgeSecurity().setSecureHueApi(theInfo.isSecureHueApi());
bridgeSettings.getBridgeSecurity().setSecurityDataByInfo(theInfo);
bridgeSettings.save(bridgeSettings.getBridgeSettingsDescriptor());
response.status(HttpStatus.SC_OK);
response.type("application/json");

View File

@@ -186,9 +186,7 @@ public class DeviceRepository extends BackupHandler {
nextId++;
}
if (descriptors[i].getUniqueid() == null || descriptors[i].getUniqueid().length() == 0) {
String hexValue = HexLibrary.encodeUsingBigIntegerToString(descriptors[i].getId());
descriptors[i].setUniqueid("00:17:88:5E:D3:" + hexValue + "-" + hexValue);
descriptors[i].setUniqueid("00:17:88:5E:D3:" + hueUniqueId(Integer.valueOf(descriptors[i].getId())));
}
put(descriptors[i].getId(), descriptors[i]);
theNames = theNames + " " + descriptors[i].getName() + ", ";
@@ -203,8 +201,6 @@ public class DeviceRepository extends BackupHandler {
Iterator<DeviceDescriptor> deviceIterator = list.iterator();
Map<String, DeviceDescriptor> newdevices = new HashMap<String, DeviceDescriptor>();
List<String> lockedIds = new ArrayList<String>();
String hexValue;
Integer newValue;
DeviceDescriptor theDevice;
boolean findNext = true;
@@ -230,14 +226,7 @@ public class DeviceRepository extends BackupHandler {
}
}
theDevice.setId(String.valueOf(nextId));
newValue = nextId % 256;
if (newValue <= 0)
newValue = 1;
else if (newValue > 255)
newValue = 255;
hexValue = HexLibrary.encodeUsingBigIntegerToString(newValue.toString());
theDevice.setUniqueid("00:17:88:5E:D3:" + hexValue + "-" + hexValue);
theDevice.setUniqueid("00:17:88:5E:D3:" + hueUniqueId(nextId));
nextId++;
}
newdevices.put(theDevice.getId(), theDevice);
@@ -304,4 +293,29 @@ public class DeviceRepository extends BackupHandler {
return content;
}
private String hueUniqueId(Integer anId) {
String theUniqueId;
Integer newValue;
String hexValueLeft;
String hexValueRight;
newValue = anId % 256;
if (newValue <= 0)
newValue = 1;
else if (newValue > 255)
newValue = 255;
hexValueLeft = HexLibrary.byteToHex(newValue.byteValue());
newValue = anId / 256;
newValue = newValue % 256;
if (newValue < 0)
newValue = 0;
else if (newValue > 255)
newValue = 255;
hexValueRight = HexLibrary.byteToHex(newValue.byteValue());
theUniqueId = String.format("%s-%s", hexValueLeft, hexValueRight).toUpperCase();
return theUniqueId;
}
}

View File

@@ -39,7 +39,7 @@ public class HomeGenieInstance {
String theData = httpClient.doHttpRequest(aUrl, HttpPut.METHOD_NAME, "application/json", null, httpClient.addBasicAuthHeader(null, homegenieIP));
log.debug("call Command return is: <<<{}>>>", theData);
if (!theData.contains("OK"))
if (theData.toLowerCase().contains("error"))
return false;
return true;
}
@@ -61,12 +61,12 @@ public class HomeGenieInstance {
if (hgModules != null && hgModules.length > 0) {
deviceList = new ArrayList<Module>();
for (int i = 0; i < hgModules.length; i++) {
if (hgModules[i].isSwitch() || hgModules[i].isDimmer())
if (hgModules[i].isModuleValid(homegenieIP.getExtensions()))
deviceList.add(hgModules[i]);
}
}
} catch (Exception e) {
log.warn("Cannot get an devices for Homegenie {} Gson Parse Error.", homegenieIP.getName());
log.warn("Cannot get devices for Homegenie {} Gson Parse Error.", homegenieIP.getName(), e);
}
}
return deviceList;

View File

@@ -1,11 +1,20 @@
package com.bwssystems.HABridge.plugins.homegenie;
import java.util.List;
// import java.util.List;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
public class Module {
private static final Logger log = LoggerFactory.getLogger(HomeGenieInstance.class);
@SerializedName("Name")
@Expose
@@ -23,10 +32,10 @@ public class Module {
@Expose
private String address;
/*
@SerializedName("Properties")
@Expose
private List<Property> properties = null;
*/
* @SerializedName("Properties")
*
* @Expose private List<Property> properties = null;
*/
@SerializedName("RoutingNode")
@Expose
private String routingNode;
@@ -70,15 +79,13 @@ public class Module {
public void setAddress(String address) {
this.address = address;
}
/*
public List<Property> getProperties() {
return properties;
}
public void setProperties(List<Property> properties) {
this.properties = properties;
}
*/
/*
* public List<Property> getProperties() { return properties; }
*
* public void setProperties(List<Property> properties) { this.properties =
* properties; }
*/
public String getRoutingNode() {
return routingNode;
}
@@ -95,10 +102,48 @@ public class Module {
return isDeviceType("Dimmer");
}
public boolean isLight() {
return isDeviceType("Light");
}
private boolean isDeviceType(String theType) {
if(deviceType.equals(theType)) {
if (deviceType.equals(theType)) {
return true;
}
return false;
}
public boolean isModuleValid(JsonObject theExtensions) {
ModuleTypes moduleTypes = null;
if (this.name == null || this.name.trim().isEmpty())
return false;
if (isSwitch())
return true;
if (isDimmer())
return true;
if (isLight())
return true;
if (theExtensions != null && theExtensions.isJsonObject() && theExtensions.get("moduleTypes").isJsonArray()) {
try {
moduleTypes = new Gson().fromJson(theExtensions, ModuleTypes.class);
} catch (Exception e) {
log.warn("Could not parse extensions for {} with {}", this.name, theExtensions);
return false;
}
if (moduleTypes == null)
return false;
for (ModuleType moduleType : moduleTypes.getModuleTypes()) {
if (isDeviceType(moduleType.getModuleType()))
return true;
}
}
return false;
}
}

View File

@@ -0,0 +1,20 @@
package com.bwssystems.HABridge.plugins.homegenie;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class ModuleType {
@SerializedName("moduleType")
@Expose
private String moduleType;
public String getModuleType() {
return moduleType;
}
public void setModuleType(String moduleType) {
this.moduleType = moduleType;
}
}

View File

@@ -0,0 +1,21 @@
package com.bwssystems.HABridge.plugins.homegenie;
import java.util.List;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class ModuleTypes {
@SerializedName("moduleTypes")
@Expose
private List<ModuleType> moduleTypes = null;
public List<ModuleType> getModuleTypes() {
return moduleTypes;
}
public void setModuleTypes(List<ModuleType> moduleTypes) {
this.moduleTypes = moduleTypes;
}
}

View File

@@ -19,15 +19,20 @@ public class MozIotInstance {
private JWT moziotToken;
private NamedIP mozIotIP;
private NameValue[] headers;
private HTTPHandler anHttpClient;
public MozIotInstance(NamedIP theNamedIp, HTTPHandler httpClient) {
mozIotIP = theNamedIp;
headers = null;
gatewayLogin(httpClient);
moziotToken = null;
anHttpClient = httpClient;
gatewayLogin();
}
public Boolean callCommand(String deviceId, String aCommand, MozIotCommandDetail commandData, HTTPHandler httpClient) {
log.debug("calling Mozilla IOT: {}:{}{}{}", mozIotIP.getIp(), mozIotIP.getPort(), aCommand, commandData.getBody());
public Boolean callCommand(String deviceId, String aCommand, MozIotCommandDetail commandData,
HTTPHandler httpClient) {
log.debug("calling Mozilla IOT: {}:{}{}{}", mozIotIP.getIp(), mozIotIP.getPort(), aCommand,
commandData.getBody());
String aUrl = null;
if (mozIotIP.getSecure() != null && mozIotIP.getSecure())
@@ -36,8 +41,9 @@ public class MozIotInstance {
aUrl = "http://";
headers = getAuthHeader();
aUrl = aUrl + mozIotIP.getIp() + ":" + mozIotIP.getPort() + "/things/" + deviceId + "/" + aCommand;
String theData = httpClient.doHttpRequest(aUrl, HttpPut.METHOD_NAME, "application/json", commandData.getBody(), headers);
aUrl = aUrl + mozIotIP.getIp() + ":" + mozIotIP.getPort() + "/things/" + deviceId + "/" + aCommand;
String theData = httpClient.doHttpRequest(aUrl, HttpPut.METHOD_NAME, "application/json", commandData.getBody(),
headers);
log.debug("call Command return is: <<<{}>>>", theData);
if (theData.contains("error") || theData.contains("ERROR") || theData.contains("Error"))
return false;
@@ -77,7 +83,10 @@ public class MozIotInstance {
}
private NameValue[] getAuthHeader() {
if (headers == null) {
if (moziotToken == null)
gatewayLogin();
if (headers == null && moziotToken != null) {
headers = new NameValue[3];
headers[0] = new NameValue();
headers[0].setName("Authorization");
@@ -88,13 +97,14 @@ public class MozIotInstance {
headers[2] = new NameValue();
headers[2].setName("Accept");
headers[2].setValue("application/json");
}
}
return headers;
}
private void gatewayLogin(HTTPHandler httpClient) {
private void gatewayLogin() {
String aUrl = null;
moziotToken = null;
if (mozIotIP.getSecure() != null && mozIotIP.getSecure())
aUrl = "https://";
else
@@ -112,13 +122,15 @@ public class MozIotInstance {
String commandData = "{\"email\": \"" + mozIotIP.getUsername() + "\", \"password\":\"" + mozIotIP.getPassword()
+ "\"}";
log.debug("The login body: {}", commandData);
String theData = httpClient.doHttpRequest(aUrl, HttpPost.METHOD_NAME, "application/json", commandData, headers);
String theData = anHttpClient.doHttpRequest(aUrl, HttpPost.METHOD_NAME, "application/json", commandData,
headers);
if (theData != null) {
log.debug("GET Mozilla login - data: {}", theData);
try {
moziotToken = new Gson().fromJson(theData, JWT.class);
} catch (Exception e) {
log.warn("Cannot get login for Mozilla IOT {} Gson Parse Error.", mozIotIP.getName());
moziotToken = null;
}
} else {
log.warn("Could not login {} error: <<<{}>>>", mozIotIP.getName(), theData);

View File

@@ -7,9 +7,9 @@ import com.google.gson.annotations.SerializedName;
public class MozillaThing {
@SerializedName("name")
@SerializedName("title")
@Expose
private String name;
private String title;
@SerializedName("type")
@Expose
private String type;
@@ -47,14 +47,6 @@ public class MozillaThing {
@Expose
private Object iconHref;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
@@ -151,4 +143,12 @@ public class MozillaThing {
this.iconHref = iconHref;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}

View File

@@ -12,13 +12,18 @@ import com.bwssystems.HABridge.util.UDPDatagramSender;
import java.io.IOException;
import java.net.*;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
// import java.time.Instant;
// import java.time.temporal.ChronoUnit;
import java.util.Enumeration;
import java.util.HashMap;
import org.apache.http.conn.util.*;
import javax.jmdns.JmDNS;
import javax.jmdns.ServiceInfo;
public class UpnpListener {
private Logger log = LoggerFactory.getLogger(UpnpListener.class);
private UDPDatagramSender theUDPDatagramSender;
private MulticastSocket upnpMulticastSocket;
private int httpServerPort;
private String upnpConfigIP;
@@ -31,31 +36,67 @@ public class UpnpListener {
private String bridgeSNUUID;
private HuePublicConfig aHueConfig;
private Integer theUpnpSendDelay;
private String responseTemplateOriginal = "HTTP/1.1 200 OK\r\n" + "CACHE-CONTROL: max-age=86400\r\n" + "EXT:\r\n"
+ "LOCATION: http://%s:%s/description.xml\r\n" + "SERVER: FreeRTOS/6.0.5, UPnP/1.0, IpBridge/"
+ HueConstants.API_VERSION + "\r\n" + "ST: urn:schemas-upnp-org:device:basic:1\r\n" + "USN: uuid:"
+ HueConstants.UUID_PREFIX + "%s::urn:schemas-upnp-org:device:basic:1\r\n\r\n";
private String responseTemplate1 = "HTTP/1.1 200 OK\r\n" + "HOST: %s:%s\r\n" + "CACHE-CONTROL: max-age=100\r\n"
+ "EXT:\r\n" + "LOCATION: http://%s:%s/description.xml\r\n" + "SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/"
+ HueConstants.API_VERSION + "\r\n" + "hue-bridgeid: %s\r\n" + "ST: upnp:rootdevice\r\n" + "USN: uuid:"
+ HueConstants.UUID_PREFIX + "%s::upnp:rootdevice\r\n\r\n";
private String responseTemplate2 = "HTTP/1.1 200 OK\r\n" + "HOST: %s:%s\r\n" + "CACHE-CONTROL: max-age=100\r\n"
+ "EXT:\r\n" + "LOCATION: http://%s:%s/description.xml\r\n" + "SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/"
+ HueConstants.API_VERSION + "\r\n" + "hue-bridgeid: %s\r\n" + "ST: uuid:" + HueConstants.UUID_PREFIX
+ "%s\r\n" + "USN: uuid:" + HueConstants.UUID_PREFIX + "%s\r\n\r\n";
private String responseTemplate3 = "HTTP/1.1 200 OK\r\n" + "HOST: %s:%s\r\n" + "CACHE-CONTROL: max-age=100\r\n"
+ "EXT:\r\n" + "LOCATION: http://%s:%s/description.xml\r\n" + "SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/"
+ HueConstants.API_VERSION + "\r\n" + "hue-bridgeid: %s\r\n" + "ST: urn:schemas-upnp-org:device:basic:1\r\n"
+ "USN: uuid:" + HueConstants.UUID_PREFIX + "%s\r\n\r\n";
private String responseTemplate1 = "HTTP/1.1 200 OK\r\n" +
"HOST: %s:%s\r\n" +
"CACHE-CONTROL: max-age=100\r\n" +
"EXT:\r\n" +
"LOCATION: http://%s:%s/description.xml\r\n" +
"SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/" + HueConstants.API_VERSION + "\r\n" +
"HUE-BRIDGEID: %s\r\n" +
"ST: upnp:rootdevice\r\n" +
"USN: uuid:" + HueConstants.UUID_PREFIX + "%s::upnp:rootdevice\r\n\r\n";
private String responseTemplate2 = "HTTP/1.1 200 OK\r\n" +
"HOST: %s:%s\r\n" +
"CACHE-CONTROL: max-age=100\r\n" +
"EXT:\r\n" +
"LOCATION: http://%s:%s/description.xml\r\n" +
"SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/" + HueConstants.API_VERSION + "\r\n" +
"HUE-BRIDGEID: %s\r\n" +
"ST: uuid:" + HueConstants.UUID_PREFIX + "%s\r\n" +
"USN: uuid:" + HueConstants.UUID_PREFIX + "%s\r\n\r\n";
private String responseTemplate3 = "HTTP/1.1 200 OK\r\n" +
"HOST: %s:%s\r\n" +
"CACHE-CONTROL: max-age=100\r\n" +
"EXT:\r\n" +
"LOCATION: http://%s:%s/description.xml\r\n" +
"SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/" + HueConstants.API_VERSION + "\r\n" +
"HUE-BRIDGEID: %s\r\n" +
"ST: urn:schemas-upnp-org:device:basic:1\r\n" +
"USN: uuid:" + HueConstants.UUID_PREFIX + "%s\r\n\r\n";
private String notifyTemplate = "NOTIFY * HTTP/1.1\r\n" + "HOST: %s:%s\r\n" + "CACHE-CONTROL: max-age=100\r\n"
+ "LOCATION: http://%s:%s/description.xml\r\n" + "SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/"
+ HueConstants.API_VERSION + "\r\n" + "NTS: ssdp:alive\r\n" + "hue-bridgeid: %s\r\n" + "NT: uuid:"
+ HueConstants.UUID_PREFIX + "%s\r\n" + "USN: uuid:" + HueConstants.UUID_PREFIX + "%s\r\n\r\n";
private String notifyTemplate1 = "NOTIFY * HTTP/1.1\r\n" +
"HOST: %s:%s\r\n" +
"CACHE-CONTROL: max-age=100\r\n" +
"LOCATION: http://%s:%s/description.xml\r\n" +
"SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/" + HueConstants.API_VERSION + "\r\n" +
"NTS: ssdp:alive\r\n" +
"HUE-BRIDGEID: %s\r\n" +
"NT: uuid:" + HueConstants.UUID_PREFIX + "%s\r\n" +
"USN: uuid:" + HueConstants.UUID_PREFIX + "%s\r\n\r\n";
private String notifyTemplate2 = "NOTIFY * HTTP/1.1\r\n" +
"HOST: %s:%s\r\n" +
"CACHE-CONTROL: max-age=100\r\n" +
"LOCATION: http://%s:%s/description.xml\r\n" +
"SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/" + HueConstants.API_VERSION + "\r\n" +
"NTS: ssdp:alive\r\n" + "HUE-BRIDGEID: %s\r\n" +
"NT: upnp:rootdevice\r\n" +
"USN: uuid:" + HueConstants.UUID_PREFIX + "%s::upnp:rootdevice\r\n\r\n";
private String notifyTemplate3 = "NOTIFY * HTTP/1.1\r\n" +
"HOST: %s:%s\r\n" +
"CACHE-CONTROL: max-age=100\r\n" +
"LOCATION: http://%s:%s/description.xml\r\n" +
"SERVER: Linux/3.14.0 UPnP/1.0 IpBridge/" + HueConstants.API_VERSION + "\r\n" +
"NTS: ssdp:alive\r\n" +
"HUE-BRIDGEID: %s\r\n" +
"NT: urn:schemas-upnp-org:device:basic:1\r\n" +
"USN: uuid:" + HueConstants.UUID_PREFIX + "%s\r\n\r\n";
public UpnpListener(BridgeSettingsDescriptor theSettings, BridgeControlDescriptor theControl,
UDPDatagramSender aUdpDatagramSender) throws IOException {
super();
theUDPDatagramSender = aUdpDatagramSender;
upnpMulticastSocket = null;
httpServerPort = Integer.valueOf(theSettings.getServerPort());
upnpConfigIP = theSettings.getUpnpConfigAddress();
@@ -96,6 +137,7 @@ public class UpnpListener {
return false;
}
InetAddress theUpnpAddress = null;
while (ifs.hasMoreElements()) {
NetworkInterface xface = ifs.nextElement();
Enumeration<InetAddress> addrs = xface.getInetAddresses();
@@ -116,6 +158,10 @@ public class UpnpListener {
+ addr);
IPsPerNic++;
}
if (addr.getHostAddress().equals(upnpConfigIP)) {
theUpnpAddress = addr;
}
}
}
log.debug("Checking " + name + " to our interface set");
@@ -133,6 +179,25 @@ public class UpnpListener {
}
}
JmDNS jmdns = null;
if (theUpnpAddress != null) {
log.info("Create and run mDNS service.");
try {
// Create a JmDNS instance
jmdns = JmDNS.create(theUpnpAddress, "Philips-hue");
// Register a service - Defined TXT keys: bridgeid, modelid
final HashMap<String, String> values = new HashMap<String, String>();
values.put("modelid", HueConstants.MODEL_ID);
values.put("bridgeid", bridgeId);
ServiceInfo serviceInfo = ServiceInfo.create("_hue._tcp.local.", "Philips Hue - " + bridgeId.substring(bridgeId.length() - 6), httpServerPort, 0, 0, values);
jmdns.registerService(serviceInfo);
} catch (IOException e) {
log.warn("Could not start mDNS service for hue api. {}", e.getMessage());
}
}
log.info("UPNP Discovery Listener running and ready....");
boolean loopControl = true;
boolean error = false;
@@ -141,8 +206,8 @@ public class UpnpListener {
} catch (SocketException e1) {
log.warn("Could not sent soTimeout on multi-cast socket");
}
Instant current, previous;
previous = Instant.now();
// Instant current, previous;
// previous = Instant.now();
while (loopControl) { // trigger shutdown here
byte[] buf = new byte[1024];
DatagramPacket packet = new DatagramPacket(buf, buf.length);
@@ -157,15 +222,28 @@ public class UpnpListener {
log.debug("UpnpListener send upnp exception: ", e);
}
}
/*
current = Instant.now();
if (ChronoUnit.MILLIS.between(previous, current) > Configuration.UPNP_NOTIFY_TIMEOUT) {
sendUpnpNotify(socketAddress.getAddress());
try {
sendUpnpNotify(socketAddress.getAddress());
} catch (IOException e) {
log.warn("UpnpListener encountered an error sending upnp notify packets. IP: "
+ packet.getAddress().getHostAddress() + " with message: " + e.getMessage());
log.debug("UpnpListener send upnp notify exception: ", e);
}
previous = Instant.now();
}
}
*/
} catch (SocketTimeoutException e) {
sendUpnpNotify(socketAddress.getAddress());
try {
sendUpnpNotify(socketAddress.getAddress());
} catch (IOException en) {
log.warn("UpnpListener encountered an error sending upnp notify packets. IP: "
+ packet.getAddress().getHostAddress() + " with message: " + en.getMessage());
log.debug("UpnpListener send upnp notify exception: ", en);
}
} catch (IOException e) {
log.error("UpnpListener encountered an error reading socket. Shutting down", e);
error = true;
@@ -180,6 +258,10 @@ public class UpnpListener {
}
}
upnpMulticastSocket.close();
if(jmdns != null) {
// Unregister all services
jmdns.unregisterAllServices();
}
if (bridgeControl.isReinit())
log.info("UPNP Discovery Listener - ended, restart found");
if (bridgeControl.isStop())
@@ -199,8 +281,9 @@ public class UpnpListener {
String packetString = new String(packet.getData(), 0, packet.getLength());
if (packetString != null && packetString.startsWith("M-SEARCH * HTTP/1.1")
&& packetString.contains("\"ssdp:discover\"")) {
if ((packetString.contains("ST: urn:schemas-upnp-org:device:basic:1")
|| packetString.contains("ST: upnp:rootdevice") || packetString.contains("ST: ssdp:all"))) {
if ((packetString.contains("ST: urn:schemas-upnp-org:device:basic:1") ||
packetString.contains("ST: upnp:rootdevice") ||
packetString.contains("ST: ssdp:all"))) {
if (traceupnp) {
log.info("Traceupnp: SSDP M-SEARCH packet from " + packet.getAddress().getHostAddress() + ":"
+ packet.getPort());
@@ -238,39 +321,14 @@ public class UpnpListener {
// noop
}
if (upnpOriginal) {
discoveryResponse = String.format(responseTemplateOriginal, Configuration.UPNP_MULTICAST_ADDRESS,
Configuration.UPNP_DISCOVERY_PORT, httpLocationAddress, httpServerPort, bridgeId, bridgeSNUUID);
if (traceupnp) {
log.info("Traceupnp: send upnp discovery template Original with response address: " + httpLocationAddress + ":"
+ httpServerPort + " to address: " + requester + ":" + sourcePort);
} else
log.debug("sendUpnpResponse to address: " + requester + ":" + sourcePort
+ " with discovery responseTemplateOriginal is <<<" + discoveryResponse + ">>>");
sendUDPResponse(discoveryResponse.getBytes(), requester, sourcePort);
} else {
discoveryResponse = String.format(responseTemplateOriginal, Configuration.UPNP_MULTICAST_ADDRESS,
Configuration.UPNP_DISCOVERY_PORT, httpLocationAddress, httpServerPort, bridgeId, bridgeSNUUID);
if (traceupnp) {
log.info("Traceupnp: send upnp discovery template Original with response address: " + httpLocationAddress + ":"
+ httpServerPort + " to address: " + requester + ":" + sourcePort);
} else
log.debug("sendUpnpResponse to address: " + requester + ":" + sourcePort
+ " with discovery responseTemplateOriginal is <<<" + discoveryResponse + ">>>");
sendUDPResponse(discoveryResponse.getBytes(), requester, sourcePort);
try {
Thread.sleep(theUpnpSendDelay);
} catch (InterruptedException e) {
// noop
}
discoveryResponse = String.format(responseTemplate1, Configuration.UPNP_MULTICAST_ADDRESS,
Configuration.UPNP_DISCOVERY_PORT, httpLocationAddress, httpServerPort, bridgeId, bridgeSNUUID);
if (traceupnp) {
log.info("Traceupnp: send upnp discovery template 1 with response address: " + httpLocationAddress + ":"
+ httpServerPort + " to address: " + requester + ":" + sourcePort);
} else
log.debug("sendUpnpResponse to address: " + requester + ":" + sourcePort
+ " with discovery responseTemplate1 is <<<" + discoveryResponse + ">>>");
}
log.debug("sendUpnpResponse to address: " + requester + ":" + sourcePort
+ " with discovery responseTemplate1 is <<<" + discoveryResponse + ">>>");
sendUDPResponse(discoveryResponse.getBytes(), requester, sourcePort);
try {
@@ -284,9 +342,9 @@ public class UpnpListener {
if (traceupnp) {
log.info("Traceupnp: send upnp discovery template 2 with response address: " + httpLocationAddress + ":"
+ httpServerPort + " to address: " + requester + ":" + sourcePort);
} else
log.debug("sendUpnpResponse to address: " + requester + ":" + sourcePort
+ " discovery responseTemplate2 is <<<" + discoveryResponse + ">>>");
}
log.debug("sendUpnpResponse to address: " + requester + ":" + sourcePort
+ " discovery responseTemplate2 is <<<" + discoveryResponse + ">>>");
sendUDPResponse(discoveryResponse.getBytes(), requester, sourcePort);
try {
@@ -299,35 +357,67 @@ public class UpnpListener {
if (traceupnp) {
log.info("Traceupnp: send upnp discovery template 3 with response address: " + httpLocationAddress + ":"
+ httpServerPort + " to address: " + requester + ":" + sourcePort);
} else
log.debug("sendUpnpResponse to address: " + requester + ":" + sourcePort
+ " discovery responseTemplate3 is <<<" + discoveryResponse + ">>>");
}
log.debug("sendUpnpResponse to address: " + requester + ":" + sourcePort
+ " discovery responseTemplate3 is <<<" + discoveryResponse + ">>>");
sendUDPResponse(discoveryResponse.getBytes(), requester, sourcePort);
}
}
private void sendUDPResponse(byte[] udpMessage, InetAddress requester, int sourcePort) throws IOException {
log.debug("Sending response string: <<<" + new String(udpMessage) + ">>>");
if (upnpMulticastSocket == null)
throw new IOException("Socket not initialized");
DatagramPacket response = new DatagramPacket(udpMessage, udpMessage.length, requester, sourcePort);
upnpMulticastSocket.send(response);
if(upnpOriginal) {
theUDPDatagramSender.sendUDPResponse(udpMessage, requester, sourcePort);
} else {
if (upnpMulticastSocket == null)
throw new IOException("Socket not initialized");
DatagramPacket response = new DatagramPacket(udpMessage, udpMessage.length, requester, sourcePort);
upnpMulticastSocket.send(response);
}
}
protected void sendUpnpNotify(InetAddress aSocketAddress) {
protected void sendUpnpNotify(InetAddress aSocketAddress) throws IOException {
String notifyData = null;
notifyData = String.format(notifyTemplate, Configuration.UPNP_MULTICAST_ADDRESS,
Configuration.UPNP_DISCOVERY_PORT, upnpConfigIP, httpServerPort, bridgeId, bridgeSNUUID, bridgeSNUUID);
log.debug("sendUpnpNotify notifyTemplate is <<<" + notifyData + ">>>");
DatagramPacket notifyPacket = new DatagramPacket(notifyData.getBytes(), notifyData.length(), aSocketAddress,
Configuration.UPNP_DISCOVERY_PORT);
try {
upnpMulticastSocket.send(notifyPacket);
} catch (IOException e1) {
log.warn("UpnpListener encountered an error sending upnp notify packet. IP: "
+ notifyPacket.getAddress().getHostAddress() + " with message: " + e1.getMessage());
log.debug("UpnpListener send upnp notify exception: ", e1);
Thread.sleep(theUpnpSendDelay);
} catch (InterruptedException e) {
// noop
}
notifyData = String.format(notifyTemplate1, Configuration.UPNP_MULTICAST_ADDRESS,
Configuration.UPNP_DISCOVERY_PORT, upnpConfigIP, httpServerPort, bridgeId, bridgeSNUUID, bridgeSNUUID);
if (traceupnp) {
log.info("Traceupnp: sendUpnpNotify notifyTemplate1");
}
log.debug("sendUpnpNotify notifyTemplate1 is <<<{}>>>", notifyData);
sendUDPResponse(notifyData.getBytes(), aSocketAddress, Configuration.UPNP_DISCOVERY_PORT);
try {
Thread.sleep(theUpnpSendDelay);
} catch (InterruptedException e) {
// noop
}
notifyData = String.format(notifyTemplate2, Configuration.UPNP_MULTICAST_ADDRESS,
Configuration.UPNP_DISCOVERY_PORT, upnpConfigIP, httpServerPort, bridgeId, bridgeSNUUID);
if (traceupnp) {
log.info("Traceupnp: sendUpnpNotify notifyTemplate2");
}
log.debug("sendUpnpNotify notifyTemplate2 is <<<{}>>>", notifyData);
sendUDPResponse(notifyData.getBytes(), aSocketAddress, Configuration.UPNP_DISCOVERY_PORT);
try {
Thread.sleep(theUpnpSendDelay);
} catch (InterruptedException e) {
// noop
}
notifyData = String.format(notifyTemplate3, Configuration.UPNP_MULTICAST_ADDRESS,
Configuration.UPNP_DISCOVERY_PORT, upnpConfigIP, httpServerPort, bridgeId, bridgeSNUUID);
if (traceupnp) {
log.info("Traceupnp: sendUpnpNotify notifyTemplate3");
}
log.debug("sendUpnpNotify notifyTemplate3 is <<<{}>>>", notifyData);
sendUDPResponse(notifyData.getBytes(), aSocketAddress, Configuration.UPNP_DISCOVERY_PORT);
}
// added by https://github.com/pvint

View File

@@ -24,7 +24,7 @@ public class UpnpSettingsResource {
private BridgeSettingsDescriptor theSettings;
private BridgeSettings bridgeSettings;
private String hueTemplate = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
private String hueTemplate_pre = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
+ "<root xmlns=\"urn:schemas-upnp-org:device-1-0\">\n"
+ "<specVersion>\n"
+ "<major>1</major>\n"
@@ -41,8 +41,9 @@ public class UpnpSettingsResource {
+ "<modelNumber>" + HueConstants.MODEL_ID + "</modelNumber>\n"
+ "<modelURL>http://www.meethue.com</modelURL>\n"
+ "<serialNumber>%s</serialNumber>\n"
+ "<UDN>uuid:" + HueConstants.UUID_PREFIX + "%s</UDN>\n"
+ "<presentationURL>index.html</presentationURL>\n"
+ "<UDN>uuid:" + HueConstants.UUID_PREFIX + "%s</UDN>\n";
private String hueTemplate_post = "<presentationURL>index.html</presentationURL>\n"
+ "<iconList>\n"
+ "<icon>\n"
+ "<mimetype>image/png</mimetype>\n"
@@ -62,6 +63,17 @@ public class UpnpSettingsResource {
+ "</device>\n"
+ "</root>\n";
private String hueTemplate_mid_orig = "<serviceList>\n"
+ "<service>\n"
+ "<serviceType>(null)</serviceType>\n"
+ "<serviceId>(null)</serviceId>\n"
+ "<controlURL>(null)</controlURL>\n"
+ "<eventSubURL>(null)</eventSubURL>\n"
+ "<SCPDURL>(null)</SCPDURL>\n"
+ "</service>\n"
+ "</serviceList>\n";
public UpnpSettingsResource(BridgeSettings theBridgeSettings) {
super();
this.bridgeSettings = theBridgeSettings;
@@ -80,7 +92,16 @@ public class UpnpSettingsResource {
String portNumber = Integer.toString(request.port());
String filledTemplate = null;
String httpLocationAddr = getOutboundAddress(request.ip(), request.port()).getHostAddress();
String httpLocationAddr = null;
String hueTemplate = null;
if(theSettings.isUpnporiginal()) {
httpLocationAddr = theSettings.getUpnpConfigAddress();
hueTemplate = hueTemplate_pre + hueTemplate_mid_orig + hueTemplate_post;
} else {
httpLocationAddr = getOutboundAddress(request.ip(), request.port()).getHostAddress();
hueTemplate = hueTemplate_pre + hueTemplate_post;
}
String bridgeIdMac = HuePublicConfig.createConfig("temp", httpLocationAddr, HueConstants.HUB_VERSION, theSettings.getHubmac()).getSNUUIDFromMac();
filledTemplate = String.format(hueTemplate, httpLocationAddr, portNumber, httpLocationAddr, bridgeIdMac, bridgeIdMac);
if(theSettings.isTraceupnp())

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -17,7 +17,24 @@
<link href="css/strength-meter.min.css" rel="stylesheet">
<link href="css/colorpicker.min.css" rel="stylesheet">
<!--[if lt IE 9]>
<style id="compiled-css" type="text/css">
.goToTop
{
position: fixed;
width: 100px;
height: 40px;
bottom: 0;
right: 0;
z-index: 100000;
cursor: pointer;
margin: 10px;
-moz-opacity: 0.60;
opacity: .60;
filter: alpha(opacity=60);
}
</style>
<!--[if lt IE 9]>
<script type="text/javascript" src="js/html5shiv.min.js"></script>
<script type="text/javascript" src="js/respond.min.js"></script>
<![endif]-->
@@ -75,8 +92,12 @@
</div>
<span class="goToTop">
<button type="button" class="btn btn-light"><i class="glyphicon glyphicon-chevron-up"></i> Back to Top</button>
</span>
<!-- <input type="button" class="goToTop" value="Back to Top" style="display:none;background-color:blue" /> -->
<script src="js/jquery-1.11.3.min.js"></script>
<script src="js/jquery-1.11.3.min.js"></script>
<script src="js/angular.min.js"></script>
<script src="js/angular-route.min.js"></script>
<script src="js/angular-sanitize.min.js"></script>
@@ -93,5 +114,35 @@
<script src="js/ng-file-upload-shim.min.js"></script>
<script src="js/ng-file-upload.min.js"></script>
<script src="scripts/app.js"></script>
</body>
<script type="text/javascript">
$(window).load(function(){
$(window).scroll(function () {
if ($(this).scrollTop() > 100) {
$('.goToTop').fadeIn();
} else {
$('.goToTop').fadeOut();
}
});
$('.goToTop').click(function () {
$("html, body").animate({ scrollTop: 0 }, 1000);
return false;
});
});
</script>
<script>
// tell the embed parent frame the height of the content
if (window.parent && window.parent.parent){
window.parent.parent.postMessage(["resultsFrame", {
height: document.body.getBoundingClientRect().height,
slug: "fvdrw83s"
}], "*")
}
// always overwrite window.name, in case users try to set it manually
window.name = "result"
</script>
</body>
</html>

View File

@@ -366,12 +366,15 @@ app.service('bridgeService', function ($rootScope, $http, $base64, $location, ng
);
};
this.changeSecuritySettings = function (useLinkButton, secureHueApi, execGarden) {
this.changeSecuritySettings = function (useLinkButton, secureHueApi, execGarden, useHttps, keyfilePath, keyfilePassword) {
var newSecurityInfo = {};
newSecurityInfo = {
useLinkButton: useLinkButton,
secureHueApi: secureHueApi,
execGarden: execGarden
execGarden: execGarden,
useHttps: useHttps,
keyfilePath: keyfilePath,
keyfilePassword: keyfilePassword
};
return $http.post(this.state.systemsbase + "/changesecurityinfo", newSecurityInfo).then(
function (response) {
@@ -2071,12 +2074,39 @@ app.controller('SystemController', function ($scope, $location, bridgeService, n
}
};
$scope.addHomeGenietoSettings = function (newhomegeniename, newhomegenieip, newhomegenieport, newhomegenieusername, newhomegeniepassword, newhomegeniewebhook, newhomegeniesecure) {
$scope.addHomeGenietoSettings = function (newhomegeniename, newhomegenieip, newhomegenieport, newhomegenieusername, newhomegeniepassword, newhomegeniewebhook, newhomegeniesecure, newhomegenieothertypes) {
if ($scope.bridge.settings.homegenieaddress === undefined || $scope.bridge.settings.homegenieaddress === null) {
$scope.bridge.settings.homegenieaddress = {
devices: []
};
}
var othertypes = [];
othertypes = newhomegenieothertypes.split(",");
var theModuleTypes = [];
var count = 0;
if (othertypes.length > 0) {
for (var i = 0; i < othertypes.length; i++) {
var aType = othertypes[i].trim();
if (aType.length > 0) {
var moduleType = {
moduleType: aType
};
theModuleTypes.push(moduleType);
count++;
}
}
}
var theExtension;
if (count == 0) {
theExtension = undefined;
} else {
theExtension = {
moduleTypes: theModuleTypes
}
}
var newhomegenie = {
name: newhomegeniename,
ip: newhomegenieip,
@@ -2084,16 +2114,61 @@ app.controller('SystemController', function ($scope, $location, bridgeService, n
username: newhomegenieusername,
password: newhomegeniepassword,
secure: newhomegeniesecure,
webhook: newhomegeniewebhook
webhook: newhomegeniewebhook,
extensions: theExtension
};
$scope.bridge.settings.homegenieaddress.devices.push(newhomegenie);
$scope.newhomegeniename = null;
$scope.newhomegenieip = null;
$scope.newhomegenieport = "8080";
$scope.newhomegenieport = null;
$scope.newhomegenieusername = null;
$scope.newhomegeniepassword = null;
$scope.newhomegeniewebhook = null;
$scope.newhomegenieextensions = null;
};
$scope.updateModuleTypes = function (theIndex, homegenieExtensions) {
var othertypes = [];
if(homegenieExtensions != undefined)
othertypes = homegenieExtensions.split(",");
var theModuleTypes = [];
var count = 0;
if (othertypes.length > 0) {
for (var x = 0; x < othertypes.length; x++) {
var aType = othertypes[x].trim();
if (aType.length > 0) {
var moduleType = {
moduleType: aType
};
theModuleTypes.push(moduleType);
count++;
}
}
}
var theExtension;
if (count == 0) {
theExtension = undefined;
} else {
theExtension = {
moduleTypes: theModuleTypes
}
}
$scope.bridge.settings.homegenieaddress.devices[theIndex].extensions = theExtension;
};
$scope.convertModuleTypes = function (theIndex) {
var displayExtension = "";
if ($scope.bridge.settings.homegenieaddress.devices[theIndex].extensions != undefined && $scope.bridge.settings.homegenieaddress.devices[theIndex].extensions.moduleTypes != undefined) {
for (var i = 0; i < $scope.bridge.settings.homegenieaddress.devices[theIndex].extensions.moduleTypes.length; i++) {
displayExtension = displayExtension + $scope.bridge.settings.homegenieaddress.devices[theIndex].extensions.moduleTypes[i].moduleType;
}
}
return displayExtension;
};
$scope.removeHomeGenietoSettings = function (homegeniename, homegenieip) {
for (var i = $scope.bridge.settings.homegenieaddress.devices.length - 1; i >= 0; i--) {
if ($scope.bridge.settings.homegenieaddress.devices[i].name === homegeniename && $scope.bridge.settings.homegenieaddress.devices[i].ip === homegenieip) {
@@ -2215,13 +2290,17 @@ app.controller('SecurityDialogCtrl', function ($scope, bridgeService, ngDialog)
$scope.useLinkButton = bridgeService.state.securityInfo.useLinkButton;
$scope.execGarden = bridgeService.state.securityInfo.execGarden;
$scope.isSecure = bridgeService.state.securityInfo.isSecure;
$scope.useHttps = bridgeService.state.securityInfo.useHttps;
$scope.keyfilePath = bridgeService.state.securityInfo.keyfilePath;
$scope.keyfilePassword = bridgeService.state.securityInfo.keyfilePassword;
$scope.matched = false;
$scope.addingUser = false;
$scope.showPassword = $scope.isSecure;
$scope.firstTime = true;
$scope.setSecurityInfo = function () {
bridgeService.changeSecuritySettings($scope.useLinkButton, $scope.secureHueApi, $scope.execGarden);
bridgeService.changeSecuritySettings($scope.useLinkButton, $scope.secureHueApi, $scope.execGarden, $scope.useHttps, $scope.keyfilePath, $scope.keyfilePassword);
};
$scope.changePassword = function (password, password2) {
@@ -2409,7 +2488,7 @@ app.controller('ViewingController', function ($scope, $location, bridgeService,
bridgeService.editDevice(device);
$location.path('/editdevice');
};
$scope.setStartupAction = function(device) {
$scope.setStartupAction = function (device) {
$scope.bridge.device = device;
ngDialog.open({
template: 'startupActionDialog',
@@ -2426,7 +2505,7 @@ app.controller('ViewingController', function ($scope, $location, bridgeService,
};
$scope.toggleLock = function (device) {
if(device.lockDeviceId) {
if (device.lockDeviceId) {
device.lockDeviceId = false;
} else {
device.lockDeviceId = true;
@@ -2567,9 +2646,9 @@ app.controller('StartupActionDialogCtrl', function ($scope, bridgeService, ngDia
$scope.device = $scope.bridge.device;
$scope.setDim = false;
var components = [];
if($scope.device.startupActions != undefined) {
if ($scope.device.startupActions != undefined) {
components = $scope.device.startupActions.split(":");
if(components[1] != undefined && components[1].length > 0)
if (components[1] != undefined && components[1].length > 0)
$scope.setDim = true;
} else {
components = "::".split(":");
@@ -2593,12 +2672,12 @@ app.controller('StartupActionDialogCtrl', function ($scope, bridgeService, ngDia
console.log("Startup action set for device called: " + device.name);
ngDialog.close('ngdialog1');
var theValue = 1;
if($scope.setDim) {
if ($scope.setDim) {
theValue = $scope.theState + ":" + $scope.slider.value + ":" + $scope.rgbPicker.color;
} else {
theValue = $scope.theState + "::" + $scope.rgbPicker.color;
}
if(theValue == "::")
if (theValue == "::")
theValue = "";
device.startupActions = theValue;
bridgeService.addDevice(device).then(
@@ -3595,7 +3674,7 @@ app.controller('HassController', function ($scope, $location, bridgeService, ngD
dimpayload = "{\"entityId\":\"" + hassdevice.deviceState.entity_id + "\",\"hassName\":\"" + hassdevice.hassname + "\",\"state\":\"on\"}";
offpayload = "{\"entityId\":\"" + hassdevice.deviceState.entity_id + "\",\"hassName\":\"" + hassdevice.hassname + "\",\"state\":\"off\"}";
bridgeService.buildUrls(onpayload, dimpayload, offpayload, null, true, hassdevice.hassname + "-" + hassdevice.deviceState.entity_id, hassdevice.deviceState.entity_id, hassdevice.hassname, hassdevice.domain, "hassDevice", null, null);
bridgeService.buildUrls(onpayload, dimpayload, offpayload, null, true, hassdevice.hassname + "-" + hassdevice.deviceState.entity_id, hassdevice.deviceState.entity_id, hassdevice.hassname, "switch", "hassDevice", null, null);
$scope.device = bridgeService.state.device;
if (!buildonly) {
bridgeService.editNewDevice($scope.device);
@@ -3725,7 +3804,7 @@ app.controller('HomeWizardController', function ($scope, $location, bridgeServic
onpayload = "{\"deviceid\":\"" + homewizarddevice.id + "\",\"action\":\"on\"}";
offpayload = "{\"deviceid\":\"" + homewizarddevice.id + "\",\"action\":\"off\"}";
bridgeService.buildUrls(onpayload, dimpayload, offpayload, null, true, homewizarddevice.id, homewizarddevice.name, homewizarddevice.gateway, null, "homewizardDevice", null, null);
bridgeService.buildUrls(onpayload, dimpayload, offpayload, null, true, homewizarddevice.id, homewizarddevice.name, homewizarddevice.gateway, "switch", "homewizardDevice", null, null);
$scope.device = bridgeService.state.device;
if (!buildonly) {
@@ -4019,7 +4098,7 @@ app.controller('LifxController', function ($scope, $location, bridgeService, ngD
dimpayload = angular.toJson(lifxdevice);
onpayload = angular.toJson(lifxdevice);
offpayload = angular.toJson(lifxdevice);
bridgeService.buildUrls(onpayload, dimpayload, offpayload, null, true, lifxdevice.name, lifxdevice.name, lifxdevice.name, null, "lifxDevice", null, null);
bridgeService.buildUrls(onpayload, dimpayload, offpayload, null, true, lifxdevice.name, lifxdevice.name, lifxdevice.name, "switch", "lifxDevice", null, null);
$scope.device = bridgeService.state.device;
if (!buildonly) {
bridgeService.editNewDevice($scope.device);
@@ -4320,7 +4399,7 @@ app.controller('OpenHABController', function ($scope, $location, bridgeService,
else
colorpayload = null;
}
bridgeService.buildUrls(onpayload, dimpayload, offpayload, colorpayload, true, openhabdevice.item.name + "-" + openhabdevice.name, openhabdevice.item.name, openhabdevice.name, openhabdevice.item.type, "openhabDevice", null, null);
bridgeService.buildUrls(onpayload, dimpayload, offpayload, colorpayload, true, openhabdevice.item.name + "-" + openhabdevice.name, openhabdevice.item.name, openhabdevice.name, "switch", "openhabDevice", null, null);
$scope.device = bridgeService.state.device;
if (!buildonly) {
bridgeService.editNewDevice($scope.device);
@@ -4462,7 +4541,7 @@ app.controller('MozIotController', function ($scope, $location, bridgeService, n
else if (coloraction !== undefined && coloraction !== null && coloraction !== '')
colorpayload = "{\"url\":\"" + preCmd + "color\",\"command\":{\"color\":\"" + coloraction + "\"}}";
bridgeService.buildUrls(onpayload, dimpayload, offpayload, colorpayload, true, moziotdevice.deviceDetail.name + "-" + moziotdevice.deviceDetail.type, moziotdevice.deviceDetail.name, moziotdevice.gatewayName, "Switch", "moziotDevice", null, null);
bridgeService.buildUrls(onpayload, dimpayload, offpayload, colorpayload, true, moziotdevice.deviceDetail.title + "-" + moziotdevice.deviceDetail.type, moziotdevice.deviceDetail.title, moziotdevice.gatewayName, "switch", "moziotDevice", null, null);
$scope.device = bridgeService.state.device;
if (!buildonly) {
bridgeService.editNewDevice($scope.device);
@@ -4606,7 +4685,7 @@ app.controller('FhemController', function ($scope, $location, bridgeService, ngD
colorpayload = null;
onpayload = "{\"url\":\"http://" + fhemdevice.address + preCmd + "\",\"command\":\"on\"}";
offpayload = "{\"url\":\"http://" + fhemdevice.address + preCmd + "\",\"command\":\"off\"}";
bridgeService.buildUrls(onpayload, dimpayload, offpayload, colorpayload, true, fhemdevice.item.Name + "-" + fhemdevice.name, fhemdevice.item.Name, fhemdevice.name, fhemdevice.item.type, "fhemDevice", null, null);
bridgeService.buildUrls(onpayload, dimpayload, offpayload, colorpayload, true, fhemdevice.item.Name + "-" + fhemdevice.name, fhemdevice.item.Name, fhemdevice.name, "switch", "fhemDevice", null, null);
$scope.device = bridgeService.state.device;
if (!buildonly) {
bridgeService.editNewDevice($scope.device);
@@ -4765,7 +4844,7 @@ app.controller('BroadlinkController', function ($scope, $location, bridgeService
else
colorpayload = null;
}
bridgeService.buildUrls(onpayload, dimpayload, offpayload, colorpayload, true, broadlinkdevice.id, broadlinkdevice.name, broadlinkdevice.id, broadlinkdevice.desc, "broadlinkDevice", null, null);
bridgeService.buildUrls(onpayload, dimpayload, offpayload, colorpayload, true, broadlinkdevice.id, broadlinkdevice.name, broadlinkdevice.id, "switch", "broadlinkDevice", null, null);
$scope.device = bridgeService.state.device;
if (!buildonly) {
bridgeService.editNewDevice($scope.device);
@@ -4905,7 +4984,7 @@ app.controller('HomeGenieController', function ($scope, $location, bridgeService
// else if (coloraction !== undefined && coloraction !== null && coloraction !== '')
// colorpayload = "{\"url\":\"" + preCmd + "color\",\"command\":{\"color\":\"" + coloraction + "\"}}";
bridgeService.buildUrls(onpayload, dimpayload, offpayload, colorpayload, true, homegeniedevice.deviceDetail.Name + "-" + homegeniedevice.deviceDetail.DeviceType, homegeniedevice.deviceDetail.Name, homegeniedevice.gatewayName, homegeniedevice.deviceDetail.DeviceType, "homegenieDevice", null, null);
bridgeService.buildUrls(onpayload, dimpayload, offpayload, colorpayload, true, homegeniedevice.deviceDetail.Name + "-" + homegeniedevice.deviceDetail.DeviceType, homegeniedevice.deviceDetail.Name, homegeniedevice.gatewayName, "switch", "homegenieDevice", null, null);
$scope.device = bridgeService.state.device;
if (!buildonly) {
bridgeService.editNewDevice($scope.device);

View File

@@ -57,6 +57,7 @@
<option value="button">Button</option>
<option value="thermo">Thermo</option>
<option value="passthru">Pass Thru</option>
<option value="home">Home</option>
</select>
</div>
@@ -64,7 +65,6 @@
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>Row</th>
<th sortable-header col="id" comparator-fn="comparatorUniqueId">ID</th>
<th sortable-header col="name">Name</th>
<th sortable-header col="description">Description</th>
@@ -78,7 +78,6 @@
</thead>
<tr ng-repeat="device in bridge.devices | filterDevicesByRequester:bridge.state.filterDevicesByIpAddress:bridge.state.filterDevicesOnlyFiltered:bridge.state.filterDeviceType"
row-id="{{device.id}}" ng-class="{info: bridge.viewDevId == device.id}">
<td>{{$index+1}}</td>
<td title="Locked: {{device.lockDeviceId}} - Click to Toggle" ng-click="toggleLock(device)">
<b ng-if="device.lockDeviceId">{{device.id}}</b>
<p ng-if="!device.lockDeviceId">{{device.id}}</p>

View File

@@ -144,7 +144,8 @@
<option value="button">Button</option>
<option value="thermo">Thermo</option>
<option value="passthru">Pass Thru</option>
</select></td>
<option value="home">Home</option>
</select></td>
</tr>
<tr>
<td><label>Map Type (Legacy)</label></td>

View File

@@ -19,7 +19,7 @@
<li ng-if="bridge.showHomeWizard" role="presentation"><a href="#!/homewizarddevices">HomeWizard Devices</a></li>
<li ng-if="bridge.showOpenHAB" role="presentation"><a href="#!/openhabdevices">OpenHAB Devices</a></li>
<li ng-if="bridge.showFHEM" role="presentation"><a href="#!/fhemdevices">FHEM Devices</a></li>
<li ng-if="bridge.showMozIot" role="presentation"><a href="#!/homegeniedevices">HomeGenie Devices</a></li>
<li ng-if="bridge.showMozIot" role="presentation"><a href="#!/moziotdevices">Mozilla IOT Devices</a></li>
<li ng-if="bridge.showBroadlink" role="presentation"><a href="#!/broadlinkdevices">Broadlink Devices</a></li>
<li ng-if="bridge.showHomeGenie" role="presentation" class="active"><a href="#!/homegeniedevices">HomeGenie
Devices</a></li>
@@ -28,7 +28,7 @@
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">HomeGenie show Device List
<h2 class="panel-title">HomeGenie show device List
({{bridge.homegeniedevices.length}})</h2>
</div>
<div class="panel-body">
@@ -96,7 +96,7 @@
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">
Already Configured OpenHAB Devices <a ng-click="toggleButtons()"><span class={{imgButtonsUrl}}
Already Configured HomeGenie Devices <a ng-click="toggleButtons()"><span class={{imgButtonsUrl}}
aria-hidden="true"></span></a></a>
</h2>
</div>

View File

@@ -19,10 +19,9 @@
<li ng-if="bridge.showHomeWizard" role="presentation"><a href="#!/homewizarddevices">HomeWizard Devices</a></li>
<li ng-if="bridge.showOpenHAB" role="presentation"><a href="#!/openhabdevices">OpenHAB Devices</a></li>
<li ng-if="bridge.showFHEM" role="presentation"><a href="#!/fhemdevices">FHEM Devices</a></li>
<li ng-if="bridge.showHomeGenie" role="presentation"><a href="#!/homegeniedevices">HomeGenie Devices</a></li>
<li ng-if="bridge.showMozIot" role="presentation" class="active"><a href="#!/moziotdevices">Mozilla IOT Devices</a>
</li>
<li ng-if="bridge.showMozIot" role="presentation" class="active"><a href="#!/moziotdevices">Mozilla IOT Devices</a></li>
<li ng-if="bridge.showBroadlink" role="presentation"><a href="#!/broadlinkdevices">Broadlink Devices</a></li>
<li ng-if="bridge.showHomeGenie" role="presentation"><a href="#!/homegeniedevices">HomeGenie Devices</a></li>
<li role="presentation"><a href="#!/editdevice">Add/Edit</a></li>
</ul>
@@ -72,10 +71,10 @@
</thead>
<tr ng-repeat="moziotdevice in bridge.moziotdevices">
<td>{{$index+1}}</td>
<td><input type="checkbox" name="bulk.devices[]" value="{{moziotdevice.deviceDetail.name}}"
ng-checked="bulk.devices.indexOf(moziotdevice.deviceDetail.name) > -1"
ng-click="toggleSelection(moziotdevice.deviceDetail.name)">
{{moziotdevice.deviceDetail.name}}</td>
<td><input type="checkbox" name="bulk.devices[]" value="{{moziotdevice.deviceDetail.title}}"
ng-checked="bulk.devices.indexOf(moziotdevice.deviceDetail.title) > -1"
ng-click="toggleSelection(moziotdevice.deviceDetail.title)">
{{moziotdevice.deviceDetail.title}}</td>
<td>{{moziotdevice.deviceDetail.type}}</td>
<td>{{moziotdevice.gatewayName}}</td>
<td>
@@ -104,7 +103,7 @@
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">
Already Configured OpenHAB Devices <a ng-click="toggleButtons()"><span class={{imgButtonsUrl}}
Already Configured Mozilla IOT Devices <a ng-click="toggleButtons()"><span class={{imgButtonsUrl}}
aria-hidden="true"></span></a></a>
</h2>
</div>

View File

@@ -1,14 +1,34 @@
<div class="form-container ngdialog-message" ng-controller="SecurityDialogCtrl">
<form name="securityForm" role="form">
<legend class="form-label">Update Security Settings</legend>
<legend class="form-label">Update Security Settings</legend>
<div class="form-group">
<label>Use Link Button</label>
<input type="checkbox"
<label>Use HTTPS</label>
<input type="checkbox"
ng-model="useHttps" ng-true-value=true
ng-false-value=false /> {{useHttps}}
<div>
<label>Keyfile Path</label>
<input id="keyfilePath" name="keyfilePath" class="form-control"
type="text" ng-model="keyfilePath" placeholder="the keyfile path"/>
<label>Keyfile Password</label>
<input id="keyfilePassword" name="keyfilePassword" class="form-control" type="password" ng-model="keyfilePassword"/>
</div>
</div>
<div class="form-group">
<label>Use Link Button</label>
<input type="checkbox"
ng-model="useLinkButton" ng-true-value=true
ng-false-value=false /> {{useLinkButton}}
</div>
<div class="form-group">
<div class="form-group">
<label>Exec Garden</label>
<input id="execGarden" name="execGarden" class="form-control"
type="text" ng-model="execGarden" placeholder="execGarden path"/>
</div>
<div class="form-group">
<label>Use username/password for HUE Api</label>
<input type="checkbox"
ng-model="secureHueApi" ng-true-value=true

View File

@@ -699,7 +699,7 @@
<td><input type="checkbox" ng-model="newmoziotsecure" ng-true-value=true
ng-false-value=false></td>
<td><button class="btn btn-success" type="submit"
ng-click="addMozIottoSettings(newmoziotname, newmoziotip, newmoziotport, newsmoziotusername, newmoziotpassword, newmoziotwebhook, newmoziotsecure)">Add</button>
ng-click="addMozIottoSettings(newmoziotname, newmoziotip, newmoziotport, newmoziotusername, newmoziotpassword, newmoziotwebhook, newmoziotsecure)">Add</button>
</td>
</tr>
</table>
@@ -716,6 +716,7 @@
<th>Port (opt)</th>
<th>Username (opt)</th>
<th>Password (opt)</th>
<th>Other Types (opt)</th>
<th>Use SSL</th>
<th>Manage</th>
</tr>
@@ -732,6 +733,11 @@
<td><input id="bridge-settings-next-homegenie-password" class="form-control"
type="password" ng-model="homegenie.password" placeholder="HomeGenie password">
</td>
<td>Currently: {{ convertModuleTypes($index) }}
<input id="bridge-settings-next-homegenie-othertypes" class="form-control" type="text"
ng-model="anExtensions" placeholder="type1, type2, type3">
<button class="btn btn-success" type="submit" ng-click="updateModuleTypes($index, anExtensions)">Update</button>
</td>
<td><input type="checkbox" ng-model="homegenie.secure" ng-true-value=true
ng-false-value=false></td>
<td><button class="btn btn-danger" type="submit"
@@ -750,10 +756,12 @@
<td><input id="bridge-settings-new-homegenie-password" class="form-control"
type="password" ng-model="newhomegeniepassword"
placeholder="HomeGenie password "></td>
<td><input id="bridge-settings-new-homegenie-othertypes" class="form-control" type="text"
ng-model="newhomegenieothertypes" placeholder="type1, type2, type3"></td>
<td><input type="checkbox" ng-model="newhomegeniesecure" ng-true-value=true
ng-false-value=false></td>
<td><button class="btn btn-success" type="submit"
ng-click="addHomeGenietoSettings(newhomegeniename, newhomegenieip, newhomegenieport, newshomegenieusername, newhomegeniepassword, newhomegeniewebhook, newhomegeniesecure)">Add</button>
ng-click="addHomeGenietoSettings(newhomegeniename, newhomegenieip, newhomegenieport, newshomegenieusername, newhomegeniepassword, newhomegeniewebhook, newhomegeniesecure, newhomegenieothertypes)">Add</button>
</td>
</tr>
</table>