Page 13 of 27

Re: Siri / HomeKit support for Domoticz

Posted: Wednesday 26 August 2015 22:51
by wokkelp
Okay, I removed the scenes, reinstalled homebridge and I saw it showing up in the EVE application.
While pairing (after entering the code) It suddently stopped.
This is the output of my raspberry:

Code: Select all

> [email protected] start /home/pi/homebridge
> DEBUG=* node app.js || true

*** 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>
Starting HomeBridge server...
_____________________________________________________________________
IMPORTANT: Homebridge is in the middle of some big changes.
           Read more about it here:
           https://github.com/nfarina/homebridge/wiki/Migration-Guide
_____________________________________________________________________

Loading 1 platforms...
[Domoticz] Initializing Domoticz platform...
[Domoticz] Fetching Domoticz lights and switches...
Loading 0 accessories...
[Domoticz] Initializing platform accessory 'Eetkamer 1'...
[Domoticz] Loaded services for Eetkamer 1
[Domoticz] Initializing platform accessory 'Keuken 1'...
[Domoticz] Loaded services for Keuken 1
[Domoticz] Initializing platform accessory 'Woonkamer 1'...
[Domoticz] Loaded services for Woonkamer 1
[Domoticz] Initializing platform accessory 'Woonkamer 2'...
[Domoticz] Loaded services for Woonkamer 2
[Domoticz] Initializing platform accessory 'Woonkamer 3'...
[Domoticz] Loaded services for Woonkamer 3
  Accessory [Homebridge] Creating new AccessoryInfo for our HAP server +0ms
  Accessory [Homebridge] Creating new IdentifierCache +133ms
  EventedHTTPServer Server listening on port 51826 +565ms
  EventedHTTPServer [192.168.0.7] New connection from client +39s
  EventedHTTPServer [192.168.0.7] HTTP server listening on port 54826 +19ms
  EventedHTTPServer [192.168.0.7] HTTP request: /identify +136ms
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: POST /identify +7ms
  Accessory [Homebridge] Identification request +32ms
  Accessory [Homebridge] Identification request ignored; no listeners to 'identify' event +4ms
  HAPServer [CC:22:3D:E3:CE:30] Identification success +9ms
  EventedHTTPServer [192.168.0.7] HTTP Repsonse is finished +63ms
  EventedHTTPServer [192.168.0.7] HTTP request: /pair-setup +6s
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: POST /pair-setup +9ms
  HAPServer [CC:22:3D:E3:CE:30] Pair step 1/5 +35ms
  EventedHTTPServer [192.168.0.7] HTTP Repsonse is finished +594ms
  EventedHTTPServer [192.168.0.7] HTTP request: /pair-setup +11s
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: POST /pair-setup +5ms
  HAPServer [CC:22:3D:E3:CE:30] Pair step 2/5 +18ms
  EventedHTTPServer [192.168.0.7] HTTP Repsonse is finished +468ms
  EventedHTTPServer [192.168.0.7] HTTP request: /pair-setup +182ms
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: POST /pair-setup +7ms
  HAPServer [CC:22:3D:E3:CE:30] Pair step 3/5 +26ms
  HAPServer [CC:22:3D:E3:CE:30] Pair step 4/5 +227ms
  HAPServer [CC:22:3D:E3:CE:30] Pair step 5/5 +27ms
  Accessory [Homebridge] Paired with client DFDE0C91-8341-4EFC-9108-A8CE14356731 +61ms
  EventedHTTPServer [192.168.0.7] HTTP Repsonse is finished +122ms
  EventedHTTPServer [192.168.0.7] Client connection closed +273ms
  EventedHTTPServer [192.168.0.7] New connection from client +88ms
  EventedHTTPServer [192.168.0.7] HTTP server listening on port 54827 +17ms
  EventedHTTPServer [192.168.0.7] HTTP connection was closed +60ms
  EventedHTTPServer [192.168.0.7] HTTP server was closed +10ms
  EventedHTTPServer [192.168.0.7] HTTP request: /pair-verify +54ms
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: POST /pair-verify +9ms
  HAPServer [CC:22:3D:E3:CE:30] Pair verify step 1/2 +24ms
  EventedHTTPServer [192.168.0.7] HTTP Repsonse is finished +186ms
  EventedHTTPServer [192.168.0.7] HTTP request: /pair-verify +219ms
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: POST /pair-verify +5ms
  HAPServer [CC:22:3D:E3:CE:30] Pair verify step 2/2 +20ms
  HAPServer [CC:22:3D:E3:CE:30] Client DFDE0C91-8341-4EFC-9108-A8CE14356731 verification complete +44ms
  EventedHTTPServer [192.168.0.7] HTTP Repsonse is finished +27ms
  EventedHTTPServer [192.168.0.7] New connection from client +54ms
  EventedHTTPServer [192.168.0.7] HTTP server listening on port 54826 +9ms
  EventedHTTPServer [192.168.0.7] Client connection error: This socket has been ended by the other party +22ms
  EventedHTTPServer [192.168.0.7] Client connection closed +6ms
  EventedHTTPServer [192.168.0.7] HTTP connection was closed +21ms
  EventedHTTPServer [192.168.0.7] HTTP server was closed +8ms
  EventedHTTPServer [192.168.0.7] HTTP request: /pair-verify +22ms
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: POST /pair-verify +5ms
  HAPServer [CC:22:3D:E3:CE:30] Pair verify step 1/2 +11ms
  EventedHTTPServer [192.168.0.7] HTTP Repsonse is finished +114ms
  EventedHTTPServer [192.168.0.7] HTTP request: /pair-verify +29ms
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: POST /pair-verify +5ms
  HAPServer [CC:22:3D:E3:CE:30] Pair verify step 2/2 +10ms
  HAPServer [CC:22:3D:E3:CE:30] Client DFDE0C91-8341-4EFC-9108-A8CE14356731 verification complete +49ms
  EventedHTTPServer [192.168.0.7] HTTP Repsonse is finished +20ms
  EventedHTTPServer [192.168.0.7] HTTP request: /accessories +49ms
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: GET /accessories +5ms
  EventedHTTPServer [192.168.0.7] HTTP Repsonse is finished +75ms
After restarting the application it could no longer find anything.

Re: Siri / HomeKit support for Domoticz

Posted: Wednesday 26 August 2015 23:15
by G3rard
I had the same issue when Eve suddenly stopped with pairing.
For me it helped to stop Homebridge, empty (not delete) the two files in the persist directory and start Homebridge again.

What's the content of your config.json file?

Re: Siri / HomeKit support for Domoticz

Posted: Thursday 27 August 2015 18:08
by wokkelp
How do I gracefully stop homebridge?
Just CTRL+C?

And ehh... the contents of my config.json are:

Code: Select all

{
    "description": "Configuration file for Domoticz platform.",
    "platforms": [
        {
            "platform": "Domoticz",
            "name": "Domoticz",
            "server": "192.168.0.5",
            "port": "8080"
        }
    ],
    "accessories": [
    ]
}


I cleared those two files and restarted homebridge.

Code: Select all

> [email protected] start /home/pi/homebridge
> DEBUG=* node app.js || true

*** 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>
Starting HomeBridge server...
_____________________________________________________________________
IMPORTANT: Homebridge is in the middle of some big changes.
           Read more about it here:
           https://github.com/nfarina/homebridge/wiki/Migration-Guide
_____________________________________________________________________

Loading 1 platforms...
[Domoticz] Initializing Domoticz platform...
[Domoticz] Fetching Domoticz lights and switches...
Loading 0 accessories...
[Domoticz] Initializing platform accessory 'Eetkamer 1'...
[Domoticz] Loaded services for Eetkamer 1
[Domoticz] Initializing platform accessory 'Keuken 1'...
[Domoticz] Loaded services for Keuken 1
[Domoticz] Initializing platform accessory 'Woonkamer 1'...
[Domoticz] Loaded services for Woonkamer 1
[Domoticz] Initializing platform accessory 'Woonkamer 2'...
[Domoticz] Loaded services for Woonkamer 2
[Domoticz] Initializing platform accessory 'Woonkamer 3'...
[Domoticz] Loaded services for Woonkamer 3
  Accessory [Homebridge] Creating new AccessoryInfo for our HAP server +0ms
  Accessory [Homebridge] Creating new IdentifierCache +134ms
  EventedHTTPServer Server listening on port 51826 +530ms
  EventedHTTPServer [192.168.0.7] New connection from client +1m
  EventedHTTPServer [192.168.0.7] HTTP server listening on port 54826 +19ms
  EventedHTTPServer [192.168.0.7] HTTP request: /pair-verify +132ms
  HAPServer [CC:22:3D:E3:CE:30] HAP Request: POST /pair-verify +7ms
  HAPServer [CC:22:3D:E3:CE:30] Pair verify step 1/2 +55ms
  EventedHTTPServer [192.168.0.7] HTTP Repsonse is finished +422ms
  EventedHTTPServer [192.168.0.7] Client connection closed +252ms
  EventedHTTPServer [192.168.0.7] HTTP connection was closed +45ms
  EventedHTTPServer [192.168.0.7] HTTP server was closed +10ms
After waiting a minute or 2 the console said it made a new connection [192.168.0.7]
Even though I never touched my phone in the meanwhile.
The applications Eve and Insteon still show nothing...

Re: Siri / HomeKit support for Domoticz

Posted: Thursday 27 August 2015 19:36
by nigels0
Well I upgraded and now Homebridge won't start - After loading all the accessories, I get:

Accessory [Homebridge] Creating new AccessoryInfo for our HAP server +0ms
Accessory [Homebridge] Creating new IdentifierCache +34ms
events.js:85
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE
at exports._errnoException (util.js:746:11)
at Server._listen2 (net.js:1129:14)
at listen (net.js:1155:10)
at Server.listen (net.js:1240:5)
at EventedHTTPServer.listen (/home/pi/homebridge/node_modules/HAP-NodeJS/lib/util/eventedhttp.js:58:19)
at HAPServer.listen (/home/pi/homebridge/node_modules/HAP-NodeJS/lib/HAPServer.js:130:20)
at Bridge.Accessory.publish (/home/pi/homebridge/node_modules/HAP-NodeJS/lib/Accessory.js:346:16)
at publish (/home/pi/homebridge/app.js:203:10)
at /home/pi/homebridge/app.js:139:9
at callbackLater (/home/pi/homebridge/platforms/Domoticz.js:89:53)

Re: Siri / HomeKit support for Domoticz

Posted: Thursday 27 August 2015 22:48
by G3rard
wokkelp wrote:How do I gracefully stop homebridge?
Just CTRL+C?

And ehh... the contents of my config.json are:

After waiting a minute or 2 the console said it made a new connection [192.168.0.7]
Even though I never touched my phone in the meanwhile.
The applications Eve and Insteon still show nothing...
The reason that I asked for the config.json is that I think you have to add a new part due to the recent changes.
My config.json is based on the example file and is:

Code: Select all

{
    "bridge": {
        "name": "Homebridge",
        "username": "CC:22:3D:E3:CE:30",
        "port": 51826,
        "pin": "031-45-154"
    },

    "description": "Configuration file for Domoticz platform.",
	
    "platforms": [
        {
            "platform": "Domoticz",
            "name": "Domoticz",
            "server": "192.168.1.102",
            "port": "8084",
			"roomid": "11"
        }
    ],
    "accessories": [
    ]
}

Re: Siri / HomeKit support for Domoticz

Posted: Friday 28 August 2015 1:17
by nigels0
That doesn't alter anything major. Try

ps aux

find the process number then sudo kill it.

Still getting this error though even with a clean install of home bridge

BTW, shouldn't domoticz be on port 8080 or have you changed it?

Re: Siri / HomeKit support for Domoticz

Posted: Friday 28 August 2015 10:47
by wokkelp
G3rard wrote: The reason that I asked for the config.json is that I think you have to add a new part due to the recent changes.
My config.json is based on the example file and is:
...
Doesn't make any difference...
Still can't find "homebridge" in insteon

The last output line concerns me:

Code: Select all

EventedHTTPServer [192.168.0.7] HTTP server was closed +9ms

Re: Siri / HomeKit support for Domoticz

Posted: Friday 28 August 2015 10:58
by G3rard
Did you also reset the Homekit settings on your iPhone? If so then I am afraid I don't have the solution.

Re: Siri / HomeKit support for Domoticz

Posted: Friday 28 August 2015 11:18
by ivom74
Problem solved. just a failure in de json config file.

All devices are now loaded from homebrigde and added automatically.

Can i now rename/add/remove devices in domoticz devices ? Just restarting the pi is enough to let Eve on the iphone pick it up?

Re: Siri / HomeKit support for Domoticz

Posted: Friday 28 August 2015 12:18
by wokkelp
My problem was solved thanks to G3rard, all I had to do was reset my homekit settings on my iPhone.
(To do this: Go to Settings -> Privacy -> Homekit, there should be a button to reset your homekit settings.)

1. There is something else that I hoped was working.
I have two other sensors in the same Room (Defined in the config.json file)
Called "Elektriciteit" and "Gas", these two Devices are sensors that measure the usage of my Electricity and Gas in my home.
Is there any way to add them to Insteon+?

2. I don't have a monitor and keyboard connected to my raspberry so I rely on SSH.
Whenever I close a SSH session with Putty homebridge stops responding.
I tried using forever so that homebridge restarts when the raspberry reboots but that doesn't work either.
I also don't want a ssh session open all the time to run homebridge.
Does anyone have a solution?

Re: Siri / HomeKit support for Domoticz

Posted: Friday 28 August 2015 14:31
by Eduard
wokkelp wrote:My problem was solved thanks to G3rard, all I had to do was reset my homekit settings on my iPhone.
(To do this: Go to Settings -> Privacy -> Homekit, there should be a button to reset your homekit settings.)

1. There is something else that I hoped was working.
I have two other sensors in the same Room (Defined in the config.json file)
Called "Elektriciteit" and "Gas", these two Devices are sensors that measure the usage of my Electricity and Gas in my home.
Is there any way to add them to Insteon+?

2. I don't have a monitor and keyboard connected to my raspberry so I rely on SSH.
Whenever I close a SSH session with Putty homebridge stops responding.
I tried using forever so that homebridge restarts when the raspberry reboots but that doesn't work either.
I also don't want a ssh session open all the time to run homebridge.
Does anyone have a solution?
Use PM2, see wiki or few posts earlier. Works great!

Re: Siri / HomeKit support for Domoticz

Posted: Friday 28 August 2015 14:57
by nigels0
Has anyone used the latest build from the git and got it working? Mine was until I 'upgraded' it.

Re: Siri / HomeKit support for Domoticz

Posted: Friday 28 August 2015 15:30
by wokkelp
Also noticed that after a while homebridge doesn't want to stay online so it decides to close the Client Connection and the HTTP server after a ETIMEDOUT error

Code: Select all

  EventedHTTPServer [192.168.0.7] Sending HTTP event 'keepalive' with data: {"characteristics":[]} +10m
  EventedHTTPServer [192.168.0.7] Client connection error: read ETIMEDOUT +7m
  EventedHTTPServer [192.168.0.7] Client connection closed +5ms
  EventedHTTPServer [192.168.0.7] HTTP connection was closed +56ms
  EventedHTTPServer [192.168.0.7] HTTP server was closed +11ms

Re: Siri / HomeKit support for Domoticz

Posted: Friday 28 August 2015 16:02
by Bigted
nigels0 wrote:Has anyone used the latest build from the git and got it working? Mine was until I 'upgraded' it.
Renamed the old homebridge directory and used the wiki to install the latest version and added the latest config.json

{
"bridge": {
"name": "Homebridge",
"username": "CC:22:3D:E3:CE:30",
"port": 51826,
"pin": "031-45-154"
},

"description": "Configuration file for Domoticz platform.",

"platforms": [
{
"platform": "Domoticz",
"name": "Domoticz",
"server": "192.168.1.101",
"port": "8080",
"roomid": "9"
}
],
"accessories": [
]
}

Was working well with Siri and Eve for 30 minutes and then my Pi crashed while using Siri, need to remove the power to recover the Pi and Domoticz, Haven't tried Homekit again, Friday afternoon is NOT the time to play again to keep SWMBO happy

Re: Siri / HomeKit support for Domoticz

Posted: Friday 28 August 2015 17:15
by wokkelp
I used Eduards tutorial as described on page 11 of this topic. (automatically start homebridge using PM2 after a reboot.)
When I reboot my Pi and do "pm2 list" the list is empty.
meaning both auto start-up scripts are not working for me...
Why on earth is nothing going as it should.. I am following all the tutorials exactly how I should, I copy every quoted line into the ssh session.
I make sure I sudo wherever I need root permissions..

Re: Siri / HomeKit support for Domoticz

Posted: Friday 28 August 2015 19:55
by G3rard
wokkelp wrote:I used Eduards tutorial as described on page 11 of this topic. (automatically start homebridge using PM2 after a reboot.)
When I reboot my Pi and do "pm2 list" the list is empty.
meaning both auto start-up scripts are not working for me...
Why on earth is nothing going as it should.. I am following all the tutorials exactly how I should, I copy every quoted line into the ssh session.
I make sure I sudo wherever I need root permissions..
Didn't work for me either Image, after reboot I had an empty list. Will give it another try in the coming weeks.

Re: Siri / HomeKit support for Domoticz

Posted: Friday 28 August 2015 21:02
by Eduard
G3rard wrote:
wokkelp wrote:I used Eduards tutorial as described on page 11 of this topic. (automatically start homebridge using PM2 after a reboot.)
When I reboot my Pi and do "pm2 list" the list is empty.
meaning both auto start-up scripts are not working for me...
Why on earth is nothing going as it should.. I am following all the tutorials exactly how I should, I copy every quoted line into the ssh session.
I make sure I sudo wherever I need root permissions..
Didn't work for me either Image, after reboot I had an empty list. Will give it another try in the coming weeks.
Sorry to hear that it is not working with you; i'm using it on 3 pi's without any problem..
I will try to help you fixing this!

PM2 should start all the process which are saved in a so-called dump-file. To create this dump file, first start your script and then create a dumpfile

Code: Select all

cd ~/homebridge
pm2 start app.js --name HomeBridge
pm2 save
Check if the process is running in PM2...

Code: Select all

pm2 list
┌────────────┬────┬──────┬───────┬────────┬─────────┬────────┬────────────┬──────────┐
│ App name   │ id │ mode │ pid   │ status │ restart │ uptime │ memory     │ watching │
├────────────┼────┼──────┼───────┼────────┼─────────┼────────┼────────────┼──────────┤
│ HomeBridge │ 0  │ fork │ 13100 │ online │ 0       │ 0s     │ 9.574 MB   │ disabled │
└────────────┴────┴──────┴───────┴────────┴─────────┴────────┴────────────┴──────────┘
...and check if the PM2 deamon is running

Code: Select all

ps x
  PID TTY      STAT   TIME COMMAND
 1907 ?        S      0:00 /bin/bash /usr/bin/node-red-pi --max-old-space-size=128 -u /home/pi/.node-red
 1941 ?        Sl     0:17 node-red                                                                                     
 2189 ?        Ssl   35:40 PM2 v0.14.7: God Daemon                                                                 
There should be a process called PM2 v0.14.7: God Daemon

Now you can reboot your pi and check if the proces is still there running.

IF NOT, than the startup-script is not working, try to add them again.
To check if your 'dump-file' is correct, you can delete all processes from the list and force to load them again by doing

Code: Select all

pm2 delete all
pm2 resurrect
In fact, the last command is what the startup-script does. So if the above commands work, pm2 is working fine, but loading after the reboot does not work -> check startup-srcipt

Code: Select all

pm2 startup raspberry
sudo su -c "env PATH=$PATH:/usr/local/bin pm2 startup raspberry -u pi"

sudo chmod +x /etc/init.d/pm2-init.sh
Edit /etc/init.d/pm2-init.sh so that
export PM2_HOME="/home/pi/.pm2"
(was export PM2_HOME="/root/.pm2")

Code: Select all

sudo update-rc.d pm2-init.sh defaults
Hope this helps you fixing your problems, if not, just let me know...

Re: Siri / HomeKit support for Domoticz

Posted: Friday 28 August 2015 21:14
by G3rard
@Eduard, thanks for your help. Will try this after my holidays.
I think this must be working with the extra information you gave.

Re: Siri / HomeKit support for Domoticz

Posted: Saturday 29 August 2015 13:27
by wokkelp
Thank you for your help, without it I would have already thrown the raspberry out of the window.

However, with your elaborate description of PM2, here are my findings:

Executed PM2 list, the Homebridge process was running
Executed ps x, the PM2 daemon was running
I did a reboot of my raspberry and checked again if the PM2 deamon was running, unfortunately it wasn't.
I checked if my dump-file was correct.
Executed PM2 delete, PM2 warned me that there was no process found.
Executed PM2 resurrect, the HomeBridge process was running again.

Executed PM2 startup raspberry, noticed it showed the correct line with pm2 startup raspberry.
Executed chmod +x

Checked pm2-init.sh and noticed that export was still pi instead of root.

Did a reboot again and noticed that once again the PM2 deamon service was not running.

Re: Siri / HomeKit support for Domoticz

Posted: Saturday 29 August 2015 13:39
by Eduard
wokkelp wrote:Thank you for your help, without it I would have already thrown the raspberry out of the window.

However, with your elaborate description of PM2, here are my findings:

Executed PM2 list, the Homebridge process was running
Executed ps x, the PM2 daemon was running
I did a reboot of my raspberry and checked again if the PM2 deamon was running, unfortunately it wasn't.
I checked if my dump-file was correct.
Executed PM2 delete, PM2 warned me that there was no process found.
Executed PM2 resurrect, the HomeBridge process was running again.

Executed PM2 startup raspberry, noticed it showed the correct line with pm2 startup raspberry.
Executed chmod +x

Checked pm2-init.sh and noticed that export was still pi instead of root.

Did a reboot again and noticed that once again the PM2 deamon service was not running.
All looks fine until it reboots...
Did you do a

Code: Select all

sudo update-rc.d pm2-init.sh defaults
without problems?

Does the folder /home/pi/.pm2 exist?