swttt / com.swttt.homekit

Homekit for Homey
https://apps.athom.com/app/com.swttt.homekit
GNU Affero General Public License v3.0
35 stars 20 forks source link

Possible request: Set lights to last state when turning on light from the Home-app #216

Closed MNHPetersen closed 1 year ago

MNHPetersen commented 2 years ago

Thanks for a fantastic app. It is so much better than the built in experimental.

I have a request. I really don't know if it's possible but I'll try. When I turn on lights in the Home-app all lights are at max brightness except the Hue lights which are connected to the Homey through the Hue bridge. They turn on with last state. I've tried to do some research and it seems like when you turn on light in the Home app, HomeKit send two commands; turn lights on and set brightness to 100 %. My guess is that the Hue bridge ignores the last command. Is it possible to implement the same in the HomeyKit-app, either by default or as a choice? Or am I missing something? πŸ˜ƒ

robertklep commented 2 years ago

HomeyKit doesn't track to which app a device belongs, it treats all "light" devices the same. It also does a rather basic "translation" between HomeKit and Homey and it doesn't track device states (it only reacts to state changes).

In other words, I don't think HomeyKit is the right place to implement something like this (also, it's not entirely clear to me what exactly you're asking: do you want the Hue bulbs to always be turned on to 100%, or do you want the bulbs from other brands to always use the last state when they get turned on?).

MNHPetersen commented 2 years ago

Sorry for not being clear. I want all light to turn on with last state. Let’s say brightness was 1 % in the kids room and I want to check on them at night. If I turn on the light in the Home app then brightness is 100 %. I want it to still be 1 %. πŸ˜€

robertklep commented 2 years ago

I think this may also be hardware-related, some brands just turn on their lights at 100% all the time.

In any case, since HomeyKit doesn't track device states (it basically works like this: when iOS tells it to turn on a light, HomeyKit tells Homey to turn on the light. When Homey turns on a light, HomeyKit tells iOS a light was turned on), there's not much I can do anyway.

MNHPetersen commented 2 years ago

I don't think it's hardware-related as in the lights. I've tested with a Hue bulb. When it's connected to the Bridge -> Homey (Hue by Athom-app) -> HomeyKit it sets the last state when turned on. When it's connect directly to Homey (Hue without Bridge-app) -> HomeyKit it sets 100 % brightness when turned on.

robertklep commented 2 years ago

In that case, it sounds like the Hue bridge is tracking the last state for each device. If you want something similar with Homey, I think you'll have to ask Athom to implement this behaviour.

MNHPetersen commented 2 years ago

When you turn on the light in the Homey-app the light turns on with last state. That's why I think this is related to HomeKit and how HomeKit turns light on. And again why I hoped this could be "fixed" in the HomeyKit-app. πŸ˜€

BTW: I'm the only one using the Homey-app. The rest of the family use the Home-app (HomeKit).

robertklep commented 2 years ago

I don't understand: you're saying in this comment that when using the Hue bridge app on Homey, the lights turn on to their last state, and when using the lights directly connected to Homey, the lights turn on to 100%.

That would suggest to me that it's the Hue bridge that is turning on the lights to their last state. For other lights to do the same, their controlling device (which usually is Homey) should implement this. I don't see how HomeyKit factors into this, especially because it has no notion of a "last state" for any device.

MNHPetersen commented 2 years ago

I have most light added directly to Homey (Namron Zigbee dimmer and some Hue bulbs), and some Hue bulbs added to Hue bridge (and added to Homey with Hue by Athom). There are two scenarios or types of behavior when turning on the light:

  1. Homey-app and wall switches (Zigbee): All light turns on with last state

  2. Home-app (HomeKit): Lights connected to the Hue Bridge turn on with last state and the rest with 100 % brightness.

robertklep commented 2 years ago

In that case, Apple should stop sending two commands when turning on a light 😬 HomeyKit can't differentiate (at least not easily) if a "dim" command (which is used to set brightness) is related to an "onoff" command or to manual input from a user. Like I said, it just translates commands between iOS and Homey.

I also don't understand how the Hue bridge "knows" when to ignore setting the brightness, the app has no idea that the command came from HomeyKit.

MNHPetersen commented 2 years ago

In that case, Apple should stop sending two commands when turning on a light 😬

I'll drop Tim an email. πŸ˜†

I also don't understand how the Hue bridge "knows" when to ignore setting the brightness, the app has no idea that the command came from HomeyKit.

I don't either. I just see the behavior. But thanks for taking the time to answer me.