Page 8 of 27

Re: Siri / HomeKit support for Domoticz

Posted: Tuesday 16 June 2015 20:23
by pepijn
thebeetleuk wrote:

Code: Select all

/usr/local/lib/node_modules/
No, the homebridge/lib/HAP-NodeJS folder

Re: Siri / HomeKit support for Domoticz

Posted: Tuesday 16 June 2015 20:50
by thebeetleuk
pepijn wrote:
thebeetleuk wrote:

Code: Select all

/usr/local/lib/node_modules/
No, the homebridge/lib/HAP-NodeJS folder
Still no luck :(

Code: Select all

pi@domoticzpi ~/homebridge/lib/HAP-NodeJS $ sudo npm run start

> [email protected] start /home/pi/homebridge/lib/HAP-NodeJS
> node BridgedCore.js

module.js:338
    throw err;
          ^
Error: Cannot find module 'node-persist'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/home/pi/homebridge/lib/HAP-NodeJS/BridgedCore.js:1:77)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)

npm ERR! Linux 3.18.11+
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "start"
npm ERR! node v0.12.1
npm ERR! npm  v2.5.1
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `node BridgedCore.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node BridgedCore.js'.
npm ERR! This is most likely a problem with the HAP-NodeJS package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node BridgedCore.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls HAP-NodeJS
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/pi/homebridge/lib/HAP-NodeJS/npm-debug.log

Re: Siri / HomeKit support for Domoticz

Posted: Tuesday 16 June 2015 20:57
by simon_rb
thebeetleuk wrote:
pepijn wrote:
thebeetleuk wrote:

Code: Select all

/usr/local/lib/node_modules/
No, the homebridge/lib/HAP-NodeJS folder
Still no luck :(

Code: Select all

pi@domoticzpi ~/homebridge/lib/HAP-NodeJS $ sudo npm run start

> [email protected] start /home/pi/homebridge/lib/HAP-NodeJS
> node BridgedCore.js

module.js:338
    throw err;
          ^
Error: Cannot find module 'node-persist'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/home/pi/homebridge/lib/HAP-NodeJS/BridgedCore.js:1:77)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)

npm ERR! Linux 3.18.11+
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "start"
npm ERR! node v0.12.1
npm ERR! npm  v2.5.1
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `node BridgedCore.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node BridgedCore.js'.
npm ERR! This is most likely a problem with the HAP-NodeJS package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node BridgedCore.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls HAP-NodeJS
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/pi/homebridge/lib/HAP-NodeJS/npm-debug.log
Did you sudo npm run start that folder? You need to do sudo npm install in that folder

Re: Siri / HomeKit support for Domoticz

Posted: Tuesday 16 June 2015 23:37
by thebeetleuk
simon_rb wrote:Did you sudo npm run start that folder? You need to do sudo npm install in that folder
OK so I guess I must have skipped the multiple install on the Wiki
Note that this took a long time to execute (10 min+ and counting!!)
potential wiki edit?
git clone https://github.com/nfarina/homebridge.git
cd homebridge
git submodule init
git submodule update
npm install (Should this be sudo nmp install?)
cd lib/HAP-NodeJS <- MISSED THIS
npm install<- MISSED THIS (Should this be sudo nmp install?)
I'll let you know how it goes when finished.

Re: Siri / HomeKit support for Domoticz

Posted: Tuesday 16 June 2015 23:39
by simon_rb
Fingers crossed it'll work. Let us all know how you get on once it's running.. I've given up on it as on my system is too unreliable.. Both for executing commands and adding devices.

Re: Siri / HomeKit support for Domoticz

Posted: Wednesday 17 June 2015 0:29
by RvD
First of all: thanks for this great work!

I had an older version of Domoticz running on my RPi-B (v1, with 256 MB Ram).
First the manual install failed: npm install seemed to last forever.

So, I backupped the database and grabbed a copy of the SD image with everything included.
I also used 'forever' to start the server automatically. It all works perfectly.

However :-), I do have two little bugs:
-I have made a room called 'Woonkamer' in Eve. I can ask Siri 'zet alles uit (of aan) in de woonkamer' and that works. However, when I ask Siri 'zet alle lampen (of verlichting) aan in de woonkamer', Siri replies there are no lights (lampen) in de Woonkamer. When I ask 'wat is er in de woonkamer?' Siri replies 'Er zijn geen apparaten in de woonkamer'.

- I too have the problem of the disappearing devices. I can add devices just fine in Eve, but sometimes when adding a device, before I would normally select the room it's in, Eve returns to the 'find a device screen'. The device I was trying to add is gone then and cannot be re-added.
I tried deleting the device ID-files in the 'persistent' folder (I know he the device ID, since those files were created when the 'add device'-action went wrong), but that doesn't help. So, for some reason the Pi thinks it is paired and doesn't show the device to Eve again? Or does Eve think it is paired and not show it?

-Running app.js with forever doesn't last after a reboot, I suppose I need to use cron to execute the forever command again after reboot. It does allow me to exit the SSH-session obviously which is nice enough for now.
Edit: found the startup-script. After copying it into /etc/init.d I ran the command to include it and got an error:

Code: Select all

pi@raspberrypi /etc/init.d $ sudo update-rc.d homebridge.sh defaults
update-rc.d: using dependency based boot sequencing
insserv: warning: script 'homebridge.sh' missing LSB tags and overrides
Edit2: It would seem the auto-start script is working after all. But because of the problem described in my post below (the 'unreachable' devices), it seemed like the script/server wasn't running after a reboot. That wasn't the case and not the cause of the unreachable devices. The cause is described below.


Thanks again and I hope the 'missing devices' can be sorted out soon.
If you need any help / testing, just let me know!

Re: Siri / HomeKit support for Domoticz

Posted: Wednesday 17 June 2015 1:06
by RvD
... after some more testing and a reboot, most devices turned 'unreachable' in Eve.
I can still add new devices I haven't added before and they work, but the existing devices are all 'unreachable'.

I get these messages:

Code: Select all

[Domoticz] Initializing device with name Staande lamp...
[Domoticz] Loaded services for Staande lamp
Cannot create another accessory with the same name 'Staande lamp'. The 'name' property must be unique for each accessory.

I really hope you can get these two error (disappearing devices and unreachable/unusable devices) fixed soon, it's really such a great script you've created!
Do you already have a Paypal Donate-button somewhere?

Edit: I can also get you SSH, web,... access to my Pi (through OpenVPN) if you want to take a look at the problem and cannot reproduce it on your own Pi.

Re: Siri / HomeKit support for Domoticz

Posted: Wednesday 17 June 2015 1:59
by simon_rb
I have the same message about the name needing to be unique. I hope there is a way to fix this.. Like you said it's a great script.

Just iron out the kinks.

Re: Siri / HomeKit support for Domoticz

Posted: Wednesday 17 June 2015 7:43
by RvD
I can also get you (the developer that is) SSH, web,... access to my Pi (through OpenVPN) if you want to take a look at the problem and cannot reproduce it on your own Pi.

Re: Siri / HomeKit support for Domoticz

Posted: Wednesday 17 June 2015 8:01
by RvD
simon_rb wrote:I have the same message about the name needing to be unique. I hope there is a way to fix this.. Like you said it's a great script.

Just iron out the kinks.
Have you been able to figure out in which config file these settings are actually stored?
The message about the duplicate ID could be fixed (for a limited time of course, since the bug present will recreate the error eventually) by removing those devices from Homebridge itself. Then, when Domoticz.js tries to re-add them, it would be fine.
The same goes for the devices it thinks are already added. Those settings aren't really saved in the 'persistent'-directory, there must be some other location with a settings file that is used for this, but I haven't found it yet.

Re: Siri / HomeKit support for Domoticz

Posted: Wednesday 17 June 2015 10:24
by simon_rb
I found they are stored within HomeKit, if you reset this then the devices come back. I have also deleted the persistent folder every time I have reset HomeKit.

Re: Siri / HomeKit support for Domoticz

Posted: Wednesday 17 June 2015 10:33
by D'rMorris
Hi Simon,

I also reset the homekit config on my iPhone, but the devices that I once added do not come back. I even deleted Eve from the phone, reset the HK config, then rebooted, but the devices do not come back.
Then, I tried reinstalling homebridge on the Pi, also to no avail. I even did this part again (first deleted the whole homekit folder):

git clone https://github.com/nfarina/homebridge.git
cd homebridge
git submodule init
git submodule update
npm install
cd lib/HAP-NodeJS
npm install

Could you tell me what the persistent folder is so that I can try to delete them from there? For the rest, the Siri integration works beautiful!

EDIT: Is it this folder: /homebridge/lib/HAP-NodeJS/node_modules/node-persist? If so, do you just delete the whole contents of that folder?

Re: Siri / HomeKit support for Domoticz

Posted: Wednesday 17 June 2015 10:52
by simon_rb
D'rMorris wrote:Hi Simon,

I also reset the homekit config on my iPhone, but the devices that I once added do not come back. I even deleted Eve from the phone, reset the HK config, then rebooted, but the devices do not come back.
Then, I tried reinstalling homebridge on the Pi, also to no avail. I even did this part again (first deleted the whole homekit folder):

git clone https://github.com/nfarina/homebridge.git
cd homebridge
git submodule init
git submodule update
npm install
cd lib/HAP-NodeJS
npm install

Could you tell me what the persistent folder is so that I can try to delete them from there? For the rest, the Siri integration works beautiful!

EDIT: Is it this folder: /homebridge/lib/HAP-NodeJS/node_modules/node-persist? If so, do you just delete the whole contents of that folder?
No it's under homebridge/persist I think.. I'm not at home to check.. It's full of what looks like MAC address.. Delete that and it should all come back.

Re: Siri / HomeKit support for Domoticz

Posted: Wednesday 17 June 2015 11:04
by D'rMorris
Ah found it! It's not in the homebridge folder, but in root. I deleted the files in there, hope that it works when I get home.
Too bad homebridge / homekit does not work across IP ranges. I've set my VPN so that clients get different adresses than my local devices. Maybe I have to give them the same range, but then addresses outside of the normal DHCP range at home. That way, I can create a VPN connection and tell my oven to start heating ;).

Re: Siri / HomeKit support for Domoticz

Posted: Wednesday 17 June 2015 11:08
by simon_rb
D'rMorris wrote:Ah found it! It's not in the homebridge folder, but in root. I deleted the files in there, hope that it works when I get home.
Too bad homebridge / homekit does not work across IP ranges. I've set my VPN so that clients get different adresses than my local devices. Maybe I have to give them the same range, but then addresses outside of the normal DHCP range at home. That way, I can create a VPN connection and tell my oven to start heating ;).
Once iOS 9 launches in September then you should be able too.. Image

Re: Siri / HomeKit support for Domoticz

Posted: Wednesday 17 June 2015 19:45
by thebeetleuk
simon_rb wrote:Fingers crossed it'll work. Let us all know how you get on once it's running.. I've given up on it as on my system is too unreliable.. Both for executing commands and adding devices.
looks like I have it working. well I'm past that error now so looking good to progress.

I clearly missed something during the install process. Deleted the homebridge directory and installed from the start :)

thanks for everyone's help so far. I'm sure I'll be back with more questions :)

Re: Siri / HomeKit support for Domoticz

Posted: Wednesday 17 June 2015 19:46
by simon_rb
thebeetleuk wrote:
simon_rb wrote:Fingers crossed it'll work. Let us all know how you get on once it's running.. I've given up on it as on my system is too unreliable.. Both for executing commands and adding devices.
looks like I have it working. well I'm past that error now so looking good to progress.

I clearly missed something during the install process. Deleted the homebridge directory and installed from the start :)

thanks for everyone's help so far. I'm sure I'll be back with more questions :)
Excellent. Good luck!

Re: Siri / HomeKit support for Domoticz

Posted: Wednesday 17 June 2015 20:03
by RvD
D'rMorris wrote:Ah found it! It's not in the homebridge folder, but in root. I deleted the files in there, hope that it works when I get home.
Too bad homebridge / homekit does not work across IP ranges. I've set my VPN so that clients get different adresses than my local devices. Maybe I have to give them the same range, but then addresses outside of the normal DHCP range at home. That way, I can create a VPN connection and tell my oven to start heating ;).
I have some more insights into the 'device already exists in HomeBridge / Unreachable from Eve'.
There are in fact two folders that are called 'persists', one in the root (/) and one in ~/homebridge (/home/pi/homebridge).
It would appear that sometimes, HomeKit creates files in the /persists folder.
However, most of the times files are created in ~/homebridge/persists.
Now, it would seem, that domoticz.js somehow checks the folder ~/homebridge/persists to see if a device has already been created.
There, it doesn't find the find and wants to create a new device.
However, the HomeKit-framework checks the /persists-folder as well and therefore the error is thrown.

I can't really replicate this issue, but it seems to be something like this. I might be a little off on the details, but is seems the problem has to do with two folders with the same name/purpose in different locations and sometimes the one and sometimes the other being used.

Re: Siri / HomeKit support for Domoticz

Posted: Wednesday 17 June 2015 20:38
by simon_rb
RvD wrote:
D'rMorris wrote:Ah found it! It's not in the homebridge folder, but in root. I deleted the files in there, hope that it works when I get home.
Too bad homebridge / homekit does not work across IP ranges. I've set my VPN so that clients get different adresses than my local devices. Maybe I have to give them the same range, but then addresses outside of the normal DHCP range at home. That way, I can create a VPN connection and tell my oven to start heating ;).
I have some more insights into the 'device already exists in HomeBridge / Unreachable from Eve'.
There are in fact two folders that are called 'persists', one in the root (/) and one in ~/homebridge (/home/pi/homebridge).
It would appear that sometimes, HomeKit creates files in the /persists folder.
However, most of the times files are created in ~/homebridge/persists.
Now, it would seem, that domoticz.js somehow checks the folder ~/homebridge/persists to see if a device has already been created.
There, it doesn't find the find and wants to create a new device.
However, the HomeKit-framework checks the /persists-folder as well and therefore the error is thrown.

I can't really replicate this issue, but it seems to be something like this. I might be a little off on the details, but is seems the problem has to do with two folders with the same name/purpose in different locations and sometimes the one and sometimes the other being used.
Good find, wonder if the developer watches this thread. If that's causing the error I don't think it would be too hard to fix.. Fingers crossed.

Re: Siri / HomeKit support for Domoticz

Posted: Wednesday 17 June 2015 20:39
by thebeetleuk
Right I now have this working using the following app on my iphone:

https://itunes.apple.com/US/app/id919270334

I did notice however when I ran "npm run start" it looks like its found all my devices. I'm assuming you want to create a room plan to limit the ones on the list?

Also, what app do I need to use to get siri working with this?