bwssytems / ha-bridge

Home automation bridge that emulates a Philips Hue light system and can control other systems such as a Vera, Harmony Hub, Nest, MiLight bulbs or any other system that has an http/https/tcp/udp interface. This is a compact impl to run on small format computers. This is impl started from this project https://github.com/armzilla/amazon-echo-ha-bridge.
Apache License 2.0
1.45k stars 199 forks source link

Harmony add not working #214

Closed dmb0058 closed 8 years ago

dmb0058 commented 8 years ago

I add the name, IP address, user name and password for my Harmony Hub on the Bridge Control page, click "Add". The correct details appear in habridge.config:

"harmonyaddress":{"devices":[{"name":"Harmony Hub", "ip":"192.168.0.156"}]}, "harmonyuser":"aaa@bbb.com", "harmonypwd":"xxxxxxxx"

I then press "Save" and the bridge re-initialises. Sometimes everything disappears:

"harmonyconfigured":false

Other times only the device disappears:

"harmonyuser":"aaa@bbb.com","harmonypwd":"xxxxxxxxxx"

Nothing else ever changes in any of these cases - no activities, devices etc.

bwssytems commented 8 years ago

What version are you running and on what system(RPi, Windows, Mac)?

dmb0058 commented 8 years ago

Hi !

Sorry I should have said, it's 3.2.0 on a Pi.

All the best,

David

On 4 November 2016 at 13:51, BWS Systems notifications@github.com wrote:

What version are you running and on what system(RPi, Windows, Mac)?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bwssytems/ha-bridge/issues/214#issuecomment-258436231, or mute the thread https://github.com/notifications/unsubscribe-auth/AEdxQfd6eW1PJDx4mFtF5jCU3eixqko2ks5q6zhcgaJpZM4Ko2Pw .

bwssytems commented 8 years ago

Great, now how are you staring the ha-bridge on the Pi

dmb0058 commented 8 years ago

Hi,

I have Java 1.8 installed and am starting it from an init.d script with the command "nohup java -jar /data/echobridge/ha-bridge-3.2.0.jar 2>&1 &".

I've been using it successfully to link an Echo Dot to my x.10 devices by executing heyu commands on the Pi, but also have a Harmony Hub I'd like to link in.

David

On 4 November 2016 at 16:10, BWS Systems notifications@github.com wrote:

Great, now how are you staring the ha-bridge on the Pi

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bwssytems/ha-bridge/issues/214#issuecomment-258474899, or mute the thread https://github.com/notifications/unsubscribe-auth/AEdxQUTHey-n_dxhc3TMV7ZezL7EG5uDks5q61j9gaJpZM4Ko2Pw .

bwssytems commented 8 years ago

So, the question here is when you restart it does it have all the devices and other configuration? I am thinking this is running and the directory is not accessible. for the config and devices.

dmb0058 commented 8 years ago

Hi,

Yes, it has all the devices. As I mentioned in the first post, the harmony config details are written to the .config file when I press Add, but when the bridge reinitialises they are deleted again, sometimes completely, sometimes partially.

Cheers,

David

On 4 Nov 2016 18:16, "BWS Systems" notifications@github.com wrote:

So, the question here is when you restart it does it have all the devices and other configuration? I am thinking this is running and the directory is not accessible. for the config and devices.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bwssytems/ha-bridge/issues/214#issuecomment-258508470, or mute the thread https://github.com/notifications/unsubscribe-auth/AEdxQWC7YbHgKRAKMgJ_ogWJkirk9BmCks5q63ZjgaJpZM4Ko2Pw .

bwssytems commented 8 years ago

Ahhh, you need to hit save at the top.

dmb0058 commented 8 years ago

Hi,

Yes, that seems to write the Harmony name/IP address/username/password to the config file, and the file contents survive a reboot. However even when I can see the details in the config file on the Pi, the values are not visible on the "Bridge Control" page (the relevant fields are blank as if no Harmony exists). Hitting the "Bridge Reinitialise" button causes the details to be deleted from the config (I guess maybe this is what it's supposed to do).

When the Harmony details are present in the config file the web application looks the same - should I expect to see any new links or tabs ?

Also if I enter "http://192.168.0.104:8080/api/devices/harmony/activities" in a web browser I get {"message":"A Harmony is not available."} back - does this sound correct ? I'd expect the bridge to use the Harmony details to interrogate the hub ...

Hope this helps,

David

On 4 November 2016 at 19:05, BWS Systems notifications@github.com wrote:

Ahhh, you need to hit save at the top.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bwssytems/ha-bridge/issues/214#issuecomment-258520911, or mute the thread https://github.com/notifications/unsubscribe-auth/AEdxQfbsukmxAXAz86cSqSEs_XL8tl5yks5q64HdgaJpZM4Ko2Pw .

bwssytems commented 8 years ago

Looks like you have a disconnect on where the ha-bridge is saving the data and it is not getting that info on start up. Please provide your startup configuration and how you start it and under what user.

dmb0058 commented 8 years ago

See earlier notes for startup mode and command as root.

On 5 Nov 2016 16:10, "BWS Systems" notifications@github.com wrote:

Looks like you have a disconnect on where the ha-bridge is saving the data and it is not getting that info on start up. Please provide your startup configuration and how you start it and under what user.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bwssytems/ha-bridge/issues/214#issuecomment-258621364, or mute the thread https://github.com/notifications/unsubscribe-auth/AEdxQWU9RPvm6mCigQLBvPZuk8jfrQn2ks5q7KpVgaJpZM4Ko2Pw .

dmb0058 commented 8 years ago

Hi,

I've installed all the files in /data/habridge on my Pi:

root@x10:/data/habridge# ls -l total 21000 drwxr-xr-x 2 root root 4096 Nov 6 15:07 backups -rw-r--r-- 1 root root 3095 Nov 2 08:05 device.db -rw-r--r-- 1 root root 7160181 Sep 1 17:14 ha-bridge-3.1.0.jar -rw-r--r-- 1 root root 7163557 Nov 2 08:40 ha-bridge-3.2.0.jar -rw-r--r-- 1 root root 7163751 Nov 2 21:35 ha-bridge-3.2.1.jar -rw------- 1 root root 667 Nov 6 14:56 habridge.config root@x10:/data/habridge#

I then tried to run the bridge as root with this script:

! /bin/sh

HABRIDGE_LOG=/var/log/heyu/ha-bridge.log HABRIDGE_DIR=/data/habridge cd $HABRIDGE_DIR nohup java -jar $HABRIDGE_DIR/ha-bridge-3.2.0.jar -Dconfig.file=$HABRIDGE_DIR/habridge.config > $HABRIDGE_LOG 2>&1 &

and I now get one error in the log file to say that the device.db file can't be found, and one to say that some port (maybe 8080) is already in use.

Any ideas welcome - log file attached.

Regards,

David

2016-11-06 14:59:06,748 [main] INFO com.bwssystems.HABridge.HABridge - HA Bridge (v3.2.0) starting.... 2016-11-06 14:59:07,023 [main] INFO com.bwssystems.HABridge.BridgeSettings

On 5 November 2016 at 20:42, David Byrne dmb@yellowbell.net wrote:

See earlier notes for startup mode and command as root.

On 5 Nov 2016 16:10, "BWS Systems" notifications@github.com wrote:

Looks like you have a disconnect on where the ha-bridge is saving the data and it is not getting that info on start up. Please provide your startup configuration and how you start it and under what user.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bwssytems/ha-bridge/issues/214#issuecomment-258621364, or mute the thread https://github.com/notifications/unsubscribe-auth/AEdxQWU9RPvm6mCigQLBvPZuk8jfrQn2ks5q7KpVgaJpZM4Ko2Pw .

audiofreak9 commented 8 years ago

@dmb0058 the device.db error appears on first run and always until the bridge runs successfully the first time. Try adding this to your startup line -Dserver.port=8080 OR whatever Port you choose, so it would be nohup java -jar -Dserver.port=8080 $HABRIDGE_DIR/ha-bridge-3.2.0.jar -Dconfig.file=$HABRIDGE_DIR/habridge.config > $HABRIDGE_LOG 2>&1 &.
Then to access your bridge go to http://<Device IP>:8080

audiofreak9 commented 8 years ago

@dmb0058 BTW, it's best to auto-start the bridge with systemctl, follow the directions in this post here for that: http://forum.micasaverde.com/index.php/topic,31920.msg297253.html#msg297253

dmb0058 commented 8 years ago

So the problem appears to be some mismatch between the files that are read at startup and those that are written in the course of running. I replaced the symbols (HABRIDGE_DIR/HABRIDGE_LOG) in my startup script with hard-coded paths and it's now working perfectly. I also found a directory "/etc/init.d/data" with a devices.db file - again suggests that the script was starting up in /etc/init.d, but then subsequent reads/writes went to the /data/habridge directory.

Thanks again - great piece of software.