I am trying to find if a machine ran in the last hour. So even if it is off now but it has ran in the last hour I am looking at getting Boolean true. I am looking at the historian of my Boolean status bit with the following piece of code but I am getting random values. Sometimes it returns 1 as it supposed sometimes it returns 0. I just want to now if in the last 60 minutes that tag was true. Could you please help? Thanks!
tagPath = "[history_provider]tag_path" startDate = system.date.addMinutes(system.date.now(), -60) endDate = system.date.now() dataset = system.tag.queryTagHistory(paths=[tagPath], startDate = startDate, endDate = endDate, returnSize=1, aggregationMode="Maximum", returnFormat='Wide') data= dataset.getValueAt(0,1)