Thanks for chiming in - I can see this as quite powerful. I have the cli setup this week but didn’t really digest everything just yet; I took a look at the example using Postman but given I like to keep things simple I’m reluctant to go down this path. A yaml file with cli injection would be a good place to start playing around. Are there any decent examples (or tutorials yet); this all needs a modicum of comprehension in terms of exploring device-id, things that can be changed etc… (I’m not there yet!)
A simple task I’m looking to complete, I turn on a light based on motion detection, after 10 minutes it switches off (I have kids!), however, if I turn on the light switch manually it stays on. I believe a variable is needed to store the state (e.g. manualActivation == True/False). If I’m reading the threads correctly this can’t be done as there are no variables in the rules engine?
OK, Thanks. I keep reading about these virtual switches (which I have in the IDE) but I have no idea how to implement them in the new scheme of things? Deeper down the rabbit hole I go!
There aren’t any variables in the Rules but you can use a virtual switch to hold a binary status. My approach to this problem actually uses a virtual motion sensor as it simplifies the logic. I turn a light on if there is motion between fifteen minutes before sunset and and thirty minutes after sunrise. I also turn the light off if motion goes inactive as my Ikea motion sensors give me a three minute delay that suits me just fine. This is actually my code, such as it is …
My buttons have push, held and double options. I use the push for a toggle on/off on the motion-controlled light. It does look like there is such a thing as a toggle command but if so it doesn’t seem to be available to the punters yet. I’ve stripped down my actual code here …
name: '[R] Button: Landing'
actions:
- if:
equals:
left:
device:
devices:
- &landing_button xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
component: main
capability: button
attribute: button
right:
string: pushed
then:
- if:
equals:
left:
device:
devices:
- &landing_shelf_light xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
component: main
capability: switch
attribute: switch
trigger: Never
right:
string: off
then:
- command:
devices:
- &landing_virtual xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
commands:
- component: main
capability: switch
command: on
- command:
devices:
- *landing_shelf_light
commands:
- component: main
capability: switch
command: on
else:
- command:
devices:
- *landing_virtual
commands:
- component: main
capability: switch
command: off
- command:
devices:
- *landing_shelf_light
commands:
- component: main
capability: switch
command: off
The ‘landing_virtual’ virtual motion sensor has both switch and motion capabilities so I can treat it like a switch in this rule.
I actually have multiple copies of this rule, one for each button I have doing the same thing. In webCoRE you can differentiate between ‘any button is pushed’ (condition) and ‘any button gets pushed’ (trigger) but if there is a way of doing the same with Rules I hadn’t spotted it at the time.
Last, but by no means least. If the light is turned off by any mechanism (app, ActionTiles, Google etc) I need to clear the manual override.
name: '[R] Virtual: Landing'
actions:
- if:
and:
- equals:
left:
device:
devices:
- &landing_shelf_light xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
component: main
capability: switch
attribute: switch
right:
string: off
- equals:
left:
device:
devices:
- &landing_virtual xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
component: main
capability: motionSensor
attribute: motion
trigger: Never
right:
string: active
then:
- command:
devices:
- *landing_virtual
commands:
- component: main
capability: switch
command: off
I wrote ‘I could probably turn off triggering on the motion sensor there, but that was documented after I last pondered the rule at all.’ but it turns out I had pondered it and had turned it off. I do have some unnecessary triggering going on somewhere.
While I am here, here is how I turn off a switch if it has been running for 45 minutes. You can do something similar to turn off lights if motion remains inactive for a while.
name: '[R] Fan Timer: Bedroom'
actions:
- if:
remains:
equals:
left:
device:
devices:
- &bedroom_fan xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
component: main
capability: switch
attribute: switch
right:
string: on
duration:
value:
integer: 45
unit: Minute
then:
- command:
devices:
- *bedroom_fan
commands:
- component: main
capability: switch
command: off
The [R] in the name of the rule just helps me identify rules in the app history.
but maybe your question wasn’t how to make them, but how to implement them in the new scheme of things sorry for that I don’t have an answer, still too far for me
thanks for this
installed the driver
from Channel “Mariano Shared Beta Driver”
Should I worry that this is beta? Ie if it migrates to this driver could the driver then disappear?
I’m doing that with the built-in routines. I have one routine for button pushing and another for motion. I control when those routines are active using a virtual switch as a precondition. The result is this:
If Between 10pm and Sunrise (Nighttime virtual switch is on)
If Motion is detected and the light is not already on, turn it on at 1% and auto turn off after 2 mins
If Button is toggled up and the light is not already on, turn it on at 100% and don’t turn it off
Turn on Nighttime virtual switch at 10pm and turn it off at Sunrise
I have the GE motion switch/dimmers which support Occupancy, Vacancy, and Manual modes. Mine operate in vacancy mode where motion does not active the light, only the button.
There is also the Sharptools rules engine which integrates with Smartthings, however, your rules aren’t running locally on your hub. All three of my routines above operate locally on my hub and are wicked fast when activated.
JDRoberts can comment better than I can, however, my understanding is that the framework for developing new SmartApps is not complete so all existing Groovy SmartApps die when the IDE goes away. ST is converting SmartLighting and SevereWeather into plugins so they will live on. One popular SmartApp is Lock User Manager (LUM) from Rboy and they post status here Migration FAQ's which gives you a flavor for how things are going.
I have a bunch of devices with no standard fingerprints, below is an example. There work perfectly under Groovy (without custom device handlers, but sometimes requiring manual device handlers selection) and quite a few people on here use them. Generally from brands like Aubess and intended for Tuya. Can these be linked to the Edge drivers replacing the IDE drivers they work fine with or will they all become useless?
Ok, So I had though the new start date was 10/15, not 9/30. However, a friend (who just started with Hubitat) told me he’d seen comments about it happening already. So I logged into the IDE and yes, one of my drivers had been switched. I’m not enrolled in beta and had not loaded new drivers, deciding to take the wait and see (and pray) approach. I confirmed it in the app as well. At first offline, due to a dead battery (a bali shade remote, which I rarely use), so I replaced the battery, confirmed the remote worked fine and then after 5-10 minutes it showed up again as active in the app and appeared to function (battery level only). In the IDE, it shows up as cloud and active though. Is all the IDE info no longer valid once moved to Edge? Has anyone else seen a diver update?