Middleage beginner not to good in english needs help, it´s never to late

Hello Community,
I started a couple of years ago with some Hue lights and switches "programmed" with the Hue app. After a while I found out that I wanted to do more than the Hue app was able to do so i started to use the iConnecthue app instead. I have now bought a HE because I want to get to the "next level" . I have a automation I want to try, but I don´t know ho to do it and would appreciate som suggestions how to start. What I want to achieve is that a bulb should light up in hue x, saturation y, level x for 30 seconds when a motiondetctor dectects movement and the lux-value is 10 or less, after 30 seconds the bulb should return to its previous state again.
I hope you understand my idea and would really apprecite some tips. The bulb is a philips hue connected via Hue Bridge Integration and the motionsensor is a Hue outdoor sensor connected to HE.

Hi there,
As you will see, HE is all about options, and there are plenty of apps for just about anything. I like to use Rule Machine, which gives you freedom not always in the apps. But at a slightly higher complexity. Anyways, this is how it can be done in RM;
30s_rule

I bet others will give you examples of how the apps can be used as well. :slight_smile:

2 Likes

Thank you very much.
I think I understand almost everything that you have written, but there is one thing I don´t understand. Which part in your rule will get the current status of the lamp before setting the 30 seconds color and put it back in the previous state after the 30 seconds?

1 Like

In this example I assumed it was off to begin with. It is doable though, one can save the state of a device, do stuff to it and then revert to the saved one. It is achieved by using capture and restore (example from another rule);
capture_restore

Try the community app Lights On Motion Plus. It probably will be much easier to use. I think it does everything you requested.

It is available to install via Github, but I would suggest the Hubitat Package Manager instead. It is a much easier way to install and maintain apps.

Thanks a lot for giving fast and very useful information, really appreciate it.
My plan is to learn how to use the RM, I know it won´t be easy, but I
will give it a try. What is the languge used for programming i HE?
I´m going to try to find som beginners guide in Swedish to start learning.
I have started making the rule in RM and this is what I have done so far.
(Don´t know if i uploaded the picture right)

What I´m looking for now is to find the Off:... action.

1 Like

You will find the Off action here;

The language used is Groovy, but what you see in RM is just pseudo code, not what is actually being run.

Perfect, will try that.
I have been thinking about your first row "Cancel Delayed Actions".
Is the reason to ensure that you always get 30 seconds light?
If it wasn´t there and the rule was acitivated 10:00:00 the light will turn on and
the timer start to count, if the rule was acitivated again 10:00:20 the light would only
be set for 10 seconds?

Another question if it´s ok, if I unpair the motion sensor and the pair it again, will the rule still work or do I have to write it again? I have problems with the sensor, it doesn´t report the lux value.
In device preferences the value is for Lux Reoirting is deafult: 10 Lux change, but that doesn´t work.

Well, some here are better at describing that than me, but giving it a shot. The "Cancel Delayed Actions" will reset any delays in the rule if it is re-run. If it would not be there, you would get all sorts of weird issues, as new delays would be added to the already existing ones, turning device off at what would seem random.

Try hitting 'Configure' for the sensor in the Devices page and see if that makes any difference. It seems to help sometimes.

If is possible to keep your automation's intact, info how is posted on here somewhere, I just can't seem to find it... Hopefully someone can help with that.

You are fast, very fast to answer :smile: I think that we are saying the same thing but in different words.
I think its easiest for me to think that always start a rule that includes delays with Cancel Delayed Actions.
I think I now have made the rule, but it doesn´t work, can you see anything that is wrong?
Should it start working immediately?

Short of an "End If", it looks fine. I would suggest to turn on logging for the rule and re-trigger to see what might be going on...

Don´t exactly understand your answer, do you mean that everything looks fine except for a missing "End if" which I suppose should be under Restore line?
I have been looking around and I can´t find out how to insert that.
When I compare your rule with mine your IF line ends with Exit rule, mine with THEN could it be that simple that I create my rule in a never version of RM than the one you have used?

Yes, and I agree. It was kind of cryptic, sorry about that. You can add the end if (it is not what is holding this back though) the same way you added the if, by going to the 'Conditional Actions' menu;


I just created the same exact rule, which worked, so I think the log will be the best bet

Summary

rule

I realise when looking att your rule and comapre it to mine that I have to rename all of my devices to get a better structure in my devicelist :smile:. I managed to get the END-IF in the right place. Even if it´s not necessary it looks better. At this moment I update my outdoor sensor because i find som information on the forum about some issue with lux-reporting:
"ya i needed to connect my outdoor hue motion to the hub just to get a recent firmware update as there was an update to fix lux reporting..

you dont need to removre from hubitat. just reset it after f/w update and add back to hubitat. I did notice that is was added even though the add device didnt show it.. there seems to be a bug in that regards when re-adding zigbee devices that were never removed. I hope this would solve my problems.

Once again, thanks for your support, it´s great.

1 Like

No problem at all, this is fun! :slight_smile:

Platform documentation for developers is here:

Developer Documentation

Good luck, and welcome!

Thank you

1 Like

yes noticed that too. when adding it back in.. it never shows done but it is added back sucessfully.

Good evening furom.
Finally it started to work, for a while. And I think I know what the problem is, but not how to solve it, of course.
For example at 10:00:00 the rule is activated, the lamp is on with ordinary white light. The rule starts with capture that white color, then change to the color in the rule. at 10:00:15 the rule is activated once again and it starts with capture the light wich now is the color in the rule wich means it won´t change back to white after the delay. The way I´m thinking of using this rule it´s ok if it activates once and the is blocked for another activation until the timer has come to and end. I think the rule should be something like this, if its >10 lux and motion is detected and timer is not activated, run the rule. Maybe this is a situation when not to start a rule with Cancel Delayed Actions?

Hi,
I haven't found a way of using a running delay as a condition, so what I have done is to create a timer rule, which flips a virtual switch on and off. There may be better solutions...
timer_rule

It has no trigger, just call it from your rule;

Then the switch can be used in the condition of your rule.

Download the Hubitat app