Recent smart things refugee, got the hub today and I'm playing with rule machine. I did have on smarthings via webcore a rule that if x contact sensor was changed to open it would capture the current hue lights state and colour. Then turn them red and dim to 50% when the contact closed it would restore the colour and state. I've currently got this
Capture: Kitchen lights, Office lamp
Set color: Kitchen lights, Office lamp ->Red ->Level: 50
IF (Bi Fold Door closed(F) [FALSE]) THEN
Restore: Kitchen lights, Office lamp
in rule machine, however it just turns the lights on and keeps them red. What am I missing? thanks for any help
That's only part of your rule--we'd need to see the triggers to know what's really happening. My ESP tells me you probably have a "contact open" trigger and should use "contact changed," then adjust your actions like:
IF (Contact open) THEN
Capture Lights
Set Lights to Red at 50%
ELSE
Restore Lights
END-IF
That way, your rule actions will run when the contact is either opened or closed. The IF will match when it's opened, and the ELSE will match when it's closed (there are only two possible states). WebCoRE guesses at what event subscriptions to create based on your actions, including conditions; Rule Machine won't (there are times you may want conditionals in the rule just to test something), so you'll need to make whatever events you want to run the actions for part of your trigger.
If your trigger is on the door opening, there is another way you could implement the same thing. Instead of using an If/Else configuration, you have the rule triggered by the door opening. Then after you set the red color, you add a Wait action where you wait for the event of the door closing. Just another way to do it. One of the blessings (and curses) or Rule Machine.
thanks for the replys.......hubitat is very different to smart things and is taking some time getting used to! |I now have this with the trigger as changed like you've mentioned.
IF (Bi Fold Door open(F) [FALSE]) THEN
Capture: Kitchen lights, Office lamp
Set color: Kitchen lights, Office lamp ->Red ->Level: 50
ELSE
Restore: Kitchen lights, Office lamp
The lights go red on open however they don't restore. Any Ideas?
And it is not restoring the settings for the light? What is the setting for the light before you open the door? Did you turn the light off after modifying the rule or is it still set to Red?
The logs from RM indicate to me that the rule is acting as expecting. Do your lights accurately report states back to Hubitat? You can verify by looking at the device page (for the lights, not the sensor) in real time as you open and close the sensor and the rule runs. I see two possible problems: either the lights aren't reporting good information back to Hubitat (e.g., it sees red when they're really white) and RM is capturing the wrong settings, or the restore is failing because the bulbs aren't receiving the new settings (you can verify this by whether the device page for the lights shows the expected changes and whether what's there matches the actual state of the lights--either could be a problem).
Also, what kind of bulbs are these? Some are known to behave poorly when directly connected to Hubitat in a "mixed" (bulb and non-bulb) Zigbee network. Even ones that are otherwise fine (e.g., Sengled) don't always seem to do well if receiving a bunch of commands at once, as they might when multiple bulbs get multiple commands at the same time like your Restore action might be doing (turn on, set level, set color/color temperature, etc.).
Yep its def on white now so it looks like its not being updated correctly. The lights are attached to the hue bridge and are hue lights. thanks for the help so far!
Now we're on to something. By default, Hubitat's Hue Bridge Integration app only updates bulb states once per minute (the polling/refresh interval you can configure in the integration app). There is no way for the Hue Bridge to "push" changes to Hubitat immediately, so you'll have to wait for the refresh to happen until the Hubitat state is correct if you make changes outside Hubitat (e.g., via the Hue app).
If none of your automations rely on under-one-minute resolutions for changes you made outside Hubitat, you should be good. Capturing and restoring from Hubitat in under one minute should be fine as long as you either made the pre-capture change from Hubitat (so the attributes it captures are correct) or waited for the refresh interval to pass (to ensure the same for changes made via Hue directly).
I suggest this: try your rule again, but this time set the bulb to white from inside Hubitat first (or do it however you want but make sure the device page in Hubitat shows the correct attributes first). If you aren't sure how to do this from Hubitat, type "2700" into the "Set Color Temperature" box and click the button to send that command to the bulb, which will set the bulb to a default warm white similar to Hue's "Read" settings (this command takes a color temperature in Kelvin, so you could also use whatever value you wanted, e.g., 4000 for a cooler white).