# How to use system.opc.readValue

**URL:** <https://forum.inductiveautomation.com/t/how-to-use-system-opc-readvalue/3136>\
**Category:** Ignition\
**Created:** [July 28, 2011, 8:52am UTC](https://forum.inductiveautomation.com/t/how-to-use-system-opc-readvalue/3136 "2011-07-28T08:52:18Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![weng](https://avatars.discourse-cdn.com/v4/letter/w/bbce88/32.png) [@weng](https://forum.inductiveautomation.com/u/weng)\
**Post date:** [July 28, 2011, 8:52am UTC](https://forum.inductiveautomation.com/t/how-to-use-system-opc-readvalue/3136/1 "2011-07-28T08:52:18Z")

</div>

I want to read value of followed opcvalue descibed in tree :IgnitionOPCUA /devices/mine/w\_i11-10/w\_i1 ,I use system.opc.readValue(‘IgnitionOPCUA’,’ [mine]w\_i1-10/w\_i1’),but read nothing,how can use the param of function system.opc.readValue,thank you

---

<div class="post-metadata">

**Author:** ![weng](https://avatars.discourse-cdn.com/v4/letter/w/bbce88/32.png) [@weng](https://forum.inductiveautomation.com/u/weng)\
**Post date:** [August 1, 2011, 2:07am UTC](https://forum.inductiveautomation.com/t/how-to-use-system-opc-readvalue/3136/2 "2011-08-01T02:07:45Z")

</div>

I have solve the problem.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [August 2, 2011, 4:13pm UTC](https://forum.inductiveautomation.com/t/how-to-use-system-opc-readvalue/3136/3 "2011-08-02T16:13:22Z")

</div>

Glad you got it working.

---

<div class="post-metadata">

**Author:** ![jasonpdavid](https://avatars.discourse-cdn.com/v4/letter/j/8edcca/32.png) [@jasonpdavid](https://forum.inductiveautomation.com/u/jasonpdavid)\
**Post date:** [September 9, 2011, 8:30pm UTC](https://forum.inductiveautomation.com/t/how-to-use-system-opc-readvalue/3136/4 "2011-09-09T20:30:43Z")

</div>

How can I get just the value to return and not the status code, etc?

---

<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 9, 2011, 8:56pm UTC](https://forum.inductiveautomation.com/t/how-to-use-system-opc-readvalue/3136/5 "2011-09-09T20:56:16Z")

</div>

You can’t, but you can just use the .value of the QualifiedValue that gets returned.

```auto
# Reading just one value
qv = system.opc.readValue('Ignition OPC-UA Server', '[ctt]Scalar/Bool')
print 'value = %s' % qv.value

# Reading multiple values
qvs = system.opc.readValues('Ignition OPC-UA Server', ['[ctt]Scalar/Bool', '[ctt]Scalar/Byte'])
just_values = map(lambda x: x.value, qvs)
print 'values = %s' % just_values
```

---

<div class="post-metadata">

**Author:** ![jasonpdavid](https://avatars.discourse-cdn.com/v4/letter/j/8edcca/32.png) [@jasonpdavid](https://forum.inductiveautomation.com/u/jasonpdavid)\
**Post date:** [September 9, 2011, 10:08pm UTC](https://forum.inductiveautomation.com/t/how-to-use-system-opc-readvalue/3136/6 "2011-09-09T22:08:58Z")

</div>

I have it working with the Ignition OPC server but not with Kepware are there any known issues with the format?

---

<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 9, 2011, 10:37pm UTC](https://forum.inductiveautomation.com/t/how-to-use-system-opc-readvalue/3136/7 "2011-09-09T22:37:08Z")

</div>

When reading against Kepware the String you use for item path is going to need to be the full NodeId of whatever tag you want (assuming you’re talking about UA). Try browsing Kepware, dragging a tag into SQLTags, and looking at what the item path looks like.

---

<div class="post-metadata">

**Author:** ![jasonpdavid](https://avatars.discourse-cdn.com/v4/letter/j/8edcca/32.png) [@jasonpdavid](https://forum.inductiveautomation.com/u/jasonpdavid)\
**Post date:** [September 9, 2011, 11:18pm UTC](https://forum.inductiveautomation.com/t/how-to-use-system-opc-readvalue/3136/8 "2011-09-09T23:18:59Z")

</div>

Am I wrong in using the string that is displayed in the sqlt\_meta mysql table? I also copied the string from the “edit tag” path in the designer.

---

<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 9, 2011, 11:42pm UTC](https://forum.inductiveautomation.com/t/how-to-use-system-opc-readvalue/3136/9 "2011-09-09T23:42:27Z")

</div>

The one from the edit tag dialog would be it, but it’s probably hiding part of it from you. There’s like an ns=1; prefixed to it or something… Not sure exactly how to find out what it really is without looking at Kepware.

---

<div class="post-metadata">

**Author:** ![jasonpdavid](https://avatars.discourse-cdn.com/v4/letter/j/8edcca/32.png) [@jasonpdavid](https://forum.inductiveautomation.com/u/jasonpdavid)\
**Post date:** [September 10, 2011, 5:06am UTC](https://forum.inductiveautomation.com/t/how-to-use-system-opc-readvalue/3136/10 "2011-09-10T05:06:07Z")

</div>

I’m striking out with everything I’ve tried when attempting to read the value from Kepware. I read over this article [kepware.com/Support\_Center/S … client.pdf](http://www.kepware.com/Support_Center/SupportDocuments/Help/opcuaclient.pdf) and tried changing the structure. Didn’t work. I’ve copied the string from the edit tag dialog and tried copying the string from the OPC quick client to no avail.

The structure I have IS working for the Ignition OPC Server…

---

<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 11, 2011, 12:49am UTC](https://forum.inductiveautomation.com/t/how-to-use-system-opc-readvalue/3136/11 "2011-09-11T00:49:29Z")

</div>

On page 19 of that document you posted there’s some example addresses, the ones like “ns=2;s=Blahblahblah”. Those are the format you need. Those are the the NodeIds of the nodes in Kepware.

If that doesn’t work/you can’t find those give support a call and they can poke around with you on a GoToMeeting.

---

<div class="post-metadata">

**Author:** ![jasonpdavid](https://avatars.discourse-cdn.com/v4/letter/j/8edcca/32.png) [@jasonpdavid](https://forum.inductiveautomation.com/u/jasonpdavid)\
**Post date:** [September 11, 2011, 12:54am UTC](https://forum.inductiveautomation.com/t/how-to-use-system-opc-readvalue/3136/12 "2011-09-11T00:54:27Z")

</div>

Thanks. I tried those formats as well. We can revisit next week. I’m not sure why I keep getting null for the return.

---

<div class="post-metadata">

**Author:** ![diat150](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@diat150](https://forum.inductiveautomation.com/u/diat150)\
**Post date:** [September 11, 2011, 4:35am UTC](https://forum.inductiveautomation.com/t/how-to-use-system-opc-readvalue/3136/13 "2011-09-11T04:35:56Z")

</div>

ns=2:s=Channel1.Device1

thats how mine looks in the tag, I havent tried using the opc.readValue

---

<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 11, 2011, 4:10pm UTC](https://forum.inductiveautomation.com/t/how-to-use-system-opc-readvalue/3136/14 "2011-09-11T16:10:25Z")

</div>

It’s possible that something isn’t working correctly when using system.opc.readValue. Investigation time!

---

<div class="post-metadata">

**Author:** ![jasonpdavid](https://avatars.discourse-cdn.com/v4/letter/j/8edcca/32.png) [@jasonpdavid](https://forum.inductiveautomation.com/u/jasonpdavid)\
**Post date:** [September 23, 2011, 4:56pm UTC](https://forum.inductiveautomation.com/t/how-to-use-system-opc-readvalue/3136/15 "2011-09-23T16:56:18Z")

</div>

I am now running Ignition 7.2.9-beta5. The Kepware is now working correctly when running the opc.readValue.

However, now some of my Ignition OPC UA Server floats are stepping registers.  
Example: request register 7004, returns 7006 etc.

This occurs in the OPC Quick Client from the web as well. Weird thing is that it the SQLTags provider is getting the right values on the scheduled scans… ![:scratch:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/76d1620bec252bfac07050c889ff5a91dc8a9c25.gif ":scratch:")

---

<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 23, 2011, 5:38pm UTC](https://forum.inductiveautomation.com/t/how-to-use-system-opc-readvalue/3136/16 "2011-09-23T17:38:03Z")

</div>

[quote=“jasonpdavid”]I am now running Ignition 7.2.9-beta5. The Kepware is now working correctly when running the opc.readValue.

However, now some of my Ignition OPC UA Server floats are stepping registers.  
Example: request register 7004, returns 7006 etc.

This occurs in the OPC Quick Client from the web as well. Weird thing is that it the SQLTags provider is getting the right values on the scheduled scans… ![:scratch:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/76d1620bec252bfac07050c889ff5a91dc8a9c25.gif ":scratch:")[/quote]

Call into support and we can poke around and see what that’s about…

Try using the Modbus-v2 driver if you aren’t already. That’s probably the first thing support will have you do.
