# Perspective Vibration / Notification

**URL:** <https://forum.inductiveautomation.com/t/perspective-vibration-notification/32293>\
**Category:** Ignition\
**Created:** [February 14, 2020, 8:11pm UTC](https://forum.inductiveautomation.com/t/perspective-vibration-notification/32293 "2020-02-14T20:11:45Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![kris.steer](https://avatars.discourse-cdn.com/v4/letter/k/6f9a4e/32.png) [@kris.steer](https://forum.inductiveautomation.com/u/kris.steer)\
**Post date:** [February 14, 2020, 8:11pm UTC](https://forum.inductiveautomation.com/t/perspective-vibration-notification/32293/1 "2020-02-14T20:11:45Z")

</div>

Say you have a system running vision clients at the production line and operators running perspective sessions on iPhones.

Say an alarm was to become active on the production line. How would one use system.perspective.VibrateDevice to the operator of that lines device.

The manual seems to indicate that it must be invoked from the device.

Is it possible for the vision client / gateway to communicate out to the perspective session to invoke this?

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [February 14, 2020, 11:31pm UTC](https://forum.inductiveautomation.com/t/perspective-vibration-notification/32293/2 "2020-02-14T23:31:52Z")

</div>

You can use [system.util.sendMessage](https://docs.inductiveautomation.com/display/DOC80/system.util.sendMessage) to send a message from the gateway to Perspective sessions and then use a message handler in Perspective to vibrate the device. On the other hand, you could probably do this without the message by having Perspective look at the alarm status.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 15, 2020, 12:12am UTC](https://forum.inductiveautomation.com/t/perspective-vibration-notification/32293/3 "2020-02-15T00:12:23Z")

</div>

One way to do this is to add a tag Event Script.

- Select the tag you want to vibrate a device when the Tag’s configured alarm becomes active.
- Right-click the tag and select Edit Tag.
- Scroll down to Tag Events and select the pencil/edit icon.
- Select Alarm Active under Alarm Events.
- Provide a script along the lines of:

```auto
# note: system.util.sendMessage, NOT system.perspective.sendMessage
system.util.sendMessage('<project_name', messageHandler='ALARMACTIVE', payload={'tagName': tag.name},scope='S')

```

- Commit the script and save changes to the alarm.
- In the Designer Menu, select Project.
- Select Session Events.
- From the Session Event types, select Message.
- Click the “+” icon and supply ALARMACTIVE for the Message Handler name
- Supply a script here like:

```auto
system.perspective.vibrateDevice(sessionId=session.id)

```

Note that this will only work if the device is using the Perspective application to launch the session; mobile devices using a generic browser do not have access to this functionality.

---

<div class="post-metadata">

**Author:** ![yifeiliu08](https://avatars.discourse-cdn.com/v4/letter/y/bbe5ce/32.png) [@yifeiliu08](https://forum.inductiveautomation.com/u/yifeiliu08)\
**Post date:** [February 8, 2022, 5:08am UTC](https://forum.inductiveautomation.com/t/perspective-vibration-notification/32293/4 "2022-02-08T05:08:18Z")

</div>

Hi cmallonee:  
I have try your code but not success  
Step1: in the perspective I have set the (Project Name:HTC\_WareHouseScan)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/4/44a696636d4a239004de6530e5ab10ee8b464093.png)

Step2: Set the Tag:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/d/0d95de5802a7a5137b634baf8ae89f46fa661abd.png)

```auto
system.util.sendMessage("HTC_WareHouseScan","ALARMACTIVE",scope='S')
system.tag.write('[HTC_MANTIS]HTCMES/NTScan/Status',1)

```

After the alarm active, I see the Status tag was write to 1 by the scriping

I have one ZEBRA TC21 andorid system, running the APP:(HTC\_WareHouseScan)(not by IE)  
The hardware not vibrate  
Can you help to tell me , what I have made a mistake?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 8, 2022, 4:41pm UTC](https://forum.inductiveautomation.com/t/perspective-vibration-notification/32293/5 "2022-02-08T16:41:27Z")

</div>

Ah, there was a typo in the “code” I provided. If you looked at your gateway logs you would see that `session` does not have a property `id`, and that you should instead have something like this:

```auto
system.perspective.vibrateDevice(sessionId=session.props.id)

```

---

<div class="post-metadata">

**Author:** ![yifeiliu08](https://avatars.discourse-cdn.com/v4/letter/y/bbe5ce/32.png) [@yifeiliu08](https://forum.inductiveautomation.com/u/yifeiliu08)\
**Post date:** [February 8, 2022, 11:52pm UTC](https://forum.inductiveautomation.com/t/perspective-vibration-notification/32293/6 "2022-02-08T23:52:54Z")

</div>

> [@cmallonee](#):
>
> `system.perspective.vibrateDevice(sessionId=session.props.id)`

it works , that's just what I want  
But one more question, when I open the mobile end point, it works

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/a/1aa1e1f4f23ce424ffb18c516818a8cb5565e8b1.jpeg)  
but when I lock the screen, it not works  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/e/eed82211a7467e516814c01ce47fe0c26457c142.jpeg)

it that possible make it works no matter the device is lock or not?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 9, 2022, 12:15am UTC](https://forum.inductiveautomation.com/t/perspective-vibration-notification/32293/7 "2022-02-09T00:15:57Z")

</div>

No, I’m pretty sure the session is more-or-less “disconnected” when you lock the screen. When you re-open, the session needs to re-connect to the Gateway. What you’re looking for at that point is actually more of a “push” notification, which Ignition/Perspective does not offer at this time.

---

<div class="post-metadata">

**Author:** ![yifeiliu08](https://avatars.discourse-cdn.com/v4/letter/y/bbe5ce/32.png) [@yifeiliu08](https://forum.inductiveautomation.com/u/yifeiliu08)\
**Post date:** [February 9, 2022, 12:25am UTC](https://forum.inductiveautomation.com/t/perspective-vibration-notification/32293/8 "2022-02-09T00:25:01Z")

</div>

Before what I can’t understand is the SMS can send the message and also the perspective message handler also have similar function, after your explain , I understand, SMS can send message to client no need the mobile end point is open while the session need, thanks a lot

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [February 6, 2023, 7:51pm UTC](https://forum.inductiveautomation.com/t/perspective-vibration-notification/32293/9 "2023-02-06T19:51:45Z")

</div>

Good day. Should this work on a change script?

I currently have it like this:

```auto
	if self.meta.visible == true:
		system.perspective.vibrateDevice(1000)

```

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [February 6, 2023, 7:58pm UTC](https://forum.inductiveautomation.com/t/perspective-vibration-notification/32293/10 "2023-02-06T19:58:34Z")

</div>

First off, the boolean values in Python are `True` and `False`, notice the capitalization. Secondly, since the `visible` property is a boolean by default, you don't need the comparison. (I take it that this is a change script that is not on the visible property itself, otherwise it would be `if currentValue.value:`, or is this in an event script?)

```auto
if self.meta.visible:
    system.perspective.vibrateDevice(1000)

```

---

<div class="post-metadata">

**Author:** ![mjohnson0238](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mjohnson0238](https://forum.inductiveautomation.com/u/mjohnson0238)\
**Post date:** [February 6, 2023, 8:03pm UTC](https://forum.inductiveautomation.com/t/perspective-vibration-notification/32293/11 "2023-02-06T20:03:16Z")

</div>

Thank you sir. You are correct I forgot to capitalize the T in true, lol. Thanks again.
