# How to implement "Momentary Button" function in Perspective View

**URL:** <https://forum.inductiveautomation.com/t/how-to-implement-momentary-button-function-in-perspective-view/39103>\
**Category:** Ignition\
**Created:** [September 28, 2020, 5:11am UTC](https://forum.inductiveautomation.com/t/how-to-implement-momentary-button-function-in-perspective-view/39103 "2020-09-28T05:11:19Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![moli501](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@moli501](https://forum.inductiveautomation.com/u/moli501)\
**Post date:** [September 28, 2020, 5:11am UTC](https://forum.inductiveautomation.com/t/how-to-implement-momentary-button-function-in-perspective-view/39103/1 "2020-09-28T05:11:19Z")

</div>

In Vison there is “Momentary Button” to easily achieve Pulse output command to PLC, but move to Perspective View, I can find same function accordingly, can someone advise?  
Thanks

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [September 28, 2020, 5:54am UTC](https://forum.inductiveautomation.com/t/how-to-implement-momentary-button-function-in-perspective-view/39103/2 "2020-09-28T05:54:18Z")

</div>

Momentary buttons in any SCADA platform are general a bad idea, as any comms dropout will result in the bit staying high. These should be converted to auto-resetting bits in the PLC.

~~If you still want to go this route, or have your hands tied, then you can always just use a Script to write the value to on, then use invokeLater with a delay time to write the tag back off.~~

E.g.

```python
tagPath = 'tag/path'
system.tag.writeBlocking([tagPath], [1])
def turnOff():
	system.tag.writeBlocking([tagPath], [0])
system.util.invokeLate(turnOff, 2500)

```

~~Of course, you could also create this as a template View to use everywhere~~

Edit: There is no way to reliably do this in Perspective and guarantee that the bit won't remain latched on

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 28, 2020, 11:51am UTC](https://forum.inductiveautomation.com/t/how-to-implement-momentary-button-function-in-perspective-view/39103/3 "2020-09-28T11:51:38Z")

</div>

I suspect IA hasn’t implemented it because they can’t make browsers behave well enough for it to be reliable. Vision’s Momentary Button is not reliable by itself. Search this forum for [stuck momentary button](http://forum.inductiveautomation.com/search?q=stuck%20momentary%20button) for a variety of discussions on the topic and the fundamental problems behind it.

---

<div class="post-metadata">

**Author:** ![ftuquabo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ftuquabo/32/29161_2.png) [@ftuquabo](https://forum.inductiveautomation.com/u/ftuquabo)\
**Post date:** [March 6, 2024, 9:18pm UTC](https://forum.inductiveautomation.com/t/how-to-implement-momentary-button-function-in-perspective-view/39103/4 "2024-03-06T21:18:14Z")

</div>

Hello all,

I'm currently converting an old wonderware app to ignition which seems to have momentary buttons all over the place which I know isn't ideal, but have no other choice at the moment. I'm using the script above and it seems like the valve I'm writing to is getting stuck at a value of 1 and not going back to 0. Do you mind reviewing the script that I'm using to see if there are any potential issues with it? Thank you.

```auto
def runAction(self, event):
	system.tag.writeBlocking([self.view.custom.CLOSE_CMD], [1])
	def turnOff():
			system.tag.writeBlocking([self.view.custom.CLOSE_CMD], [0])
	system.util.invokeLate(turnOff, 2500)

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 6, 2024, 9:21pm UTC](https://forum.inductiveautomation.com/t/how-to-implement-momentary-button-function-in-perspective-view/39103/5 "2024-03-06T21:21:43Z")

</div>

> [@ftuquabo](#):
>
> but have no other choice at the moment

Sure you have a choice. Use Vision instead of Perspective. Spend the extra engineering on the momentary buttons to use repeating message verification. (Or purchase a module that offers it in a neat package, for EtherNet/IP class 1 applications. /shameless plug.)

Momentary buttons in Perspective are _ **unfixably** _ unreliable. Full stop.

---

<div class="post-metadata">

**Author:** ![ftuquabo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ftuquabo/32/29161_2.png) [@ftuquabo](https://forum.inductiveautomation.com/u/ftuquabo)\
**Post date:** [March 6, 2024, 9:31pm UTC](https://forum.inductiveautomation.com/t/how-to-implement-momentary-button-function-in-perspective-view/39103/8 "2024-03-06T21:31:51Z")

</div>

Do you mind elaborating more on repeating message verification?

Also, where can I find more info on the module? I'd like to take a look.

---

<div class="post-metadata">

**Author:** ![ftuquabo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ftuquabo/32/29161_2.png) [@ftuquabo](https://forum.inductiveautomation.com/u/ftuquabo)\
**Post date:** [March 6, 2024, 9:33pm UTC](https://forum.inductiveautomation.com/t/how-to-implement-momentary-button-function-in-perspective-view/39103/9 "2024-03-06T21:33:56Z")

</div>

Thanks, I fixed the post.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 6, 2024, 9:45pm UTC](https://forum.inductiveautomation.com/t/how-to-implement-momentary-button-function-in-perspective-view/39103/10 "2024-03-06T21:45:05Z")

</div>

> [@ftuquabo](#):
>
> repeating message verification?

The technique uses a fast timer tightly bound to the button in the UI to check and send "I'm still pressed" messages through the full comms path, with a PLC timeout catching any hiccups to release the button. Also requires some metadata to prevent re-activation if a UI script stalls and resumes.

Perspective cannot do this because its scripts run in the gateway, not in the UI. It might be possible to do with javascript in a custom Perspective component, but I haven't figured out how, and nobody else wants to touch it with a ten-foot pole.

For Vision, my EtherNet/IP module offers a Momemtary I/O Button, that pairs with a class 1 Host device in adapter mode (typically). It does the tight-coupled messaging internally from Vision Client to gateway, and relies on class 1 I/O status automatic monitoring in PLCs. Class 1 I/O is also a repeating message technology, and PLC provide native monitoring of connection/module status.

Latest:

> [@Automation Professionals' EtherNet/IP Communication Suite V2](https://forum.inductiveautomation.com/t/automation-professionals-ethernet-ip-communication-suite-v2/68190):
>
> Automation Professionals is pleased to announce its latest EtherNet/IP Communications Suite driver module, a major upgrade to its EtherNet/IP Class1 Communications module, as a Public Beta. As of April 15, 2023, this is now a Production Release. The primary new feature is its new Generic EtherNet/IP Client Driver, a drop-in replacement for IA's Logix V21+ driver and its Omron NJ/NX driver. It does work with older Logix processors, and also works with Rockwell's MicroLogix 8xx family (ethernet…

Older description of the technique one would use here:

> [@Snappy user interfaces with the Ethernet/IP Module](https://forum.inductiveautomation.com/t/snappy-user-interfaces-with-the-ethernet-ip-module/12617):
>
> Automation Professionals [Ethernet/IP Class1 Communications Module](https://www.automation-pros.com/modulesales.html) has been in beta for a few months with no recent issues. A release to production use is approaching soon and I thought I’d share a test project and its matching PLC code I’ve been using to exercise the module’s base features. In the simplest setup, this driver presents a virtual I/O chassis to to the outside world, populated with up to 100 virtual I/O modules – I/O modules that also appear to be ControlLogix processors with user…

---

<div class="post-metadata">

**Author:** ![bmusson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmusson/32/87530_2.png) [@bmusson](https://forum.inductiveautomation.com/u/bmusson)\
**Post date:** [March 6, 2024, 10:41pm UTC](https://forum.inductiveautomation.com/t/how-to-implement-momentary-button-function-in-perspective-view/39103/11 "2024-03-06T22:41:50Z")

</div>

> [@pturmel](#):
>
> nobody else wants to touch it with a ten-foot pole

Yeah I spent about half a day thinking about this, before realizing “hell no”.

---

<div class="post-metadata">

**Author:** ![DdP](https://avatars.discourse-cdn.com/v4/letter/d/f6c823/32.png) [@DdP](https://forum.inductiveautomation.com/u/DdP)\
**Post date:** [March 6, 2025, 2:45am UTC](https://forum.inductiveautomation.com/t/how-to-implement-momentary-button-function-in-perspective-view/39103/12 "2025-03-06T02:45:40Z")

</div>

This is the best and easiest way to ensure your PLC bits won't be left in a state that could cause harm to people or machinery.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/8/f8637c4c415ddbb20fcaa21e74e7caf8817c1430.png)
