Control Domoticz using Harmony Hub and HA Bridge

Client tools or tools that can connect with Domoticz. Tools for Windows, iOS, Android, Linux etc.
Cornholio1234
Posts: 24
Joined: Thursday 03 March 2016 12:01
Target OS: Windows
Domoticz version: V3.4964
Location: Germany
Contact:

Control Domoticz using Harmony Hub and HA Bridge

Postby Cornholio1234 » Thursday 17 March 2016 10:47

Hi all,

I don't know if anyone else posted this but I did not find anything about it. So maybe it will help someone - otherwise feel free to blame me ;-).

I wanted to switch and dim my z-wave and 433mhz switches using my harmony ultimate remote. Unfortunately it is not possible to make the harmony just send stupid http get commands (thanks logitech). Searching the net I found a great project called HA Bridge (little java web server) which will simulate beeing a HUE Bridge and can be connected to the harmony hub.

https://github.com/bwssytems/ha-bridge/

The nice thing is that in the HA Bridge you can create artifical devices which will be recognized by the harmony hub and be shown in the remote. The devices in the HA bridge have got On and Off commands raising my domoticz json api. Even dimming works! :D I had to remove my real HUE bridge from the harmony hub, because only one bridge can be connected. But that is not a real issue because I can still control my HUE lights over
Harmony -> HA Bridge -> Domoticz -> Hue Bridge ...

So if you do not mind have another server software running this might be worth a try (I am not involved in HA Bridge project in any way, just wanted to share my experience).
Windows Server, Aeotec Z-Stick Gen5, V3.4964

Nautilus
Posts: 319
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: Control Domoticz using Harmony Hub and HA Bridge

Postby Nautilus » Thursday 17 March 2016 15:44

Hi,

this is extremely interesting - I have been struggling with the same dilemma and have currently "solved" it with Flirc IR-receiver and Triggerhappy (thd) daemon (Flirc can be taught to recognize IR signals and map them to specific button combinations, then I've mapped the button combinations to HTTP GET requests via Triggerhappy, in Harmony I've used a dummy devices to have extra IR signals). But this way adding new stuff is quite time consuming and I'm not entirely happy of what I need to go through to add just one new command. Therefore HA-bridge -method sounds very intriguing :)

Care to share some details on how to get started? Just download the latest release from Github, drop it somewhere appropriate in RPi and run with java -jar ha-bridge-W.X.Y.jar (will this start the server in "background")? Is there some configuration needed to be done beforehand, e.g.
The easy way to get devices configures is with the web interface by going to the url for the host you are running on or localhost with port you have assigned
-> where to assign this?

Once running, go to the web interface and do something to enable the HUE bridge and add some devices / scenes whatever. And finally add HUE to Harmony in order to use the "HUE devices"? Something along these lines? :D

Cornholio1234
Posts: 24
Joined: Thursday 03 March 2016 12:01
Target OS: Windows
Domoticz version: V3.4964
Location: Germany
Contact:

Re: Control Domoticz using Harmony Hub and HA Bridge

Postby Cornholio1234 » Thursday 17 March 2016 20:34

Hi Nautilus,

I'll try to give some more instructions... :-).

After starting the jar file (if you run java from console, you will get output - if you just click the jar it will run in the background) the server will run without any configuration necessary. On console it will tell you the default listening port. I am quite sure default was pointing to your IP and port 8080 (so make sure it is not interfering with domoticz - disable domoticz first if it uses the same address...)

When you are able to access the HA bridge setup is quite straightforward. Go to the bridge control tab and change the IP and port if necessary. I think you will not need to setup the harmony fields, because you do not want to trigger harmony events but create artifical devices. Therefore open the manual tab. Just enter a name and on and off urls from the domoticz api. Those devices should be listed under the bridge devices tab.

example:

Name: Office Light
On: http://192.168.1.10:8080/json.htm?type= ... el&level=$ {intensity.percent}
Off: http://192.168.1.10:8080/json.htm?type= ... tchcmd=Off

Last step: Map the harmony with your "virtual hue" - to do so open MyHarmony, navigate to devices -> home control and add a philips hue device.
My HA Bridge appeared automatically after some seconds. No need to press a "connect button" - HA bridge will accept just everything. After mapping is done all your artifical devices are getting imported (and hopefully up to date with new devices in HA bridge added afterwards).

Hope if helps, let me know if it worked for you too ;-)
Windows Server, Aeotec Z-Stick Gen5, V3.4964

Nautilus
Posts: 319
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: Control Domoticz using Harmony Hub and HA Bridge

Postby Nautilus » Thursday 17 March 2016 23:19

Thanks a lot - this got me going :) I have HA bridge now running on a RPi2 and I've created the first couple of devices as well as linked the bridge to Harmony hub as Hue. The next issue seems to be that I cannot figure out how to include the new "HUE" devices to Harmony activities, can only access them via the devices menu. Is there no way to add them to activities?

By the way, have you managed to run the .jar file automatic at boot?

edit. one additional question still. Do you know if the HA bridge can be used to register a HUE account to create scenes as such (i.e. does it fool also the actual HUE account, not just Harmony)?

Cornholio1234
Posts: 24
Joined: Thursday 03 March 2016 12:01
Target OS: Windows
Domoticz version: V3.4964
Location: Germany
Contact:

Re: Control Domoticz using Harmony Hub and HA Bridge

Postby Cornholio1234 » Friday 18 March 2016 11:56

Hi again,

nice that it works for you. I did not try to use them in activities so far - I'll give it a try when I find some time (or just handle all your activities in one central place - domoticz ;-))
I am running on windows - therefore autostart is easy but just putting it in a task or a shortcut to the jar to the autostart folder...

I'd assume that the HA bridge is not supporting scenes right now - the readme tells you
"scenes object A collection of all scenes and their attributes. This is empty."
But again - handle it with domoticz, just create the scene there and trigger it using a device in HA bridge.

Most annoying for me is that the HA bridge is not storing the switched values - they will show up as disabled after a few seconds in the harmony remote :-(. I asked the developer for a fix and he is working on it. Additionally he may develop an api-call allowing to set the value (therefore if I change the state in domoticz it is updating the value in the HA bridge and reflecting it on the harmony remote.
Windows Server, Aeotec Z-Stick Gen5, V3.4964

Nautilus
Posts: 319
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: Control Domoticz using Harmony Hub and HA Bridge

Postby Nautilus » Friday 18 March 2016 20:32

Cornholio1234 wrote:Hi again,

nice that it works for you. I did not try to use them in activities so far - I'll give it a try when I find some time (or just handle all your activities in one central place - domoticz ;-))
I am running on windows - therefore autostart is easy but just putting it in a task or a shortcut to the jar to the autostart folder...

I'd assume that the HA bridge is not supporting scenes right now - the readme tells you
"scenes object A collection of all scenes and their attributes. This is empty."
But again - handle it with domoticz, just create the scene there and trigger it using a device in HA bridge.

Most annoying for me is that the HA bridge is not storing the switched values - they will show up as disabled after a few seconds in the harmony remote :-(. I asked the developer for a fix and he is working on it. Additionally he may develop an api-call allowing to set the value (therefore if I change the state in domoticz it is updating the value in the HA bridge and reflecting it on the harmony remote.


Thanks for the answers :) Yes, I could do all controlling from Domoticz but then what would be the point of the Harmony remote anymore ;) I like the old fashioned remote for certain controlling needs and thus it would be convenient to have the commands available in the activities. After some digging it seems that only the new Elite (with dedicated home control buttons) currently allows adding these to activities (maybe in a later update also other remotes will allow it). Although it is possible to add them to start or stop sequence of the activity.

By the way, the device I created allows dimming, but cannot see that it would allow setting the color. Is this somehow possible? Well, of course with separate devices but from a single device? Then this would work nicely for controlling e.g. MiLight & similar from Harmony.

Cornholio1234
Posts: 24
Joined: Thursday 03 March 2016 12:01
Target OS: Windows
Domoticz version: V3.4964
Location: Germany
Contact:

Re: Control Domoticz using Harmony Hub and HA Bridge

Postby Cornholio1234 » Saturday 19 March 2016 11:14

You can add the lights to activities using the IPhone app - the windows one seems to be too stupid. AFAIK there is no way to change the color (maybe you can do some dirty hacking using 3 virtual devices in domoticz representing the RBG colors, adding 3 devices to HA bridge for each color, then map the dim level to the color code and use some lua/php to set your color.... or much easier - just create a scene mapped to a HA device to select your color and then switch color by theme and brightness by lamp /group (you can create light groups in the harmony to dim/switch them together).
In my opinion the activitiy <-> scene link is most convenient and easy.

Point Harmony and Domoticz switching - my living room light is controlled by wall switch and harmony and i'd like to have the correct state represented everywhere. Furthermore I've got a "disable everything" scene going to bed ... having the logitech remote knowing the right status is mainly nice to have so I do not need to press the button twice if its on the wrong state. ;-)

FYI: There is a update saving the light state - http://www.bwssystems.com/files/ha-bridge-1.4.1d.jar
Windows Server, Aeotec Z-Stick Gen5, V3.4964

asmithdub
Posts: 27
Joined: Monday 30 September 2013 22:07
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Control Domoticz using Harmony Hub and HA Bridge

Postby asmithdub » Wednesday 06 April 2016 14:35

Good find!

I can't seem to figure out how to install this on my Pi.
Any pointers?

fryfly
Posts: 1
Joined: Tuesday 26 January 2016 14:27
Target OS: -
Domoticz version:
Contact:

Re: Control Domoticz using Harmony Hub and HA Bridge

Postby fryfly » Thursday 05 May 2016 15:25

Everything set up and it is working with version 1.4.3
How do I have to make a switch in the 2.0.x version of habridge.

Cornholio1234
Posts: 24
Joined: Thursday 03 March 2016 12:01
Target OS: Windows
Domoticz version: V3.4964
Location: Germany
Contact:

Re: Control Domoticz using Harmony Hub and HA Bridge

Postby Cornholio1234 » Friday 13 May 2016 10:21

hmm... by pressing the quite large "manual add" button in the 2nd navigation row?
Windows Server, Aeotec Z-Stick Gen5, V3.4964

jklflipper
Posts: 6
Joined: Tuesday 22 April 2014 23:43
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: RE: Re: Control Domoticz using Harmony Hub and HA Bridge

Postby jklflipper » Saturday 14 May 2016 19:27

Last edited by jklflipper on Saturday 14 May 2016 19:27, edited 1 time in total.

jklflipper
Posts: 6
Joined: Tuesday 22 April 2014 23:43
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: RE: Re: Control Domoticz using Harmony Hub and HA Bridge

Postby jklflipper » Saturday 14 May 2016 19:27

Last edited by jklflipper on Saturday 14 May 2016 19:27, edited 1 time in total.

jklflipper
Posts: 6
Joined: Tuesday 22 April 2014 23:43
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: RE: Re: Control Domoticz using Harmony Hub and HA Bridge

Postby jklflipper » Saturday 14 May 2016 19:27

Last edited by jklflipper on Saturday 14 May 2016 19:27, edited 1 time in total.

User avatar
remb0
Posts: 727
Joined: Thursday 11 July 2013 22:21
Target OS: Raspberry Pi
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: Control Domoticz using Harmony Hub and HA Bridge

Postby remb0 » Friday 27 May 2016 13:42

Can somebody add a nice instruction to the wiki (same username and password)

User avatar
Arkie
Posts: 90
Joined: Tuesday 03 December 2013 16:24
Target OS: NAS (Synology & others)
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Control Domoticz using Harmony Hub and HA Bridge

Postby Arkie » Wednesday 08 June 2016 20:40

On synology use:

docker run -d --name="Home-Automation-Bridge" --restart="always" --net="host" -e SERVERIP="192.168.*.*" -e SERVERPORT="****" -v [email protected]/HA-Bridge/:/config:rw -v /etc/localtime:/etc/localtime:ro aptalca/home-automation-bridge

(included : --restart="always" ) or else docker will make it a bridge network instead of a host network at reboot!!!
Synology DS412+ DSM 6.0.2-8451 update2(Domoticz 3.05753-7)
LightwaveRF dimmers
kaku switches/dimmers
Fibaro switches
Logitech Hamony elite
Foscam 9804 ip cam
RFXtrx433E USB 433.92MHz
ZXT 120 eu AC controller
Heatmiser NEO stat thermostats and Hub

jklflipper
Posts: 6
Joined: Tuesday 22 April 2014 23:43
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Control Domoticz using Harmony Hub and HA Bridge

Postby jklflipper » Saturday 11 June 2016 12:46

Install Java8:

sudo apt-get install oracle-java8-jdk

Select versie:

sudo update alternatives --config java

Download the Binary tar.gz version the maven website. Pick the latest version.
wget http://www.mirrorservice.org/sites/ftp. ... bin.tar.gz
Extract the archive to:

cd /opt
sudo tar -xzvf /home/pi/apache-maven-3.2.5-bin.tar.gz

Tell you shell where to find maven. We’ll do this in the system profile settings so it is available to all users.

sudoedit /etc/profile.d/maven.sh

and enter

export M2_HOME=/opt/apache-maven-3.2.5
export PATH=$PATH:$M2_HOME/bin
Quit and save from the editor.

Log out and back into the Raspberry Pi so the profile script takes effect and there it is. You can test that it is working with

mvn -version

and you should see something like:

Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T17:29:23+00:00)
Maven home: /opt/apache-maven-3.2.5
Java version: 1.8.0, vendor: Oracle Corporation
Java home: /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/jre
Default locale: en_GB, platform encoding: UTF-8
OS name: "linux", version: "3.12.26-rt40+", arch: "arm", family: "unix"

Basic script setup to run the bridge on a pi.

Create the directory and make sure that ha-bridge-2.0.6.jar is in your /home/pi/habridge directory.

[email protected]:~ $ mkdir habridge
[email protected]:~ $ cd habridge
[email protected]:~/habridge $ wget https://github.com/bwssytems/ha-bridge/ ... -2.0.6.jar

Edit the shell script for starting:

[email protected]:~/habridge $ nano starthabridge.sh
Then cut and past this, modify any locations that are not correct:

cd /home/pi/habridge
rm /home/pi/habridge/habridge-log.txt
nohup java -jar /home/pi/habridge/ha-bridge-2.0.6.jar > /home/pi/habridge/habridge-log.txt 2>&1 &
chmod 777 /home/pi/habridge/habridge-log.txt

Exit and save the file with ctrl-X and follow the prompts and then execute on the command line:

[email protected]:~/habridge $ chmod u+x starthabridge.sh
Then execute the script:

[email protected]:~/habridge $ ./starthabridge.sh

You should now be running the bridge. Check for errors:

[email protected]:~/habridge $ tail -f habridge-log.txt


Go in your webbrowser to: 192.168.x.x.:8080
Than to Bridge Control

Fill in info about your Logitech Harmony:
Name: Harmony
IP: 192.168.x.x.
Click add

Harmony Username: your account username
Harmony Password: your account password

Click "save" upper left corner.

Go to "Manual Add"

Fill in a name: Woonkamerlamp
On Url: http://Domoticz IP:Domoticz port/json.htm?type=command&param=switchlight&idx=378&switchcmd=On
Off Url: http://Domoticz IP:Domoticz port/json.htm?type=command&param=switchlight&idx=378&switchcmd=Off

Grep your Harmony. Go to: "Harmony setup" and add new device. Add Home Control. Click Philips Hue. No need to fill in username and password.
Import? Yes. Now you will see the "woonkamerlamp"

Autostart at reboot:
crontab -e

@reboot /home/pi/habridge/starthabridge.sh

ronyrony
Posts: 1
Joined: Sunday 26 June 2016 9:08
Target OS: Linux
Domoticz version:
Contact:

Re: Control Domoticz using Harmony Hub and HA Bridge

Postby ronyrony » Sunday 26 June 2016 9:10

hello.... I totally agree with the first comment about that...
Graduated from Soran University with First Class Degree with Honours in Computer Science.

sincze
Posts: 521
Joined: Monday 02 June 2014 22:46
Target OS: Linux
Domoticz version: 3.6179
Location: Netherlands
Contact:

Re: Control Domoticz using Harmony Hub and HA Bridge

Postby sincze » Sunday 26 June 2016 12:42

Excellent :D

On my Cubietruck running debian I had to do the following to install JAVA:

source: http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html

Code: Select all

su -
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
apt-get update
apt-get install oracle-java8-installer
exit


After stopping domoticz I checked if something was still running port :8080

Code: Select all

sudo netstat -ltnp | grep ':8080'


And yes there was. I will prevent the .jar file from running:

Code: Select all

tcp6       0      0 :::8080                 :::*                    LISTEN      626/nc


Issue a kill command solves the issue:

Code: Select all

root:~# sudo kill -9 626


After that just start the .jar file and reconfigure it to a different port so you can restart domoticz again.

Personally I use monit to monitor my services, so I added ha-bridge using a wrapper file in the config.
ha-bridge.JPG
Monit Monitoring
ha-bridge.JPG (15.96 KiB) Viewed 5317 times


https://mmonit.com/wiki/Monit/FAQ

I added the following bash script in the same directory as my jar file, this will allow to start the java file with the correct settings from the data in device.db and habridge.config

Don't forget to make it executable

Code: Select all

chmod +x ha-bridge.sh


AFTER saving.

ha-bridge.sh

Code: Select all

 #!/bin/bash
 export JAVA_HOME=/usr/local/java/

 case $1 in
    start)
       echo $$ > /var/run/ha-bridge.pid;
##       exec 2>&1 java -cp /home/domoticz/ha-bridge/ha-bridge-2.0.7.jar 1>/var/log/ha-bridge.out
       exec 2>&1 java -jar /home/domoticz/ha-bridge/ha-bridge-2.0.7.jar 1>/var/log/ha-bridge.out
       ;;
     stop)
       kill `cat /var/run/ha-bridge.pid` ;;
     *)
       echo "usage: ha-bridge {start|stop}" ;;
 esac
 exit 0


And added a monit monitoring file in the /etc/monit/conf.d directory

Code: Select all

check process ha-bridge with pidfile /var/run/ha-bridge.pid
start = "/bin/bash /home/domoticz/ha-bridge/ha-bridge.sh start"
stop = "/bin/bash /home/domoticz/ha-bridge/ha-bridge.sh stop"

User avatar
anandus
Posts: 15
Joined: Sunday 14 December 2014 17:28
Target OS: Linux
Domoticz version:
Contact:

Re: Control Domoticz using Harmony Hub and HA Bridge

Postby anandus » Monday 04 July 2016 14:17

Hmm.. I've installed it on my Rpi and it only works partially.
My Harmony Activities and Devices are visible in HA Bridge, but when I want to add the HA Bridge in my Harmony (harmony app->setup->devices->add device->Home control->Philips Hue) it wants me to "press the center button" of my hue.

What do I do now? In this topic I read it just goes through, but with me it doesn't. What did I miss?

Edit:
the log:

Code: Select all

07-04-2016 14:19:33.497   INFO   HA Bridge (v2.0.6) starting....   com.bwssystems.HABridge.HABridge
07-04-2016 14:19:33.652   INFO   reading from config file: data/habridge.config   com.bwssystems.HABridge.BridgeSettings
07-04-2016 14:19:34.209   INFO   HA Bridge (v2.0.6) initializing....   com.bwssystems.HABridge.HABridge
07-04-2016 14:19:34.333   INFO   System control service started....   com.bwssystems.HABridge.SystemControl
07-04-2016 14:19:48.523   INFO   == Spark has ignited ...   spark.webserver.JettySparkServer
07-04-2016 14:19:48.543   INFO   >> Listening on 0.0.0.0:8181   spark.webserver.JettySparkServer
07-04-2016 14:19:51.062   INFO   setup initiated ....   com.bwssystems.harmony.HarmonyServer
07-04-2016 14:19:58.665   INFO   activity changed: [-1] PowerOff   com.bwssystems.harmony.HarmonyServer
07-04-2016 14:19:58.740   INFO   HABridge device management service started....   com.bwssystems.HABridge.devicemanagmeent.DeviceResource
07-04-2016 14:19:59.546   INFO   Hue emulator service started....   com.bwssystems.HABridge.hue.HueMulator
07-04-2016 14:19:59.584   INFO   Hue description service started....   com.bwssystems.HABridge.upnp.UpnpSettingsResource
07-04-2016 14:19:59.593   INFO   UPNP Discovery Listener starting....   com.bwssystems.HABridge.upnp.UpnpListener
07-04-2016 14:19:59.624   INFO   UPNP Discovery Listener running and ready....   com.bwssystems.HABridge.upnp.UpnpListener
Last edited by anandus on Monday 04 July 2016 14:22, edited 1 time in total.

sincze
Posts: 521
Joined: Monday 02 June 2014 22:46
Target OS: Linux
Domoticz version: 3.6179
Location: Netherlands
Contact:

Re: Control Domoticz using Harmony Hub and HA Bridge

Postby sincze » Monday 04 July 2016 14:19

A yes I had the same issue ;-)

I just waited for 10 seconds after that it automatically connected.


Return to “Third party and supplementary tools”

Who is online

Users browsing this forum: No registered users and 1 guest