Announcement

Collapse
No announcement yet.

Event to delete other events

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Event to delete other events

    I've found that I've needed to create a handful of events to handle the schedule anomalies due to the Covid lockdown. I'd like to create an event that deletes all of these temporary events at a specified date and time, but I'm not seeing a way to do this. I see that I can disable these events with an easytrigger action, but not a way to delete them. Is there a way to delete events from another event?

    #2
    Originally posted by Jon View Post
    Is there a way to delete events from another event?
    Not through event actions. However, you can delete events via a script file, and the script file can be called by an event.

    Code:
    hs.DeleteEvent("EventName")
    I have not actually tried it, because I usually just disable the events when I no longer need them, because as soon as I delete it, I will realize I have another use for that event I just deleted.

    You can also enable/disable events through script files.

    Comment


      #3
      I have a test group that holds my obsolete and testing events. I just change the group reassign to test and disable. As aa6vh points out you don't know when you will need the script again or for another purpose.

      The other way is to create a virtual device that has two status - covid and normal. Add condition to the trigger "and if device is covid" so if we get round two or three like 1918 pandemic (I hope not) you are ready and a change in status is all that is required.

      Comment


        #4
        Thanks, I think I'm going to take the script path. I like to keep a clean setup without a bunch of disabled and unused stuff laying around. I find myself forgetting it's there and just recreating it anyhow.

        With several of the events, I found myself actually making them permanent by crafting the conditions so that they'd only run when conditions are reasonably similar to the lockdown scenario. When I got to thinking about it, many these are things that I'd want to be this way any time the house is in an abnormaly occupied state, such as a staycation, or home sick for a few days. So I'm setting them up like "if the time is x" and "is a weekday" and "the house has been occupied for 8 hours", then do something. This allows me to have a failsafe for those regular evening events that don't rely on someone arriving at home.

        Comment

        Working...
        X