Siri / HomeKit support for Domoticz

Moderator: leecollings

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

Re: Siri / HomeKit support for Domoticz

Post by lukeredpath »

For those having dimmer problems, are you using the latest HEAD of Homebridge? I submitted a fix for dimmer handling which was merged. Previously the shim was not using the MaxDimLevel property but hard coding to 0-15. I fixed this so the percentage that HomeKit requests gets translated to the appropriate level.

Dimming works fine for me but if only tested against LightwaveRF switches.
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:For those having dimmer problems, are you using the latest HEAD of Homebridge?
Hi, thanks for your quick reaction.
I'm not sure If I understand, what do you mean with latest "HEAD"? I recently installed with:

Code: Select all

git clone https://github.com/nfarina/homebridge.git
cd homebridge
git submodule init
git submodule update
npm install
Also just did a "git submodule update" but nothing happened. I saw your comments in the Domoticz.js module on my system, so that suggests that I'm using the latest version of that.

Sorry, I'm just a noob ;-)

* EDIT *
Also did a git pul (and noticed some changes) and a npm install but that makes no difference, still only 15% as maximum dim level.
lukeredpath
Posts: 10
Joined: Thursday 08 October 2015 14:22
Target OS: -
Domoticz version:
Contact:

Re: Siri / HomeKit support for Domoticz

Post by lukeredpath »

What light are you using? This sounds like a bug on the Domoticz side to me (or a change in behaviour). When you change brightness, he HomeKit level (a percentage) is translated to an integer value based on the MaxDimLevel. This value is passed to the Domoticz API using the SetLevel command.

So if MaxDimLevel is 15 and you set to 100%, it will call the Domoticz API with a switchcmd of SetLevel and a level of 15.

This behaviour works fine for LightwaveRF switches. It's as if the API is trying to set the level using the level value as a percentage so you end up with a maximum brightness of only 15% instead.

Try experimenting yourself by calling the API using different level values.

EDIT: just looked at the Domoticz API and it appears that some devices expect an integer level and some a percentage. So LightwaveRF requires a level (0-32) and your lights need a percentage.

Unfortunately I can't see anyway of handling both unless the API for fetching device info reveals what value it expects.
Bikey
Posts: 331
Joined: Sunday 22 February 2015 12:19
Target OS: Linux
Domoticz version: 2020.x
Location: Netherlands
Contact:

Siri / HomeKit support for Domoticz

Post by Bikey »

I think there is also a conversion issue in the bridge because in the App the slider only goes to 15%. So the App - confirmed by the logging of Homebridge - only sends values between 1 - 15.

So it looks like Homebridge is not calculating "15" to 100% and sending the 100% to Siri but sending 15% as the maximum level instead.

I am using KlikAanKlikuit (AC-protocol) lights with RFXCom.
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 »

Ok, I have done some testing with the Domoticz API by calling:

json.htm?type=command&param=switchlight&idx=8&switchcmd=Set%20Level&level=13 (levels between 1 and 16) and checking the results with
json.htm?type=devices&filter=light&used=true&order=Name

It shows that if you send a dimlevel between 1 and 16, the API returns with a dimlevel with a value between 1 and 15, with 1 being actually "Off" and 15 fully on at 100%. So e.g. sending level 10, results in
"LevelInt" : 9 and "Level" : 60 (= 60%). If I send any higher values then 16 the API returns no error but sets the level to 100%.

Note: you would expect that you would have to use values 0 - 15, but you have to use 1- 16. If you use 15 it results in a level of 93%, while 1 results in "Off".

Conclusion: API works (sort of) fine and can be called with integer levels between 1 and 16 to set the dimlevel between 0 and 100%.
So the bug must be in the bridge, not reporting/translating 1-16 to a value of 0% - 100% towards Siri/the App.
NewFolk
Posts: 39
Joined: Wednesday 02 September 2015 11:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Siri / HomeKit support for Domoticz

Post by NewFolk »

Thyraz wrote:[
That's not true.
Here's a screenshot using Elgato Eve Room and Siri on the Apple Watch:
temp.png
And after looking at the FHEM shim of Homebridge I think they already support more than switches...
Yes you are right
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 »

Hello Everyone,
Am using Homekit and Domoticz but It seems that the Eve app does not reflect the current state of Domoticz items if they are not switched on via Siri, is this normal ?
I have scenes and events in Domoticz that fire things off and Eve never knows about this.
Domoticz 3.5641 on RPI (Raspbian GNU/Linux 8)
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 »

deejc wrote:Hello Everyone,
Am using Homekit and Domoticz but It seems that the Eve app does not reflect the current state of Domoticz items if they are not switched on via Siri, is this normal ?
I have scenes and events in Domoticz that fire things off and Eve never knows about this.
Yes I have the same. But I don't think that should be, as the status of all devices is available for Homebridge. Don't know if this is a bug or by design.
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 »

Bikey wrote:Ok, I have done some testing with the Domoticz API by calling:

json.htm?type=command&param=switchlight&idx=8&switchcmd=Set%20Level&level=13 (levels between 1 and 16) and checking the results with
json.htm?type=devices&filter=light&used=true&order=Name

It shows that if you send a dimlevel between 1 and 16, the API returns with a dimlevel with a value between 1 and 15, with 1 being actually "Off" and 15 fully on at 100%. So e.g. sending level 10, results in
"LevelInt" : 9 and "Level" : 60 (= 60%). If I send any higher values then 16 the API returns no error but sets the level to 100%.

Note: you would expect that you would have to use values 0 - 15, but you have to use 1- 16. If you use 15 it results in a level of 93%, while 1 results in "Off".

Conclusion: API works (sort of) fine and can be called with integer levels between 1 and 16 to set the dimlevel between 0 and 100%.
So the bug must be in the bridge, not reporting/translating 1-16 to a value of 0% - 100% towards Siri/the App.
Do other people also have this issue; not being able to set a correct dimming value for RFXCom devices with Homebridge/Eve?
It would be really nice if there was somebody who could fix this ;-)
magga
Posts: 7
Joined: Wednesday 19 November 2014 14:57
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Siri / HomeKit support for Domoticz

Post by magga »

Yes I have a similar problem to the above, which I have tested just now, by asking Siri to set my office light to 50%. It replied with "Ok, I set the Office Light to 32%", and Domoticz reports the light as being set to 29%, so something is amiss here.

Another thing I am wanting to find out, is how I can differentiate blinds from lights. At the moment I have to ask it to set blinds to "on" and "off" rather than "open" and "close", as I would prefer. I believe I would need to set these devices as "shades" rather than "lights" within Eve, but as the devices are all discovered automatically, due to me using a roomplan, I'm not sure how to go about this - any ideas?
Attachments
IMG_9139.jpg
IMG_9139.jpg (23.39 KiB) Viewed 4288 times
magga
Posts: 7
Joined: Wednesday 19 November 2014 14:57
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Siri / HomeKit support for Domoticz

Post by magga »

Further to the above, if I try and set a light to anything above 32%, Siri reports it as 32% and the logs show the level as 10:

EventedHTTPServer [192.168.1.173] HTTP Repsonse is finished +6ms
[Domoticz] Office Light sent command setLevel (value: 10)
magga
Posts: 7
Joined: Wednesday 19 November 2014 14:57
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Siri / HomeKit support for Domoticz

Post by magga »

Thyraz wrote:
NewFolk wrote:
Thyraz wrote:Ok, to my earlier question: The Domoticzs platform shim only supports switches so far, no sensors.
Let's see if we get this hacked into the domoticz.js. :)

Siri does not support sensors.
https://support.apple.com/en-us/HT204893
That's not true.
Here's a screenshot using Elgato Eve Room and Siri on the Apple Watch:
temp.png
And after looking at the FHEM shim of Homebridge I think they already support more than switches...
Hi,

Can you let me know how you managed to get the temperatures to work? I have temperatures within Domoticz (on the temperature tab) for each of my rooms, but these do not show up in the Elgato Eve App as accessories, or anything similar, so Siri obviously cannot interact with them.

Thanks
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:I think there is also a conversion issue in the bridge because in the App the slider only goes to 15%. So the App - confirmed by the logging of Homebridge - only sends values between 1 - 15.
No, the bridge is working correctly. If the dimmer reports its MaxDimLevel as 15 then a 100% command from HomeKit will send a level of 15 to Domoticz.
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:
deejc wrote:Hello Everyone,
Am using Homekit and Domoticz but It seems that the Eve app does not reflect the current state of Domoticz items if they are not switched on via Siri, is this normal ?
I have scenes and events in Domoticz that fire things off and Eve never knows about this.
Yes I have the same. But I don't think that should be, as the status of all devices is available for Homebridge. Don't know if this is a bug or by design.
Not all devices have two way communication, e.g. LightwaveRF devices. Its not possible for HomeKit (or indeed Domoticz) to keep its status in sync.
lukeredpath
Posts: 10
Joined: Thursday 08 October 2015 14:22
Target OS: -
Domoticz version:
Contact:

Re: Siri / HomeKit support for Domoticz

Post by lukeredpath »

For people who are still having issues with this, can they let me know what the Domoticz API reports for the MaxDimLevel for their device?

The code in the Homebridge shim - and I've double checked it - will receive a percentage from HomeKit and it will always covert this to an integer by multiplying that percentage to the MaxDimLevel returned by the server. If the server is not returning an accurate MaxDimLevel value, it will send the wrong value. Likewise, if Domoticz is not correctly handling the dim level sent to it, it won't work.

Please also make sure you're running the latest version of Homebridge that has my fix from September.
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 »

Thanks for checking this:
As reported earlier, for my KaKu RFXCom dimmers, Domoticz returns: "MaxDimLevel" : 15

See the complete API-result
Spoiler: show
{
"AddjMulti" : 1.0,
"AddjMulti2" : 1.0,
"AddjValue" : 0.0,
"AddjValue2" : 0.0,
"BatteryLevel" : 255,
"CustomImage" : 0,
"Data" : "Set Level: 93 %, Level: 93 %",
"Description" : "",
"Favorite" : 1,
"HardwareID" : 2,
"HardwareName" : "RFXCOM",
"HardwareType" : "RFXCOM - RFXtrx433 USB 433.92MHz Transceiver",
"HardwareTypeVal" : 1,
"HaveDimmer" : true,
"HaveGroupCmd" : true,
"HaveTimeout" : false,
"ID" : "0907196",
"Image" : "Light",
"IsSubDevice" : false,
"LastUpdate" : "2015-10-18 22:26:29",
"Level" : 93,
"LevelInt" : 14,
"MaxDimLevel" : 15,
"Name" : "DimmableLamp",
"Notifications" : "false",
"PlanID" : "2",
"PlanIDs" : [ 2, 16 ],
"Protected" : false,
"ShowNotifications" : true,
"SignalLevel" : 7,
"Status" : "Set Level: 93 %",
"StrParam1" : "",
"StrParam2" : "",
"SubType" : "AC",
"SwitchType" : "Dimmer",
"SwitchTypeVal" : 7,
"Timers" : "false",
"Type" : "Lighting 2",
"TypeImg" : "dimmer",
"Unit" : 4,
"Used" : 1,
"UsedByCamera" : false,
"XOffset" : "66",
"YOffset" : "54",
"idx" : "25"
}
This lamp can be dimmed properly via the Domoticz API with json.htm?type=command&param=switchlight&idx=8&switchcmd=Set%20Level&level=x
With x = levels between 1 and 16

So Domoticz is reporting the MaxDimlevel = 15 and can be controlled by values between 1 and 16.

If however I look at the Elgate Eve App it only reports a max percentage of 15%! So for some reason the server does not do the conversion from 15 to 100%

EDIT:
I'm not a coder but to me it looks like the MaxDimValue as reported to Siri is not converted to a percentage, it is only converted the other way around: from Siri percentage to a level-value for Domoticz. Could that be the bug?
EDIT2:
If MaxDimlevel=15 the range of values that has to be send to Domoticz must be between 1 and 16!
Jem101
Posts: 66
Joined: Saturday 02 May 2015 21:26
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Bexleyheath, SE London, UK
Contact:

Re: Siri / HomeKit support for Domoticz

Post by Jem101 »

lukeredpath wrote:
Bikey wrote:
deejc wrote:Hello Everyone,
Am using Homekit and Domoticz but It seems that the Eve app does not reflect the current state of Domoticz items if they are not switched on via Siri, is this normal ?
I have scenes and events in Domoticz that fire things off and Eve never knows about this.
Yes I have the same. But I don't think that should be, as the status of all devices is available for Homebridge. Don't know if this is a bug or by design.
Not all devices have two way communication, e.g. LightwaveRF devices. Its not possible for HomeKit (or indeed Domoticz) to keep its status in sync.

I understand that some devices don't report back their status, I have a couple of LightwaveRF switches which can't tell Domoticz that they have been manually activated but isn't it the case that in this scenario homebridge is the one and only 'device' as far as HomeKit is concerned?

If I use siri to turn on a light then the light turns on and Domoticz reflects this action. I assume that homebridge is forwarding the command to Domoticz which does the actual light switching. In the Eve app the status also changes.

But if I just use Domoticz itself to turn on the light then this change is not being sent back to HomeKit and hence the Eve app (or any of the other HomeKit apps I've tried) doesn't know that the light is on.

In seems as if Homebridge itself is only one-way, it is capable of accepting commands from HomeKit and forwarding them on to Domoticz but can't receive status changes from Domoticz or if it can, doesn't send these to HomeKit itself.

Is this right? Is it something which homebridge can't or doesn't support or is the issue with Domoticz?

I am wondering if it is related to thermometers which work fine in Domoticz, but don't appear in the Eve app - again it looks as if Domoticz is unable to 'push' information to homebridge.
I firmly believe in having an open mind - although not so open that your brain falls out!

- sometimes attributed to Carl Sagan, but the original quote is much older than that
trekker25
Posts: 40
Joined: Tuesday 26 May 2015 10:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Siri / HomeKit support for Domoticz

Post by trekker25 »

am i correct that if Siri understands "all lights out" (together Eve running) and i select yes, that all lights are switched "very dum"? (lights that are out will go on, lights that are on will go out.)

Got it installed after 2 hours of struggling, but now need to find out how to control this correctly with Eve.

For example i have scene in Domoticz called "ambianceLightsON" and "ambianceLightsOFF". Siri doesn't know how to handle such stuff. Needs some tweaking and not sure which is possible already!
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:
Not all devices have two way communication, e.g. LightwaveRF devices. Its not possible for HomeKit (or indeed Domoticz) to keep its status in sync.
i understand the concept,i have z-wave devices and rfxcom devices, Domoticz knows about the state of certain devices when i use the web gui but firing Eve up it does not reflect the state of these devices.
Last edited by deejc on Friday 30 October 2015 6:56, edited 1 time in total.
Domoticz 3.5641 on RPI (Raspbian GNU/Linux 8)
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:Thanks for checking this:
As reported earlier, for my KaKu RFXCom dimmers, Domoticz returns: "MaxDimLevel" : 15

See the complete API-result
Spoiler: show
{
"AddjMulti" : 1.0,
"AddjMulti2" : 1.0,
"AddjValue" : 0.0,
"AddjValue2" : 0.0,
"BatteryLevel" : 255,
"CustomImage" : 0,
"Data" : "Set Level: 93 %, Level: 93 %",
"Description" : "",
"Favorite" : 1,
"HardwareID" : 2,
"HardwareName" : "RFXCOM",
"HardwareType" : "RFXCOM - RFXtrx433 USB 433.92MHz Transceiver",
"HardwareTypeVal" : 1,
"HaveDimmer" : true,
"HaveGroupCmd" : true,
"HaveTimeout" : false,
"ID" : "0907196",
"Image" : "Light",
"IsSubDevice" : false,
"LastUpdate" : "2015-10-18 22:26:29",
"Level" : 93,
"LevelInt" : 14,
"MaxDimLevel" : 15,
"Name" : "DimmableLamp",
"Notifications" : "false",
"PlanID" : "2",
"PlanIDs" : [ 2, 16 ],
"Protected" : false,
"ShowNotifications" : true,
"SignalLevel" : 7,
"Status" : "Set Level: 93 %",
"StrParam1" : "",
"StrParam2" : "",
"SubType" : "AC",
"SwitchType" : "Dimmer",
"SwitchTypeVal" : 7,
"Timers" : "false",
"Type" : "Lighting 2",
"TypeImg" : "dimmer",
"Unit" : 4,
"Used" : 1,
"UsedByCamera" : false,
"XOffset" : "66",
"YOffset" : "54",
"idx" : "25"
}
This lamp can be dimmed properly via the Domoticz API with json.htm?type=command&param=switchlight&idx=8&switchcmd=Set%20Level&level=x
With x = levels between 1 and 16

So Domoticz is reporting the MaxDimlevel = 15 and can be controlled by values between 1 and 16.

If however I look at the Elgate Eve App it only reports a max percentage of 15%! So for some reason the server does not do the conversion from 15 to 100%

EDIT:
I'm not a coder but to me it looks like the MaxDimValue as reported to Siri is not converted to a percentage, it is only converted the other way around: from Siri percentage to a level-value for Domoticz. Could that be the bug?
EDIT2:
If MaxDimlevel=15 the range of values that has to be send to Domoticz must be between 1 and 16!
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.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest