Trigger rule when item state hue equals 0

I want to trigger a rule when an item (type Color) hue changes to 0 (turned off). Is it possible or should I trigger the rule on any item change and use a script to check the item hue. Thanks in advance. I’ve been looking other related questions but I didn’t find the answer.

Check out the event-based triggers section in the docs. Item <item> changed from <state> or Item <item> changed to <state> or Item <item> changed from <state> to <state> are all viable, specific triggers.

1 Like

I think @Miguel_M.A.D wants to know if it’s possible to direclty get a .hue change to trigger a rule?!

I don’t know any possbility to do that, so I chatch the Color Item changes/commands as well, then evaluate the .hue value in the rule.

Unless you create a separate Number Item and assign it the .hue value, whenever you catch a change in the Color Item somewhere else. Then you could use a change in that Number Item to trigger a rule :wink:

1 Like

Thanks for the quick answer. Yes I was checking that. But the state of my item has this format “67,57,15” (HSBType as string, as far as I understand) and I just what to trigger the rule when the las value is 0. I’m using the Next Generation Rule engine.

In that case, @Hans_Lree is correct. I don’t think there’s any way to set a rule trigger for a partial item value. Either filter for values inside the rule or set a proxy item as Hans suggested.

If the string is HSB, you probably meant the first value, or did you mean you want to catch the Brightness? Again though, be it a String Item or a Color Item, whole Items are used as rule triggers, not selective parts of them, that is if the Next Generation Rule engine doesn’t have any special new possibilities up its sleeve, which i wouldn’t know about.

1 Like

I was actually talking about the Brightness, my bad. Yes it seems this could not be done right now. I think that be able to perform a regex on text items as part of the rule conditions would be a great addition to the Next Generation Rule Engine I will open another topic proposing it to see if it’s a good idea. Thanks for your help :wink:

Just out of curiosity, where does the HSBType as string come from. Usually most bulbs, LED strips etc. which come in through whatever bindings, which have Colour Items, also do have a separate Brightness Dimmer Channel/Item. Does your device not have that? Maybe yours does have this as well to be able to directly access the Brightness channel of the Thing already now and trigger a rule with it.

I doubt there is much difference, either performance wise or ease of use, from having a “simple” rule trigger followed by a “complex” if-condition, compared to a complex conditional trigger.

In this case you can trigger on any change and perhaps
if( yourItem.getStateAs(OnOffType) == OFF) { …

2 Likes

I’m using TP-Link Smart Home Binding with a model KL130 and there isn’t a separate Brightness Dimmer Channel. It will be nice to have one.

I think the main difference is that you can avoid write a script. With the Next Generation Rule Engine you can define the rule conditions through the interface. I think for most users will be easier to define this rule just with the interface without using a script.
I did know about this one if( yourItem.getStateAs(OnOffType) == OFF) { … thanks for the tip, I will try it.

Struggling to understand why you want a rule with no script.

I am trying to control the Brightness of this KL130 bulb also. It can be done through Alexa by saying set light at a percentage, 0-100%. But I would like to avoid using Alexa. I am guessing the only way would be to update the TP-Link Binding to include this. You can also say turn light on and it will turn it on to the last setting when it was turned off. My goal is to have a closet light triggered by a contact sensor and have it turn on to 100% in the day and only 10% at night. I can do all this through Alexa text commands, but that is not what I want as it has a delay. Plus it does not work when the internet is down. Thanks

Use a rule that triggers by the changed ( to open?) event of the door sensor and send the desired command to the bulb

I have that. I was just hoping for a Brightness command for this bulb. I was able to get around it by changing the color setting between 180,0,0 to 180,0,100.
Thanks

What makes you think there isn’t one? A Color type Item is like a Dimmer type Item, you can send it a single number 0-100 for a brightness command.

When I can tell Alexa to set the brightness to 50% or to turn it on or off, I was expecting a Brightness and on-off channel. Thanks

You can send a Color type Item an ON or OFF command too.