# Gateway Timer Event Script not working

**URL:** <https://forum.inductiveautomation.com/t/gateway-timer-event-script-not-working/107220>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [June 10, 2025, 11:10am UTC](https://forum.inductiveautomation.com/t/gateway-timer-event-script-not-working/107220 "2025-06-10T11:10:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![srinivasan\_s](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@srinivasan\_s](https://forum.inductiveautomation.com/u/srinivasan_s)\
**Post date:** [June 10, 2025, 11:10am UTC](https://forum.inductiveautomation.com/t/gateway-timer-event-script-not-working/107220/1 "2025-06-10T11:10:42Z")

</div>

**My Usecase:**

I just need to check one API response code 200 for every one minute. If connection lost need to trigger a pop up view.

**Things I tired:**  
1.Tired using the system.net.httpget() , if response is None , it will trigger a popup. But not working .  
2. Tired to execute velow scripts , but if response cut throwing error, I know its a simple one, but not able to achieve , Kindly help me on this !

```python
client = system.net.httpClient()
		response = client.get("http://192.168.43.75:5000/data")
		if response.statusCode == 200:
			system.perspective.openPopup("testing", "popup1")
		else:
			system.util.getLogger("FlaskCheck").info("Received response but status not OK")

```

---

<div class="post-metadata">

**Author:** ![David\_Stone](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/david_stone/32/79749_2.png) [@David\_Stone](https://forum.inductiveautomation.com/u/David_Stone)\
**Post date:** [June 10, 2025, 11:23am UTC](https://forum.inductiveautomation.com/t/gateway-timer-event-script-not-working/107220/2 "2025-06-10T11:23:52Z")

</div>

Where is this script placed?  
Scripts like this should be in gateway scheduled scripts, then use a message handler to message the failure out of the gateway scope into the perspective session, where the `system.perspective.* `script will actually work.

---

<div class="post-metadata">

**Author:** ![srinivasan\_s](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@srinivasan\_s](https://forum.inductiveautomation.com/u/srinivasan_s)\
**Post date:** [June 10, 2025, 12:40pm UTC](https://forum.inductiveautomation.com/t/gateway-timer-event-script-not-working/107220/3 "2025-06-10T12:40:05Z")

</div>

Thank you for your reply. I placed in simple button event to check whether it was working . Anyway I will try in scheduled one .

---

<div class="post-metadata">

**Author:** ![srinivasan\_s](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@srinivasan\_s](https://forum.inductiveautomation.com/u/srinivasan_s)\
**Post date:** [June 10, 2025, 6:23pm UTC](https://forum.inductiveautomation.com/t/gateway-timer-event-script-not-working/107220/4 "2025-06-10T18:23:39Z")

</div>

Hey David, As instructed I have been placed the code in Gateway scheduled event. But somehow it is not working again. please guide me

```python
		
		client = system.net.httpClient()
		response = client.get("http://192.168.0.101:5000/data")
		if response.statusCode == 200:
		
# Sends a message to all Message Handlers configured on the current view, indicating that a new item has been added to a list.
			system.perspective.sendMessage("NewItem", scope = "session",sessionId="6a181fdd-5c61-49de-8b5b-a49679447839")
		else:
			system.util.getLogger("FlaskCheck").info("Received response but status not OK")

```

My message handler was placed in one view's root container, there just need to open the popup.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/3/13aa0b2dc4773ce9d2b8362573d57e158273decb.png)

---

<div class="post-metadata">

**Author:** ![David\_Stone](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/david_stone/32/79749_2.png) [@David\_Stone](https://forum.inductiveautomation.com/u/David_Stone)\
**Post date:** [June 10, 2025, 8:30pm UTC](https://forum.inductiveautomation.com/t/gateway-timer-event-script-not-working/107220/5 "2025-06-10T20:30:40Z")

</div>

What errors are in the logs when it triggers?

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [June 10, 2025, 8:36pm UTC](https://forum.inductiveautomation.com/t/gateway-timer-event-script-not-working/107220/6 "2025-06-10T20:36:50Z")

</div>

Unless that is there for show, you have hard-coded the sessionId in your call to send a message.

> [@srinivasan\_s](#):
>
> `sessionId="6a181fdd-5c61-49de-8b5b-a49679447839"`

You are also using a `system.perspective.sendMessage` in a scheduled event when you should be using `system.util.sendMessage`. There is a difference, they are not interchangable. You also need a session message handler, to capture the message from `util.sendMessage` and then call `perspective.sendMessage`.

> **[system.perspective.sendMessage | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-perspective/system-perspective-sendMessage)**
>
> Send a message to a message handler within the same session.

> **[system.util.sendMessage | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-util/system-util-sendMessage)**
>
> This function sends a message to clients running under the Gateway, or to a project within the Gateway itself.

---

<div class="post-metadata">

**Author:** ![srinivasan\_s](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@srinivasan\_s](https://forum.inductiveautomation.com/u/srinivasan_s)\
**Post date:** [June 11, 2025, 9:00am UTC](https://forum.inductiveautomation.com/t/gateway-timer-event-script-not-working/107220/7 "2025-06-11T09:00:38Z")

</div>

Thank you for your reply. Will check that too
