# Perspective IP Address for devices

**URL:** <https://forum.inductiveautomation.com/t/perspective-ip-address-for-devices/39019>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [September 24, 2020, 1:06pm UTC](https://forum.inductiveautomation.com/t/perspective-ip-address-for-devices/39019 "2020-09-24T13:06:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![keith.acierno](https://avatars.discourse-cdn.com/v4/letter/k/898d66/32.png) [@keith.acierno](https://forum.inductiveautomation.com/u/keith.acierno)\
**Post date:** [September 24, 2020, 1:06pm UTC](https://forum.inductiveautomation.com/t/perspective-ip-address-for-devices/39019/1 "2020-09-24T13:06:38Z")

</div>

Hello,

I am trying to get the IP address of each perspective device to show up on a label of the device. This was pretty straight forward when using the vision tags, in vision applications.

I had called in and the attached code was provided. It is not working properly as it appears it’s grabbing the first available device IP. This same IP is then showing for all attached devices. They are not returning their own IP.

Is this a coding issue, or am I missing something else? Trying to set this up with perspective session properties is not very clear.

 ![Capture](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/1/b155a809c3f701b30bbbb302e41458b168f09963.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [September 24, 2020, 1:14pm UTC](https://forum.inductiveautomation.com/t/perspective-ip-address-for-devices/39019/2 "2020-09-24T13:14:01Z")

</div>

Do you see different addresses for the sessions in the gateway status (Status \> Connections \> Perspective Sessions)?

---

<div class="post-metadata">

**Author:** ![keith.acierno](https://avatars.discourse-cdn.com/v4/letter/k/898d66/32.png) [@keith.acierno](https://forum.inductiveautomation.com/u/keith.acierno)\
**Post date:** [September 24, 2020, 1:20pm UTC](https://forum.inductiveautomation.com/t/perspective-ip-address-for-devices/39019/3 "2020-09-24T13:20:09Z")

</div>

Yes, they are there.

---

<div class="post-metadata">

**Author:** ![keith.acierno](https://avatars.discourse-cdn.com/v4/letter/k/898d66/32.png) [@keith.acierno](https://forum.inductiveautomation.com/u/keith.acierno)\
**Post date:** [September 24, 2020, 1:22pm UTC](https://forum.inductiveautomation.com/t/perspective-ip-address-for-devices/39019/4 "2020-09-24T13:22:08Z")

</div>

My phone popped up with the correct IP, but the tablet is using the IP of the server. When I reloaded the tablet page, it is now showing the IP of the phone.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [September 24, 2020, 1:27pm UTC](https://forum.inductiveautomation.com/t/perspective-ip-address-for-devices/39019/5 "2020-09-24T13:27:59Z")

</div>

Try this for your transform script:

```auto
def transform(self, value, quality, timestamp):
	"""
	Transform the incoming value and return a result.

	Arguments:
		self: A reference to the component this binding is configured on.
		value: The incoming value from the binding or the previous transform.
		quality: The quality code of the incoming value.
		timestamp: The timestamp of the incoming value as a java.util.Date
	"""
	session_infos = system.perspective.getSessionInfo()
	
	for session in session_infos:
		if (session.id == value):
			return session.clientAddress
	
	return "N/A"

```

I think your comparison of `value` to `self.session.props.id` is wrong - it should be to `ses.id`.

You will see “N/A” in the designer but should see addresses in real sessions.

---

<div class="post-metadata">

**Author:** ![keith.acierno](https://avatars.discourse-cdn.com/v4/letter/k/898d66/32.png) [@keith.acierno](https://forum.inductiveautomation.com/u/keith.acierno)\
**Post date:** [September 24, 2020, 2:04pm UTC](https://forum.inductiveautomation.com/t/perspective-ip-address-for-devices/39019/6 "2020-09-24T14:04:54Z")

</div>

> [@Kevin.Herron](#):
>
> def transform(self, value, quality, timestamp): """ Transform the incoming value and return a result. Arguments: self: A reference to the component this binding is configured on. value: The incoming value from the binding or the previous transform. quality: The quality code of the incoming value. timestamp: The timestamp of the incoming value as a java.util.Date """ session\_infos = system.perspective.getSessionInfo() for session in session\_infos: if (session.id == value): return session.clientAddress return "N/A"

It works! Thanks!

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [September 24, 2020, 3:56pm UTC](https://forum.inductiveautomation.com/t/perspective-ip-address-for-devices/39019/7 "2020-09-24T15:56:04Z")

</div>

You can also use `self.session.info` or `self.getSession().getInfo()` directly, and probably eliminate both the scripting call and the bulk of the transform.
