We have moved at community.getvera.com

Author Topic: News about HomeKit and Vera  (Read 307684 times)

Offline Hackworth

  • Full Member
  • ***
  • Posts: 100
  • Karma: +13/-8
Re: News about HomeKit and Vera
« Reply #120 on: June 09, 2015, 12:49:17 pm »
@acn - I just pushed a change so it will only try to bind open ports. Update and give it a shot :)

You'll need to do an npm install after updating, I added a new dependency.

Offline acn

  • Sr. Newbie
  • *
  • Posts: 31
  • Karma: +5/-1
Re: News about HomeKit and Vera
« Reply #121 on: June 09, 2015, 01:14:15 pm »
@acn - I just pushed a change so it will only try to bind open ports. Update and give it a shot :)

You'll need to do an npm install after updating, I added a new dependency.

Before doing the 'npm install' I tried running it and failed because it couldn't find that dependency. After doing that it's now breaking with this:

Code: [Select]
Starting Vera HomeKit Bridge...
*** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node>
*** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRegister>
/home/VeraHomeKitBridge/app.js:22
            processDevices(body.devices);
                               ^
TypeError: Cannot read property 'devices' of undefined
    at Request._callback (/home/VeraHomeKitBridge/app.js:22:32)
    at self.callback (/home/VeraHomeKitBridge/node_modules/request/request.js:373:22)
    at Request.emit (events.js:107:17)
    at Request.onRequestError (/home/VeraHomeKitBridge/node_modules/request/request.js:971:8)
    at ClientRequest.emit (events.js:107:17)
    at Socket.socketErrorListener (_http_client.js:271:9)
    at Socket.emit (events.js:107:17)
    at net.js:459:14
    at process._tickCallback (node.js:355:11)

npm ERR! Linux 3.10.35
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "start"
npm ERR! node v0.12.4
npm ERR! npm  v2.10.1
npm ERR! code ELIFECYCLE
npm ERR! VeraHomeKitBridge@1.0.0 start: `node app.js`
npm ERR! Exit status 1
npm ERR!

I've tried a rebuild as well, but it's the same. It gets stuck quite a while (more than a minute) after the warnings, before returning that error. :/


Offline acn

  • Sr. Newbie
  • *
  • Posts: 31
  • Karma: +5/-1
Re: News about HomeKit and Vera
« Reply #122 on: June 09, 2015, 01:21:21 pm »
@Hackworth  Nevermind that last error. It was avahi-daemon that was stopped again.

Offline acn

  • Sr. Newbie
  • *
  • Posts: 31
  • Karma: +5/-1
Re: News about HomeKit and Vera
« Reply #123 on: June 09, 2015, 01:42:30 pm »
Ok, so here I my instructions to run this HomeKit bridge to Vera on a Synology DS  (mine is a DS412+). Please bear in mind that I am far, far from an expert in this, there are probably hugely better and simpler ways of doing this, but here goes.

Github link: https://github.com/Hackworth/VeraHomeKitBridge

Edit: I'm now including a Docker virtual image install notes for the same thing, I think this way it's probably better to survive through DS upgrades. If you don't want to use Docker, just skip to the next code box:

Notes for installation using Docker:

Code: [Select]
Docker Container instructions (if you know how to use docker from the command line, skip this part, though I suggest using "tutum/debian:wheezy):

- Install and Run "Docker" from Synology DS's Package Manager
- Open Docker and search for the "tutum/debian:wheezy" image (couldn't get debian:latest to run) to create a new container. It will start transferring the image. When it finishes, double click that image to start the Assistant.
- Enter your container name (like "VeraHomeKitBridge") and select map ports automatically. I mapped port 49153 to port 22 to make SSH access static from there.
- I also selected to create a shortcut on my DS desktop.
- Start the container (click the icon on the desktop)
- Look for SSH password in the Log tab and use that to login (use localhost if you're within a SSH session to your DS):

ssh -p 49153 root@localhost


- Updates and Common installs:

apt-get install build-essential -y
apt-get install nano -y
apt-get install cmake libboost-dev libboost-thread-dev libboost-system-dev libsqlite3-dev subversion curl libcurl4-openssl-dev libusb-dev zlib1g-dev libudev-dev -y
apt-get install apt-utils -y
apt-get install python -y
apt-get install git -y
apt-get install libavahi-compat-libdnssd-dev -y

(in case you get conflicts:)
apt-get dist-upgrade

- Install NodeJS (will take some time. Change dir if you want, and/or change v0.12.4 to whatever you want, if you specifically need a different one):

cd /home/
git clone https://github.com/joyent/node.git
cd node
git checkout v0.12.4
./configure --openssl-libpath=/usr/lib/ssl
make
make install
node -v
npm -v

 - You should now be able to verify this:
node -v
  v0.12.4
npm -v
  2.10.1

 - Install VeraHomeKitBridge:

  cd /home/
git clone --recursive https://github.com/Hackworth/VeraHomeKitBridge.git
cd VeraHomeKitBridge
npm install
cd lib/HAP-NodeJS
npm install
cd -

 - Make these changes:
  In '/home/VeraHomeKitBridge/config.json': change IP address to your Vera's
  In '/etc/avahi/avahi-daemon.conf' comment out 'rlimit-nproc = 3' (i.e. change to '#rlimit-nproc = 3')
  In '/etc/default/avahi-daemon' change
AVAHI_DAEMON_DETECT_LOCAL=1
to
AVAHI_DAEMON_DETECT_LOCAL=0

 - Fix avahi-daemon (use 'service avahi-daemon status' to see if it's running):
/etc/init.d/dbus restart
apt-get install --reinstall avahi-daemon
service avahi-daemon start

 - Remember that to restart avahi-daemon you can use 'service avahi-daemon restart', this may solve some dns issues.

 - Test run:

  cd /home/VeraHomeKitBridge
  npm run start
  (Or)
  node app.js

 - Make it run in the background with pm2 (this thing is very cool!):

  npm install pm2 -g
  cd /home/VeraHomeKitBridge/

  [Check if avahi-daemon is running:]
service avahi-daemon status

  [Start the nodejs script with:]
pm2 start app.js

  [check if the app is running:]
  pm2 show 0

  [check if the output log looks ok with:]
  tail /root/.pm2/logs/app-out-0.log

  [Done! You can close your terminal sessions, it should keep running in the background!]


Notes for installation without using Docker:

Code: [Select]
For Synology users, I've successfully been able to run the package with the provided instructions.
So my understanding of this (I'm no expert) is that we're running a debian "session" where we'll install VeraHomeKitBridge:

-  Install the following packages from the SynoCommunity repository:
   > Python
   > Debian Chroot
-  Run Debian Chroot and wait status: Installed. If it doesn't happen, reboot your DS
-  Open Control Panel Synology and go to Terminal / SNMP. Tick SSH to it.
-  Open SSH terminal session, login with root@yourDSnameOrIP and password of your Admin account from Synology.
-  Enter the following commands via SSH session:

   /var/packages/debian-chroot/scripts/start-stop-status chroot

   (note: in case of need use nano instead of vi, vi didn't let me get back to the command line)

- This will open a new root session. Configuring Debian Chroot locales (one-time config):

aptitude update
aptitude upgrade
aptitude install locales
dpkg-reconfigure locales
  > select there whateverYourLanguageIS.UTF-8 UTF-8 (scroll with the arrow key) and go to OK (Tab key) (enter) -> I chose C.UTF-8
  dpkg-reconfigure tzdata
  > Select best option

       - Now installing common packages:

apt-get install build-essential -y
apt-get install cmake libboost-dev libboost-thread-dev libboost-system-dev libsqlite3-dev subversion curl libcurl4-openssl-dev libusb-dev zlib1g-dev libudev-dev
apt-get install git
apt-get install build-essential libavahi-compat-libdnssd-dev
apt-get install python     

- In case of conflicts you can use:
  apt-get dist-upgrade
             and/or
                  aptitude full-upgrade

- I had a lot of trouble with upgrading nodejs from 0.10 to 0.12, this solved it:

git clone https://github.com/joyent/node.git
cd node
git checkout v0.12.4 (or the version you want to build)
./configure --openssl-libpath=/usr/lib/ssl
make
make install
node -v
npm -v

- You should now have this:
node -v
  v0.12.4
npm -v
  2.10.1


- Now for the VeraHomeKitBridge, which I choose to install at /home (don't know if this is ok or not):

git clone --recursive https://github.com/Hackworth/VeraHomeKitBridge.git
cd VeraHomeKitBridge
npm install
cd lib/HAP-NodeJS
npm install
cd -

- Edit config.json accordingly (change IP address).


- I also had to run this to resolve some errors:

npm install mdns

(tip from @dlca1) - To repair avahi-daemon, change '/etc/avahi/avahi-daemon.conf' from
  rlimit-nproc = 3
To
  #rlimit-nproc = 3

- This might help as well with avahi errors, run 'nano /etc/default/avahi-daemon' and change the line:
AVAHI_DAEMON_DETECT_LOCAL=1
to
AVAHI_DAEMON_DETECT_LOCAL=0

- If you still have issues with avahi (use 'service avahi-daemon status' to see if it's running) try this:
/etc/init.d/dbus restart
apt-get install --reinstall avahi-daemon

- Issue (need to check again if it's still an issue): after reboot I had to to repair avahi-daemon again.

- And after this it should start with:
npm run start

 - Make it run in the background with pm2 (this thing is very cool!):

  npm install pm2 -g
  cd /home/VeraHomeKitBridge/

  [Check if avahi-daemon is running:]
service avahi-daemon status

  [Start the nodejs script with:]
pm2 start app.js

  [check if the app is running:]
  pm2 show 0

  [check if the output log looks ok with:]
  tail /root/.pm2/logs/app-out-0.log

  [Done! You can close your terminal sessions, it should keep running in the background!]


- (untested, my notes to test, don't try it if you don't know what you're doing) To run it in the background and on boot, doing this on the DS's terminal shell (not chroot):
Create this file:
vi /usr/syno/etc/rc.d/S99chrootDebian.sh

(which process to kill??) Paste this script inside:

case $1 in
start)
chroot /usr/local/debian-chroot/var/chroottarget su - root -c "/home/VeraHomeKitBridge/pm2 start app.js"
;;
stop)
pkill pm2*
;;
*)
echo "Usage: $0 [start|stop]"
;;
esac

Save the file and:
chmod 755 /usr/syno/etc/rc.d/S99chrootDebian.sh






PIN code for devices: 031-45-154

Again, I added Scenes to my HomeKit "home" using the "Eve" app, that is available for free on the App store. It read the "Lights - On" & "Lights - Off" scene types as one entry only.

I have yet to understand if it runs in my native language or not (Portuguese), as I'm not finding any good replies from Siri (does anyone know where I could find HomeKit commands for other languages other than English?).

In English it does what it's meant to do just fine!

And it's awesome, thanks @Hackworth, @Albeebe, @anhman and everyone else for this! How cool is this, my old Vera 2 is actually doing something pretty neat! :D
« Last Edit: June 22, 2015, 06:32:26 am by acn »

Offline rafale77

  • Community Beta
  • Hero Member
  • ******
  • Posts: 1749
  • Karma: +101/-27
  • HA ≠ IoT as a blue sky is cloudless.
Re: News about HomeKit and Vera
« Reply #124 on: June 09, 2015, 03:41:12 pm »
Moving on to the door lock. I have a Yale lock which is seen as a lock by both the Vera and MyTouchHome. It only responds to switch commands though with Turn on and Turn off. It seems like Door.js is not active...

I checked the Vera commands available and it responds to both lock and switch commands. Somehow Siri still still sees it as a switch even though the bridge is reporting it as a lock.

It also seems like dimmers are not being recognized by Siri although they are being reported correctly by the bridge. Or maybe I am not sure how to set brightness with siri.
« Last Edit: June 09, 2015, 03:52:52 pm by anhman »
openLuup (79 devices, 141 scenes, 19 apps) master to VeraPlus (142 zwave nodes, 8 Zigbee nodes, 221 devices,  20 scenes , 2 apps) +  Hubitat (15 Zigbee nodes) + Home-Assistant (API Integrations). Bridged to Siri and Alexa. Homewave. VeraPlus ExtRooted and mios server independent.

Offline Hackworth

  • Full Member
  • ***
  • Posts: 100
  • Karma: +13/-8
Re: News about HomeKit and Vera
« Reply #125 on: June 09, 2015, 04:32:47 pm »
If it's showing up as a lock in MyTouchHome then everything's working correctly. The syntax I've used for dimmable lights is "dim the kitchen to 20 percent"

Offline rafale77

  • Community Beta
  • Hero Member
  • ******
  • Posts: 1749
  • Karma: +101/-27
  • HA ≠ IoT as a blue sky is cloudless.
Re: News about HomeKit and Vera
« Reply #126 on: June 09, 2015, 04:50:09 pm »
Well, for the lock it isn't that siri tries. It keeps on telling me I don't have such a device. What name did you use? Changing the name on my touch home also did nothing for me. Somehow I always have to change it on the vera. Maybe I don't leave enough time in between?
openLuup (79 devices, 141 scenes, 19 apps) master to VeraPlus (142 zwave nodes, 8 Zigbee nodes, 221 devices,  20 scenes , 2 apps) +  Hubitat (15 Zigbee nodes) + Home-Assistant (API Integrations). Bridged to Siri and Alexa. Homewave. VeraPlus ExtRooted and mios server independent.

Offline Hackworth

  • Full Member
  • ***
  • Posts: 100
  • Karma: +13/-8
Re: News about HomeKit and Vera
« Reply #127 on: June 09, 2015, 08:18:53 pm »
For those that want to see what this looks like, here's me turning on a scene via my wall mounted iPad from 10 or so feet away: https://youtu.be/_dSpb_GF6AY

Offline C7Z51

  • Sr. Newbie
  • *
  • Posts: 42
  • Karma: +2/-2
Re: News about HomeKit and Vera
« Reply #128 on: June 09, 2015, 09:02:37 pm »
Ok, so here I my instructions to run this on a Synology DS  (mine is a DS412+). Please bear in mind that I am far, far from an expert in this, there are probably hugely better and simpler ways of doing this, but here goes:

For Synology users, I've successfully been able to run the package with the provided instructions.
So my understanding of this (I'm no expert) is that we're running a debian "session" where we'll install VeraHomeKitBridge:

-  Install the following packages from the SynoCommunity repository:
   > Python
   > Debian Chroot
-  Run Debian Chroot and wait status: Installed. If it doesn't happen, reboot your DS
-  Open Control Panel Synology and go to Terminal / SNMP. Tick SSH to it.
-  Open SSH terminal session, login with root@yourDSnameOrIP and password of your Admin account from Synology.
-  Enter the following commands via SSH session:

      /var/packages/debian-chroot/scripts/start-stop-status chroot


      (note: in case of need use nano instead of vi, vi didn't let me get back to the command line)


   - This will open a new root session. Configuring Debian Chroot locales (one-time config):

      /var/packages/debian-chroot/scripts/start-stop-status chroot
      aptitude update
      aptitude upgrade
      aptitude install locales
      dpkg-reconfigure locales
        > select there whateverYourLanguageIS.UTF-8 UTF-8 (scroll with the arrow key) and go to OK (Tab key) (enter) -> I chose C.UTF-8
       dpkg-reconfigure tzdata
        > Select best option

      apt-get install build-essential -y
      apt-get install cmake libboost-dev libboost-thread-dev libboost-system-dev libsqlite3-dev subversion curl libcurl4-openssl-dev libusb-dev zlib1g-dev libudev-dev
      apt-get install git
      apt-get install build-essential libavahi-compat-libdnssd-dev
      git clone git://github.com/ry/node.git
I'm having trouble here. The code git clone git://github.com/ry/node.git responds with node directory already exists. I tried deleting the directory and then I was successful at executing this command.
   - In case of conflicts you can use:
        apt-get upgrade --full-resolver
I get this error E: Command line option --full-resolver is not understood

   - I had a lot of trouble with upgrading nodejs from 0.10 to 0.12, this solved it:

      git clone https://github.com/joyent/node.git
fatal: destination path 'node' already exists and is not an empty directory.
      cd node
      git checkout v0.9.5 (or the version you want to build)
      ./configure --openssl-libpath=/usr/lib/ssl
/usr/bin/env: python: No such file or directory
      make
make: python: Command not found
make: python: Command not found
make: python: Command not found
make: python: Command not found
make: python: Command not found
make: python: Command not found
make: python: Command not found
make: python: Command not found
make: python: Command not found
make: python: Command not found
python ./configure
make: python: Command not found
Makefile:53: recipe for target 'config.gypi' failed
make: *** [config.gypi] Error 127

      make install
Same error as above
      node -v
bash: node: command not found
      npm -v
bash: npm: command not found

    - You should now have this:
      node -v
        v0.12.4
      npm -v
        2.10.1


Offline acn

  • Sr. Newbie
  • *
  • Posts: 31
  • Karma: +5/-1
Re: News about HomeKit and Vera
« Reply #129 on: June 09, 2015, 09:08:15 pm »
@C7Z51, two things: I guess you don't have python running, and also i left a command that shouldn't be there; that's the first git clone. Remove that one and consider only the second one (git clone https://github.com/joyent/node.git).
« Last Edit: June 09, 2015, 09:20:38 pm by acn »

Offline C7Z51

  • Sr. Newbie
  • *
  • Posts: 42
  • Karma: +2/-2
Re: News about HomeKit and Vera
« Reply #130 on: June 09, 2015, 09:10:49 pm »
@C7Z51, two things: I guess you don't have python running, and also i left a command that shouldn't be there; that's the first git clone. Remove that one and consider only the second one (git clone https://github.com/joyent/node.git).

I have Python, Python Module and Python 3 running. I'll try a restart.

Offline acn

  • Sr. Newbie
  • *
  • Posts: 31
  • Karma: +5/-1
Re: News about HomeKit and Vera
« Reply #131 on: June 09, 2015, 09:20:12 pm »
Try running  "which python" to check it is running correctly, it should return the path where it is. If so maybe add it to the environ path or create a symlink ...

As for resolving conflicts I can't remember which was the correct command, but "apt-get dist-upgrade" and "aptitude full-upgrade" should suffice.

Offline C7Z51

  • Sr. Newbie
  • *
  • Posts: 42
  • Karma: +2/-2
Re: News about HomeKit and Vera
« Reply #132 on: June 09, 2015, 09:34:17 pm »
Here is what I get when I run which python:

DiskStation> /var/packages/debian-chroot/scripts/start-stop-status chroot
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)
root@DiskStation:/# git clone https://github.com/joyent/node.git
fatal: destination path 'node' already exists and is not an empty directory.
root@DiskStation:/# cd node
root@DiskStation:/node# ./configure --openssl-libpath=/usr/lib/ssl
/usr/bin/env: python: No such file or directory
root@DiskStation:/node# which python
root@DiskStation:/node#

It just goes to the next line and is blank

Offline C7Z51

  • Sr. Newbie
  • *
  • Posts: 42
  • Karma: +2/-2
Re: News about HomeKit and Vera
« Reply #133 on: June 09, 2015, 09:41:15 pm »
Exiting Debian Root and running the commands worked until the configure command - see below, was this correct?

root@DiskStation:~/node# exit
exit
DiskStation> git checkout v0.9.5
fatal: Not a git repository (or any of the parent directories): .git
DiskStation> git clone https://github.com/joyent/node.git
Cloning into 'node'...
remote: Counting objects: 142510, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 142510 (delta 1), reused 0 (delta 0), pack-reused 142507
Receiving objects: 100% (142510/142510), 124.45 MiB | 7.19 MiB/s, done.
Resolving deltas: 100% (105198/105198), done.
Checking connectivity... done.
Checking out files: 100% (11994/11994), done.
DiskStation> cd node
DiskStation> git checkout v0.9.5
Checking out files: 100% (11197/11197), done.
Note: checking out 'v0.9.5'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at 01994e8... 2012.12.30, Version 0.9.5 (Unstable)
DiskStation> ./configure --openssl-libpath=/usr/lib/ssl
Node.js configure error: No acceptable C compiler found!

        Please make sure you have a C compiler installed on your system and/or
        consider adjusting the CC environment variable if you installed
        it in a non-standard prefix.
       

DiskStation> make
-ash: make: not found
DiskStation> make install
-ash: make: not found
DiskStation>

Offline dlca1

  • Sr. Newbie
  • *
  • Posts: 33
  • Karma: +0/-2
Re: News about HomeKit and Vera
« Reply #134 on: June 09, 2015, 11:17:04 pm »
@ACN- thanks for sharing the synology install notes.

Besides the tips you shared, do you remember doing anything else to fix the avahi-daemon issues? I've tried all those tips, but am still getting similar errors you initially reported.

Thanks in advance


*** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node>
*** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRegister>