-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switching a light on at a specified light level #80
Comments
Hey, I think if setting light_level before lamp_on does not work, there is no way to do it. In the app it is also not possible to set the light level if the light is not on so it looks like it is not possible. |
Do the lights accept multiple attributes being sent at once, rather than separately setting lamp_on, then light_level, then color_temperature etc? I wonder how the scenes do it. So something like: light.set_attributes(lamp_on=True, light_level=90) |
Uh that is a good point, that should probably work! I will test this in the upcoming days. |
Sadly, it does not seem to work. So what I tried is the following with the current version of the package (you can do this as well since the
l = dirigera_hub.get_light_by_name("lamp1")
data = [
{
"attributes": {
"lightLevel": 100,
"isOn": False,
}
},
]
dirigera_hub.patch(route=f"/devices/{l.id}", data=data) With this only the first attribute is executed, in this case the
l = dirigera_hub.get_light_by_name("lamp1")
data = [
{
"attributes": {
"isOn": True,
}
},
{
"attributes": {
"lightLevel": 10,
}
},
]
dirigera_hub.patch(route=f"/devices/{l.id}", data=data) In this case, the behavior is very strange.
@famichiki can you test test this an let me know if this helps? If it seems to behave deterministically I could add it to the library. |
I'm seeing the same behaviour as you described, so can only set the brightness after the light is on. However when using two attribute objects the transition is much faster as it doesn't do a fade. But I've found that if you trigger a scene which has only The following will create a hidden scene that specifies brightness only, triggers it, then immediately deletes it. If the light is on, the brightness will change, if it's off it will stay off.
I initially tried this with a Perhaps the existing My original goal with this was to set overnight hours where a light's default brightness was dimmer than during the daytime. For example, between midnight and 6am whenever I switched on my bathroom light it would switch on at 30% brightness. Now that I know this is possible I've tried making a scheduled scene to achieve this, but had a few hiccups. First of all,
Also could you please add support for Ends at 6:00am Ends after 6 hours. So ideally I'd like to be able to create a scene as below that dims a switched off light to 30% between midnight and 6:00am, after which it will be restored to the previous brightness level.
It's important to create this as a CUSTOM_SCENE so it will be hidden. If you make a USER_SCENE, even if you simply go into the scene in the app and back out without editing any settings it will update the scene and add the Edit: I played around a lot and rewrote a lot, maybe it's helpful to someone. |
I will investigate your solution and make changes to the lib as soon as I find the time. If you want to contribute, you're very welcome! |
Thanks, and I'd like to contribute some additional info to the readme when I also have some spare time. |
@famichiki I created a PR for the scene changes, can you check if this is correct? |
Is there a way to specify the light level that the light will switch on at?
For example, my light is set to 100% when it is switched off, I'd like to switch it back on again but at 50% brightness.
If I specify light_level before lamp_on it is ignored.
If I specify lamp_on then light_level, the light comes on at full brightness before quickly dimming to my specified level.
I know I could use a scene but I'd like to know if the above is possible.
The text was updated successfully, but these errors were encountered: