You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using ReaderType.ACTUAL or 'SNAPSHOT', the last value retrieved consistently shows an hour offset. Instead of retrieving the actual last data point, it returns the data point from one hour earlier.
This code:
import tagreader
from tagreader import list_sources
from datetime import datetime, timedelta
from tagreader.utils import ReaderType
c = tagreader.IMSClient(datasource='GFC', imstype='aspenone')
try:
c.connect()
print("Connection successful")
except Exception as e:
print(f"Connection failed: {e}")
# Use the read() method to read the tag data
df_LAST = c.read(tags=['GFC.03-ST121.RPM'], read_type=ReaderType.LAST)
df_SNAPSHOT = c.read(tags=['GFC.03-ST121.RPM'], read_type='SNAPSHOT')
df = c.read(tags=['GFC.03-ST121.RPM'], start_time='04-11-24 12:50:00', end_time='04-11-24 13:10:00', read_type=ReaderType.ACTUAL)
# Print the result
print(df_LAST)
print(df_SNAPSHOT)
print(df)
Thanks for the feedback! I've looked into the issue, and it seems that the issue is not with the readertype itself but rather with the end_time parameter. If the parameter is not added the tagreader package sets it to datetime.utcnow() which is one hour behind of Norwegian time at the moment. I will add this to our backlog and fix it in the future as it is indeed a bug.
For now as a temporary fix you can pass end_time=datetime.now() to the c.read call, i.e. c.read(tag=abc, end_time=datetime.now(), read_type=ReaderType.x)
When using ReaderType.ACTUAL or 'SNAPSHOT', the last value retrieved consistently shows an hour offset. Instead of retrieving the actual last data point, it returns the data point from one hour earlier.
This code:
returns:
where the data point: 2024-11-04 12:58:31.583000+01:00 9021.310547 is the actual last datapoint.
The text was updated successfully, but these errors were encountered: