Siri / HomeKit support for Domoticz

Moderator: leecollings

deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: Siri / HomeKit support for Domoticz

Post by deennoo »

alexsh1 wrote:

I believe the image on the SD card is for ARM (Raspberry Pi) - you would need to find a binary or compile Domoticz for i386
exactlly what i'm trying to do using :

- domoticz wiki : fail,
- homebridge wiki fail,
- homebridge on pi and 2 adapt to i386 : fail.

got a starting succes using NVM :

https://github.com/creationix/nvm

new error is :

Code: Select all

Homebridge is running on port 51826.
/home/android/.nvm/versions/node/v4.2.2/lib/node_modules/homebridge/node_modules/hap-nodejs/node_modules/mdns/lib/advertisement.js:56
  dns_sd.DNSServiceRegister(self.serviceRef, flags, ifaceIdx, name,
         ^

Error: dns service error: unknown
    at Error (native)
    at new Advertisement (/home/android/.nvm/versions/node/v4.2.2/lib/node_modules/homebridge/node_modules/hap-nodejs/node_modules/mdns/lib/advertisement.js:56:10)
    at Object.create [as createAdvertisement] (/home/android/.nvm/versions/node/v4.2.2/lib/node_modules/homebridge/node_modules/hap-nodejs/node_modules/mdns/lib/advertisement.js:64:10)
    at Advertiser.startAdvertising (/home/android/.nvm/versions/node/v4.2.2/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Advertiser.js:43:30)
    at Bridge.Accessory._onListening (/home/android/.nvm/versions/node/v4.2.2/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:352:20)
    at emitNone (events.js:67:13)
    at HAPServer.emit (events.js:166:7)
    at HAPServer._onListening (/home/android/.nvm/versions/node/v4.2.2/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/HAPServer.js:153:8)
    at emitNone (events.js:67:13)
    at EventedHTTPServer.emit (events.js:166:7)
Found that Avahi server don't start :

Code: Select all

android@localhost:~$ sudo avahi-daemon --debug
Found user 'avahi' (UID 103) and group 'avahi' (GID 105).
Successfully dropped root privileges.
avahi-daemon 0.6.31 starting up.
Successfully called chroot().
Successfully dropped remaining capabilities.
No service file found in /etc/avahi/services.
socket() failed: Permission denied
socket() failed: Permission denied
Failed to create server: No suitable network protocol available
avahi-daemon 0.6.31 exiting.
Some idea ?
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
simon_rb
Posts: 612
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: Siri / HomeKit support for Domoticz

Post by simon_rb »

Right,

I have a spare raspberry pi lying about so I decided to install homebridge onto that. Managed to get it running however when I use eve or any another app to connect it finds homebridge but it will not pair. I did notice the undefined on the terminal console:-

[Domoticz] Loaded services for Sky Remote Switch
[Domoticz] Initializing platform accessory 'Skybox F5S Remote'...
[Domoticz] Loaded services for Skybox F5S Remote
[Domoticz] Initializing platform accessory 'Xbox Remote'...
[Domoticz] Loaded services for Xbox Remote
Scan this code with your HomeKit App on your iOS device to pair with Homebridge:

┌────────────┐
│ undefined │
└────────────┘

Homebridge is running on port 51826.

I noticed in my config.json file there is no mention of pin code like in the sample. I just have domoticz part in it. I will attempt to add that and see what happens.
simon_rb
Posts: 612
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: Siri / HomeKit support for Domoticz

Post by simon_rb »

Well I managed to get it working for 2 mins. I got one of the switches to turn on then off again, only once using Siri. Now Siri says it can't do that. When I load Eve all the devices I added are "unreachable"

Does this happen to everyone else? I remember having this trouble 6 months ago with iOS 8 and assumed this issue was fixed with iOS 9. Can anyone shed any light on this?

Cheers

Update:- Well its hit and miss at the moment. Are all domoticz switches sent as light switches? I have some curtains that i'd like to open using the open and close command but siri says it can't find any blinds at this time.

Cheers
lukeredpath
Posts: 10
Joined: Thursday 08 October 2015 14:22
Target OS: -
Domoticz version:
Contact:

Re: Siri / HomeKit support for Domoticz

Post by lukeredpath »

Bikey wrote:
Bikey wrote:
lukeredpath wrote:
Ok I'm with you now, so the problem is not setting the level but that the level is not being reported correctly in the other direction? It's possible there's a similar bug, I will take a look.

I still think it's a bug on the Domoticz side that it accepts levels between 1-16 if it's max dim level is 15 though.
Yes, that's is correct. As a result of the level not reported correctly to Siri, it only will send limited levels back as a command.
You are right that 1-16 as command values for a MaxdimLevel of 15 is questionable, although this is as described I the WiKi
Ok, I just tested things by changing Domoticz.js in the platforms directory.
I have changed line 329:
designedMaxValue: this.MaxDimLevel
to:
designedMaxValue: 100

Now Siri sees a maximum level of 100%. If I ask Siri to dim back to 50% it sends a level 8 to Domoticz (50% * 15 rounded upwards to 8. 49% results in level 7). That now works perfect!
Funnily enough I was just looking into this again and trying the same fix. I've upgraded my Homebridge installation to the latest version which now uses Node plugins.

I will test this a bit more and if it works I will submit a pull request to get this fixed. What I can't see is where its getting the current power/dimmer state from or how often it updates itself.
Now there is only still one bug: Domoticz reports back a MaxDimLevel of 15 but needs values between 1 - 16. Also if you send e.g. 8 as a command in JSON you get back a level 7!
This still seems like a Domoticz bug to me.
lukeredpath
Posts: 10
Joined: Thursday 08 October 2015 14:22
Target OS: -
Domoticz version:
Contact:

Re: Siri / HomeKit support for Domoticz

Post by lukeredpath »

Bikey wrote:Ok, I have also solved the other issue being that Domticz expects for RFXCOM-based (KaKu) dimmers values between 1-16, even if it reports MaxDimLevel 15 in the API.
I have changed the following in the Domoticz.js file in the platforms subdirectory:

In this function:

dimmerLevelForValue: function(value) {
if (this.MaxDimLevel == 100) {
return value;}
return Math.round(((value / 100.0) * this.MaxDimLevel)+1) }

I have changed:
return Math.round((value / 100.0) * this.MaxDimLevel)
to:
return Math.round(((value / 100.0) * this.MaxDimLevel)+1)

Now finally I can get my dimmers back to 100%! And the other values % SIRI reports now more closely match the values as being reported in the GUI of Domoticz.

I'm not sure if this also is needed for other non-RFXCOM/KaKu dimmer-devices that work with values instead of % in the API. Are there others that work this way?
Perhaps others can check if that works for your configuration as well?
Unfortunately this isn't a viable permanent fix as it would then break devices that work correctly with the current code.

This needs to be fixed on the Domoticz side.
lukeredpath
Posts: 10
Joined: Thursday 08 October 2015 14:22
Target OS: -
Domoticz version:
Contact:

Re: Siri / HomeKit support for Domoticz

Post by lukeredpath »

I think I'm going to look into re-writing the Domoticz plugin and trying to get it moved into a standalone Node plugin.

The underlaying HAP framework that this is based on has a much better high level API for defining accessories and characteristics (compare the code in the Nest plugin to the Domoticz one for example: https://github.com/KraigM/homebridge-ne ... r/index.js). Not only that, but characteristics can have callbacks associated with them that are called when HomeKit requests an accessory's state so I should be able to get HomeKit to accurately show the current state as it is in Domoticz.
simon_rb
Posts: 612
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: Siri / HomeKit support for Domoticz

Post by simon_rb »

lukeredpath wrote:I think I'm going to look into re-writing the Domoticz plugin and trying to get it moved into a standalone Node plugin.

The underlaying HAP framework that this is based on has a much better high level API for defining accessories and characteristics (compare the code in the Nest plugin to the Domoticz one for example: https://github.com/KraigM/homebridge-ne ... r/index.js). Not only that, but characteristics can have callbacks associated with them that are called when HomeKit requests an accessory's state so I should be able to get HomeKit to accurately show the current state as it is in Domoticz.
Good luck with that! Looking forward to see how you get on :-)


Sent from my iPhone using Tapatalk
simon_rb
Posts: 612
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: Siri / HomeKit support for Domoticz

Post by simon_rb »

Last night I got this half working. This morning I am getting this error

EDIT:- Think I had a version already running so killed it and its running without errors at the moment but still can't pair.

Code: Select all

Scan this code with your HomeKit App on your iOS device to pair with Homebridge:                       
    ┌────────────┐     
    │ 031-45-154 │     
    └────────────┘     
                       
Homebridge is running on port 51826.
events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE :::51826
    at Object.exports._errnoException (util.js:837:11)
    at exports._exceptionWithHostPort (util.js:860:20)
    at Server._listen2 (net.js:1231:14)
    at listen (net.js:1267:10)
    at Server.listen (net.js:1363:5)
    at EventedHTTPServer.listen (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/util/eventedhttp.js:58:19)
    at HAPServer.listen (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/HAPServer.js:132:20)
    at Bridge.Accessory.publish (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:347:16)
    at Server._publish (/usr/local/lib/node_modules/homebridge/lib/server.js:50:16)
    at Server.<anonymous> (/usr/local/lib/node_modules/homebridge/lib/server.js:220:14)
Bikey
Posts: 331
Joined: Sunday 22 February 2015 12:19
Target OS: Linux
Domoticz version: 2020.x
Location: Netherlands
Contact:

Re: Siri / HomeKit support for Domoticz

Post by Bikey »

lukeredpath wrote:
Bikey wrote:Ok, I have also solved the other issue being that Domticz expects for RFXCOM-based (KaKu) dimmers values between 1-16, even if it reports MaxDimLevel 15 in the API.
I have changed the following in the Domoticz.js file in the platforms subdirectory:

In this function:

dimmerLevelForValue: function(value) {
if (this.MaxDimLevel == 100) {
return value;}
return Math.round(((value / 100.0) * this.MaxDimLevel)+1) }

I have changed:
return Math.round((value / 100.0) * this.MaxDimLevel)
to:
return Math.round(((value / 100.0) * this.MaxDimLevel)+1)

Now finally I can get my dimmers back to 100%! And the other values % SIRI reports now more closely match the values as being reported in the GUI of Domoticz.

I'm not sure if this also is needed for other non-RFXCOM/KaKu dimmer-devices that work with values instead of % in the API. Are there others that work this way?
Perhaps others can check if that works for your configuration as well?
Unfortunately this isn't a viable permanent fix as it would then break devices that work correctly with the current code.

This needs to be fixed on the Domoticz side.
I agree, but it looks like that is not going to happen (soon): GizmoGuz explained in this bug report I opened that that would require changing the GUI-code, which he does not want to do...

What devices do not work correctly anymore with the proposed fix? Perhaps the code could check first on the device type ?
Bikey
Posts: 331
Joined: Sunday 22 February 2015 12:19
Target OS: Linux
Domoticz version: 2020.x
Location: Netherlands
Contact:

Re: Siri / HomeKit support for Domoticz

Post by Bikey »

lukeredpath wrote:I think I'm going to look into re-writing the Domoticz plugin and trying to get it moved into a standalone Node plugin.

The underlaying HAP framework that this is based on has a much better high level API for defining accessories and characteristics (compare the code in the Nest plugin to the Domoticz one for example: https://github.com/KraigM/homebridge-ne ... r/index.js). Not only that, but characteristics can have callbacks associated with them that are called when HomeKit requests an accessory's state so I should be able to get HomeKit to accurately show the current state as it is in Domoticz.
That would be great, as it would also solve that currently Homebridge does not report the status of the Domoticz devices back to Siri.
User avatar
deejc
Posts: 168
Joined: Tuesday 22 September 2015 18:50
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5641
Location: UK
Contact:

Re: Siri / HomeKit support for Domoticz

Post by deejc »

Getting it to report the current status as reflected in domoticz would be the ultimate plugin, domoticz is way better with scenes and events than HomeKit probably ever will be but you can't really have both right now as Siri doesn't know the current status if an event fires. I love domoticz for the events and scenes but also equally have love for Siri and the ease of use it brings, combined properly they would blow anything else around out of the water
I am really looking forward to this if it can be done.
Cheers



Sent from my iPhone using Tapatalk
Domoticz 3.5641 on RPI (Raspbian GNU/Linux 8)
User avatar
deejc
Posts: 168
Joined: Tuesday 22 September 2015 18:50
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5641
Location: UK
Contact:

Re: Siri / HomeKit support for Domoticz

Post by deejc »

lukeredpath wrote:I think I'm going to look into re-writing the Domoticz plugin and trying to get it moved into a standalone Node plugin.
are you aware that the homebridge project is spinning all the shims out into separate plugins now ?
Domoticz 3.5641 on RPI (Raspbian GNU/Linux 8)
frizby66
Posts: 33
Joined: Friday 13 November 2015 17:36
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Siri / HomeKit support for Domoticz

Post by frizby66 »

Sorry of this has been discussed, but having an issue with Lightwaverf dimmers and domoiticz.js and like others am seeing the issue of 16 v 100% value. Been messing around with JSON and when I send the

Code: Select all

http://192.168.1.169:8080/json.htm?type=command&param=switchlight&idx=7&switchcmd=Set%20Level&level=32
I get 100% brightness and when I send

Code: Select all

http://192.168.1.169:8080/json.htm?type=command&param=switchlight&idx=7&switchcmd=Set%20Level&level=16
I get 50% brightness.

I see lukeredpath commented that domoticz.sj was fixed for lightwaverf devices but it is still a problem. Is there anyway I can code this into Domoticz.js for Lightwaverf devices?
--------------------
Raspberry Pi2, RTX433e USB, Philips Hue, Nest, LightwaveRF.
Bikey
Posts: 331
Joined: Sunday 22 February 2015 12:19
Target OS: Linux
Domoticz version: 2020.x
Location: Netherlands
Contact:

Re: Siri / HomeKit support for Domoticz

Post by Bikey »

That is interesting, I wonder what the MaxDimLevel as reported with JSON? With KaKu RFXCOM dimmers it is 16, but you have to set a 17 to get a 100% light level.
malarcy
Posts: 50
Joined: Sunday 15 November 2015 13:36
Target OS: Linux
Domoticz version:
Contact:

Re: Siri / HomeKit support for Domoticz

Post by malarcy »

Similar but different for me.

I cannot get full brightness from EVE for a lightwaverf lamp - when I make the lamp as bright as possible - the slider reaches max (slides all the way to the right) - but says thats 32% - and the lamp is correspondingly "dim".
Bikey
Posts: 331
Joined: Sunday 22 February 2015 12:19
Target OS: Linux
Domoticz version: 2020.x
Location: Netherlands
Contact:

Re: Siri / HomeKit support for Domoticz

Post by Bikey »

malarcy wrote:Similar but different for me.

I cannot get full brightness from EVE for a lightwaverf lamp - when I make the lamp as bright as possible - the slider reaches max (slides all the way to the right) - but says thats 32% - and the lamp is correspondingly "dim".
That is a bug I also ran into. Homebridge reports the MaxDimLevel to Homekit, instead of 100% as I found earlier, see my post about it.

You have to change line 329 in the Domoticz.js file in the platforms directory.:
designedMaxValue: this.MaxDimLevel
to:
designedMaxValue: 100
frizby66
Posts: 33
Joined: Friday 13 November 2015 17:36
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Siri / HomeKit support for Domoticz

Post by frizby66 »

Here is what JSON reports back for the LightwaveRF dimmer, which makes sense :-

Code: Select all

"MaxDimLevel" : 32,
Have now added an HE-108 Dimmer and its the same, even though it reports back:-

Code: Select all

"MaxDimLevel" : 15,
Tried to edit line 329 and it made no difference!

Any ideas?
--------------------
Raspberry Pi2, RTX433e USB, Philips Hue, Nest, LightwaveRF.
Bikey
Posts: 331
Joined: Sunday 22 February 2015 12:19
Target OS: Linux
Domoticz version: 2020.x
Location: Netherlands
Contact:

Re: Siri / HomeKit support for Domoticz

Post by Bikey »

frizby66 wrote:Here is what JSON reports back for the LightwaveRF dimmer, which makes sense :-

Code: Select all

"MaxDimLevel" : 32,
Have now added an HE-108 Dimmer and its the same, even though it reports back:-

Code: Select all

"MaxDimLevel" : 15,
Tried to edit line 329 and it made no difference!

Any ideas?
Is SIRI (or Eve/Insteon) showing a maximum range of 0 - 100% or 15% resp. 32% ?
Did you restart the service?
frizby66
Posts: 33
Joined: Friday 13 November 2015 17:36
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Siri / HomeKit support for Domoticz

Post by frizby66 »

Had been testing with Insteon+ showing 100% and Domoticz shows the light at anything from 6% through to 30%. Tested with Eve and the HE-108 Lights are now working perfectly. LightwaveRF is also working now.....very strange!
--------------------
Raspberry Pi2, RTX433e USB, Philips Hue, Nest, LightwaveRF.
malarcy
Posts: 50
Joined: Sunday 15 November 2015 13:36
Target OS: Linux
Domoticz version:
Contact:

Re: Siri / HomeKit support for Domoticz

Post by malarcy »

Bikey wrote:
malarcy wrote:Similar but different for me.

I cannot get full brightness from EVE for a lightwaverf lamp - when I make the lamp as bright as possible - the slider reaches max (slides all the way to the right) - but says thats 32% - and the lamp is correspondingly "dim".
That is a bug I also ran into. Homebridge reports the MaxDimLevel to Homekit, instead of 100% as I found earlier, see my post about it.

You have to change line 329 in the Domoticz.js file in the platforms directory.:
designedMaxValue: this.MaxDimLevel
to:
designedMaxValue: 100
Thanks - that works for me - this fix works for my limited setup/testing.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest