[homekit] Homekit sending ON and 100 Command

Hi there,

I’m using openHAB 2.5.5 (latest) and having problems configuring my homekit the right way.

I will controll a Dimmable KNX Switch with homekit. When i klick the icon in the iOS Home App. Its sending a ON and 100 Command at the same time. The actor has timebased start percentage but its get overwritten by the command.

my item Devinition

Dimmer			Licht_Flur_Spot					"Spots Flur"										<light>			(light)					{homekit="Lighting, Lighting.Brightness", alexa="PowerController.powerState,BrightnessController.brightness" [category="LIGHT"] ,channel="knx:device:bridge:led3:Licht_Flur_Spot", autoupdate="false" }

The knx thing definition

            Type dimmer        : Licht_Flur_Spot                "Spots Flur"                        [ switch="1/1/130+<1/1/133", position="1/1/132+<1/1/134", increaseDecrease="1/1/131" ]

Some log action
image

Thanks for help!

Hi Julian,

yes, that what iOS home app sends if you click on the icon. It sends 2 separate updates:
Switch = On
Brightness = 100%

not sure what we can do it about it. it could also desired behaviour for some devices.

just thinking out loud here - in your case we need the logic:

  • ignore brightness=100% if openHAB has received Switch=On in the last 2 seconds

right?

For me, the Brightness does not have to be send when the on command is send. This could be a solution…

I don’t know if there is any device wich will have to get both commands.

the challenge here - both are independent changes and from the openHAB binding perspective we dont know whether it was one click on the icon or the user did 2 different actions: click on “on” and “increase brightness to 100%”. proper fix can be done only by Apple in home app - icon click = ON.

there are similar discussions for other homekit implementations
https://github.com/home-assistant/core/issues/13768
https://github.com/snowdd1/homebridge-knx/issues/47

and apparently no proper solution just some workarounds like wait 20ms and if you get the second command, ignore ON event.

probably we should try to do the same.

1 Like

I’ve connected all HomeKit dimmers via NodeRed because of this behaviour of the openhab HomeKit binding.

If I click on the icon in the home app the light turns on with the brightness level the light had when it was on the last time.

I realised today, that the HomeKit binding has made big step since I checked it the last time. This bug (yes it is and definitely not a feature) unfortunately still exists.

there is PR out there that should fix this. it will support serval modes for dimmer behaviour including filtering out brightness or ON event.
https://github.com/openhab/openhab-addons/pull/7825

it would great if you could check once it is merged / next snapshot is released and give us your feedback.

Sure. Will do.

In which snapshot would I find this? I got the confirmation that the commit “e271705” is merged. In the snapshot I installed afterwards (2.5.6 Build #139), I cannot identify any different behaviour.

we have added different modes / filters.
please add dimmerMode to your configuration.
it should look like this

 Dimmer dimmer_light_3	"Dimmer Light 3" 	 {homekit="Lighting, Lighting.Brightness" [dimmerMode="filterOnExceptBrightness100"]}

seems still not to work on openHAB 2.5.6 Build #139.

I just installed a fresh instance. I created an item with the exact configuration (copy and paste).
Dimmer dimmer_light_3 “Dimmer Light 3” {homekit=“Lighting, Lighting.Brightness” [dimmerMode=“filterOnExceptBrightness100”]}

I should find this in the latest snapshot 2.5.6 #139, right?

now sure how to get the build number but if i execute
openhab> bundle update 513 JFrog
image

i get latest snapshot
image

and brightness logic is working there as expected
image

I also updated the bundle like @yfre did (and did a restart of openhab2.service). But it doesnt work for me. Looks like the 50ms are to short
image
image

But thanks for all the work! You guys did a nice job. Thanks a lot!

thanks a lot Julian for testing!

could you please try one more time. increase delay to 100 or so
Dimmer dimmer_light_3 “Dimmer Light 3” {homekit=“Lighting, Lighting.Brightness” [dimmerMode=“filterOnExceptBrightness100”, commandDelay=100]}

Unfortunately still not working at my side. I tried 100ms and even higher stuff like 1000ms. I also did the same update procedure, didn’t I? Any idea to test?

image

image

strange.
can you please try enable logging in karaf with

openhab> log:set TRACE org.openhab.io.homekit

im looking for this sequence. it will tell which commands it has received from home app and which command it has sent to item.

2020-06-10 14:54:09.313 [TRACE] [.homekit.internal.HomekitOHItemProxy] - add command to command cache: item org.openhab.io.homekit.internal.HomekitOHItemProxy@4d53a681, command type ON_COMMAND, command state ON. cache state after: {ON_COMMAND=ON}
2020-06-10 14:54:09.314 [TRACE] [.homekit.internal.HomekitOHItemProxy] - add command to command cache: item org.openhab.io.homekit.internal.HomekitOHItemProxy@4d53a681, command type BRIGHTNESS_COMMAND, command state 100. cache state after: {ON_COMMAND=ON, BRIGHTNESS_COMMAND=100}
2020-06-10 14:54:09.314 [TRACE] [.homekit.internal.HomekitOHItemProxy] - send OnOff command for item dimmer_light_2 (Type=DimmerItem, State=NULL, Label=Dimmer Light Test 2, Category=null) with value ON

thanks for helping me out. here is what I got:

image

here is the current item:
image

I miss the “Proxy stuff” in my log.

thank you. but i need log from homekit binding.
it should something with “homekit.internal.HomekitOHItemProxy”..
pls execute this

log:set TRACE org.openhab.io.homekit
log:display  | grep OHItemProxy

I guess, I miss something important here. I’m in the console, that’s correct, right? Please see my logging settings.

image