I am new to Hubitat and need assistance programming an outlet to run for X number of minutes

I am transitioning my Z-Wave network from an ISY-994i ZW controller to Hubitat and would like to use Google or Alexa to turn on a switch for a specific duration.

Using an ISY, you can create programs using IF, THEN, ELSE, etc., and those could be executed using Google or Alexa.

For example, we have a USB charger in the bedroom plugged into a Z-Wave outlet we call, "charging station" and can use any personal assistant and give commands like:
"Alexa, turn on charging station for one hour" or "Alexa, turn on charging station for 4 hours", depending on what we were charging, or simply, "Alexa, turn on charging station" and it would continue to run unless someone said, "Alexa, turn off charging station" or manually turned it off.

To take it further, if the outlet was already set to run for X number of minutes and I suddenly needed it to run for a different duration, I could say, "Alexa, turn on charging station for Y" and that would override the program already running.

How can I achieve similar results using Hubitat? Thanks!

1 Like

First of all, how far are you along with your installation? Have you used the Hubitat Package manager yet? You need to install the Amazon Echo Skill and Rule Machine.

Add the Hubitat Skill to Alexa

You need to add devices to the Amazon Echo Skill, which is easy. Just click on Select Devices and choose all those you want to control with Alexa.

Make sure to Click Update

Finally click Done

Alexa will then recognize your list of devices.

After that, you will click on Rule Machine, which will allow you to create the If/Then rules you want. I use a different program called Webcore, so someone else can help you with the Rule Machine steps if you need further assistance.

This is a partial answer... These videos and the documentation should get you started. Once you begin building your rules, you might have to come back with specific items where you need help.

https://docs.hubitat.com/index.php?title=Rule-5.0

Thanks for your reply. The first day I received the Hubitat I gave it a static IP, updated it, started installing apps, and familiarized myself with the UI and the mobile app. The devices I have installed so far I can control with both Google and Alexa, and I have all 3 members of our household set up with presence detection via the mobile app. I do have some simple rules created, but now want to dive into the more advanced features. I did install WebCore briefly to take a look at it, but it looked like it would be more of a steep learning curve. Here's a screenshot of the apps I have installed now.

Thanks. I have created a rule to run a device for a specific duration; however, I am wrapping my head around writing the conditions to achieve my desired results.

From what I can tell, with Hubitat, you can only turn on and off devices using Alexa or Google, with all the logic contained in one rule.

I am used to being able to write actions in separate program segments. I could then control devices or run any action with Google or Alexa. I will have to take a deeper dive into RM.

Is there any way to export a rule to paste it?

I do not know of a way to say to Alexa "turn on desk lamp for X minutes" and have Alexa pass X to HE. However you can use the sleep timer feature with Alexa to delay turning something OFF, but I think it only works from 2-59 min. You can also use Alexa to trigger a complex series of rules on the HE side by using a virtual switch.

RM rules can be exported, yes. But if you want to paste a rule into a post, the best thing to do is take a screen shot.

2 Likes

You might be able to do this by setting up routines in Alexa, you will need to create a routine for each duration and device. Alexa charge my phone - routine: turn on the charging device, wait 1 hour or whatever) and then turn off the charging device.

Alternatively, you might be able to set up something in IFTTT if it is an android phone. Android battery level can be used as a trigger. Turn on the charger by regular voice command and use IFTTT if battery is charged turn off outlet. I use the android battery trigger to alert me to low battery.

I think I found a "quick and dirty" solution if I make a virtual switch with a simple rule for each.

If virtual switch one is turned on, then turn on the charging station, wait one hour, then turn off.
If virtual switch two is turned on, then turn on the charging station, wait four hours, then turn off.
If virtual switch one is on, turn off virtual switch two, and vice versa, etc.

2 Likes

Thanks. I think virtual switches are the simplest of ideas so far.

3 Likes

You can certainly link Alexa with Hubitat using the Alexa skill so that you can turn on the Z-wave outlet using voice commands. However, I would suggest that you set up a rule (even a basic rule will work) in Hubitat to turn off the outlet after a specific wait time. That is easier than trying to use an Alexa routine to do that. The advantage of doing it in Hubitat is that the wait timer will work the same way should you decide to activate the outlet manually.

I have a Zigbee plug in my bathroom that I want to stay on for 20 minutes. I set up a basic rule that says:

When Zigbee Plug Bathroom turns on
Wait 20 minutes
Turn off Zigbee Plug Bathroom

The rule is activated anytime I turn the plug on. Since I have the plug set up in Alexa, I could do that by saying "Alexa, Turn on Zigbee Plug Bathroom" or by pushing the button on the side of the plug.

The nice thing is, if you go to https://community.webcore.co/ and ask, someone will generally create a small piston (what they call Rules) for you, or will provide you a copy of theirs. Then you can mess with it and fine-tune it for yourself.

You'd be surprised. I have a home-made doggy that uses a Z-wave relay. I control it with a virtual window-shade device so I can say "Open Doggy Door" or "Close Doggy Door" instead of "Turn On/Off Doggy Door". Much easier to remember, lol. I also have a piston that will tell me where all my family members are located when asked.

1 Like

Hmmm. That could be embarrassing or upsetting.

1 Like

You can create multiple virtual switches and call them "charger 1 hour" "charger 2 hours" and so on. You can invoke Alexa with those names. You also can automatically turn these switches off, (device settings screen) so you can tap the dashboard, and it will run an hour and you don't have to intervene with turning things off or resetting the switch to off.

For example, I have a hot tub temperature button, I push 103 switch on dashboard (or Alexa) and it triggers that 103 temp rule. The switch doesn't do anything or trigger anything if off, just when flipped to on. If I did the triggering without auto-reset to off, I would have to in a different rule (say temp 101) flip the 103 switch to off first, or I would have a conflict of rules.

I was initially going to suggest virtual buttons, but those won't work for Alexa if that is what you want. But they do work good if you want to use one button container for various amounts of time. Just create a button with maybe like 4 options, each represents (or triggers) an hour comparable to their button number. Button 1 = 1 hour, and so on.

1 Like

"Alexa, where is my wife?"
"Your wife is at Fred's place".
"Alexa, what is the name of a divorce lawyer?"
:grin:

2 Likes

Well, if you don’t mind the oddness in wording, you could expose a virtual dimmer to Alexa and say, e.g., “Alexa, turn the desk lamp to 90%”, which would pass 90% to Hubitat, so that you could turn the light on for 90 minutes and schedule an off at the end of that time with a WAIT, or “Alexa, turn the desk lamp to 5%”, which would send 5% to Hubitat (representing a time of 5 minutes, etc.).

1 Like

Another good option. I don't like the awkward phrasing like you mention (which is one reason I don't use that method), but that is a great way to only use one virtual device instead of multiple virtual switches.

1 Like

My attempts at geofencing have been met with overwhelming resistance. I have given up.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.