Skip to content

PIData.py PISeriesContainer summary  #708

@sblmz

Description

@sblmz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions