Virtual Switch Driver - Timed ON or OFF

Guys
I have ported over a the code for a virtual switch driver

I use this on 'the other platform' as a small timer - Quick and easy.

It is just a driver for a virtual switch which turns itself on or off after a configurable number of seconds or minutes (switchable)

Set the timer to 0 seconds and it becomes a momentary switch :slight_smile:

https://github.com/CobraVmax/Hubitat/tree/master/Drivers/Switches

Someone might find it as useful as I do

Andy

4 Likes

Hi Andy,

How does your switch differ from creating a RM rule to return the state to OFF or ON for a regular virtual switch after x number of seconds?

Asking in earnest. Is it that it’s one less thing to configure or is there another advantage?

You don’t need a rule to turn the switch off.

One of my uses is for a mode switch activated by Alexa
I say “turn on night mode” and the switch is turned on for 5 seconds.
I have a rule that if this switch turns on then activate my mode. (to get around the Mode Manager bug)

I use another one with a 90 minute time for a ‘boost’ to my heating
I turn it on and my heating is on for 90mins then automatically turns off.

When I have some compatible speakers I will use this to turn on a temporary ‘mute’ switch for times when I don’t want to have voice announcements. (but always forget to turn the mute off!)

I have used it extensively in ST for small period timers too

YMMV

Andy

2 Likes

Sometimes you might want to use this virtual to control one or more other switches
I often use this little app to do this.
You can also reverse the operation of one or more switches..

Andy

I was looking to do something like this! In my case, I was wanting to create a virtual “timed fan switch” button/switch to complement my real “fan switch”—something I could use to turn on the fan switch for a pre-set amount of time, like 15 minutes or so, then turn off. This looks like it could help with that, but it appears you’d still need a rule/app that would control the physical device based on this switch, and my wishlist for perfection also includes a “cancellation” of the timer if the underlying physical switch is manipulated (e.g., if I started the “timed switch” but then turn the fan off manually and on again before the original timer is up).

Does anyone know if there’s an app (or SmartApp I could port) that can help with this? In ST, I’ve done it a few different ways but don’t know that I ever had a good solution for the second thing I mentioned. And really, the first didn’t always work all that well either, since many times I found the original switch still on after the timed/virtual one was supposed to turn it off (cloud problems?).

You can do this bit with the virtual switch and the 'one 2 many' app I mentioned

I'm not sure exactly what you want for the second bit :slight_smile:

If you turn the fan off then on (before the timer is up) what do you want to happen?

Andy

If I turn the fan (or underlying “real” switch) off before the timer is up, nothing needs to necessarily happen—but if I turn the fan back on before the “original” timer from the virtual switch is up, I’d like to make sure that that timer gets cancelled. (I imagine that the virtual switch is still counting down the time and will blindly turn the other switch off when it that timer is up, regardless of what you’ve done to the real switch in the meantime. If I’m wrong, then it probably already does what I want, which is great!)

I have added reverse action to this as I had a need for it.
Now you can select to have the timer working for ON or OFF actions

Just select the ‘default state’ in the settings

This action does work for what you need?38%20AM

That looks like it could do it, but what does “pending cancellation” mean? If the switch it’s configured to turn on/off is turned on/off by other means, will the timer/delay here be cancelled? (That’s what I want.) I guess I could test it and see.

How do I use your Virtual Switch Driver on a TP-Link wifi switch that already uses the "TP-Link Plug Switch driver" to install.

I'm a noob at this level but have been able to migrate my IRIS system to HE. My IRIS thermostats, Zwave switches and sensors, and wifi switches (all TP-Link)

I need your timer to actuate a pump that needs a momentary button push that triggers it and it automatically runs and shuts down on it's own once it is triggered. I use a powered timed switch to momentarily close a relay that closes the push button contact which starts the independently powered pump that has its own circuit board that runs the pump until hot water reaches the faucet. This setup worked with IRIS and I was able to set a 1 min timer in their app.

If I can get this to work I will have the whole IRIS system migrated and will start looking at getting my Lutron shades and Hunter Douglas shades connected if possible!

If you need to ‘link’ the virtual switch to a physical one, you can probably do that with rule machine or you can try my ‘one to many’ app
Http://hubitat.uk

Andy

Link is broken?

Website is now members only and not quite finished yet
However; registration is free and you will be emailed when the site is open

https://cobra-apps.co.uk

1 Like

@Cobra what's this momentary switch called on your website. I can't find the right device code.

Switch Timer (under Drivers menu)

Andy

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