PIconnect icon indicating copy to clipboard operation
PIconnect copied to clipboard

PIData.py PISeriesContainer summary

Open sblmz opened this issue 2 years ago • 0 comments

Bug report

Description

When I try to use the summary function on a tag I get the following error:

File "C:\ProgramData\Anaconda3\envs\rdkit-env\lib\site-packages\PIconnect\PIData.py", line 465, in summary key = PIConsts.SummaryType(int(summary.Key)).name TypeError: int() argument must be a string, a bytes-like object or a number, not 'AFSummaryTypes'

To Reproduce

Steps to reproduce the behavior: 1 connect to PI Historian 2 retrieve a tag example sinusoid 3 verify the tag returns data 4 use the summary function to return the total on the time interval

import PIconnect IP = '192.168.20.2' with PIconnect.PIServer(IP) as s: ... t = s.search('sinusoid')[0] ... t PIPoint(SINUSOID, 12 Hour Sine Wave; Current Value: 44.1011962890625 ) t.summary('-1h','', summary_types=1) #SummaryType.TOTAL same error

Traceback (most recent call last): File "", line 1, in File "C:\ProgramData\Anaconda3\envs\rdkit-env\lib\site-packages\PIconnect\PIData.py", line 465, in summary key = PIConsts.SummaryType(int(summary.Key)).name TypeError: int() argument must be a string, a bytes-like object or a number, not 'AFSummaryTypes'

Expected behavior

Get the summary result

Possible solutions

Type mismatch with AFSummaryTypes I added a print statement before the error: print(type(summary.Key), summary.Key) <class 'OSIsoft.AF.Data.AFSummaryTypes'> Total

I think it is case sensitive and it should return TOTAL

Screenshots

N/A

System

  • OS: [e.g. Windows, Linux] Windows - Anaconda
  • Python version: [Python 3.x] 3.9.10
  • PIconnect version: [e.g. 0.10.0] 0.10.4 same behavior with 0.10.6

Additional context

None

sblmz avatar May 31 '23 19:05 sblmz