diff --git a/sd_event_loop.cpp b/sd_event_loop.cpp
index d30aafe..14078ea 100644
--- a/sd_event_loop.cpp
+++ b/sd_event_loop.cpp
@@ -217,4 +217,58 @@
     }
 }
 
+void EventLoop::switchTimer(uint8_t payloadInst,
+                            Timers type,
+                            bool status)
+{
+    auto iter = payloadInfo.find(payloadInst);
+    if (iter == payloadInfo.end())
+    {
+        log<level::ERR>("SOL Payload instance not found",
+                entry("payloadInst=%d", payloadInst));
+        throw std::runtime_error("SOL Payload instance not found");
+    }
+
+    int rc = 0;
+    auto source = (std::get<0>(iter->second.at(type))).get();
+    auto interval = std::get<1>(iter->second.at(type));
+
+    // Turn OFF the timer
+    if (!status)
+    {
+        rc = sd_event_source_set_enabled(source, SD_EVENT_OFF);
+        if (rc < 0)
+        {
+            log<level::ERR>("Failed to disable the timer", entry("RC=%d", rc));
+            throw std::runtime_error("Failed to disable timer");
+        }
+        return;
+    }
+
+    // Turn ON the timer
+    uint64_t currentTime = 0;
+    rc = sd_event_now(event, CLOCK_MONOTONIC, &currentTime);
+    if (rc < 0)
+    {
+        log<level::ERR>("Failed to get the current timestamp",
+                entry("RC=%d", rc));
+        throw std::runtime_error("Failed to get current timestamp");
+    }
+
+    rc = sd_event_source_set_time(source, currentTime + interval.count());
+    if (rc < 0)
+    {
+        log<level::ERR>("sd_event_source_set_time function failed",
+                entry("RC=%d", rc));
+        throw std::runtime_error("sd_event_source_set_time function failed");
+    }
+
+    rc = sd_event_source_set_enabled(source, SD_EVENT_ONESHOT);
+    if (rc < 0)
+    {
+        log<level::ERR>("Failed to enable the timer", entry("RC=%d",rc));
+        throw std::runtime_error("Failed to enable timer");
+    }
+}
+
 } // namespace eventloop
