Add time range buttons (1H/6H/24H) to flow rate popup
Replace static tag-history binding with expression binding using runScript to call flowrate.queryHistory(), which dynamically queries tag history based on the selected time range. Buttons highlight blue when active, grey when inactive. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
14
projects/watermeter/ignition/script-python/flowrate/code.py
Normal file
14
projects/watermeter/ignition/script-python/flowrate/code.py
Normal file
@@ -0,0 +1,14 @@
|
||||
def queryHistory(timeHours):
|
||||
from java.util import Date
|
||||
|
||||
end = Date()
|
||||
start = Date(end.getTime() - long(timeHours * 3600000))
|
||||
|
||||
return system.tag.queryTagHistory(
|
||||
paths=["[CoreDB/ignition-ignition:default]watermeter/prefilterflowrate"],
|
||||
startDate=start,
|
||||
endDate=end,
|
||||
returnSize=120,
|
||||
aggregationMode="Average",
|
||||
returnFormat="Wide"
|
||||
)
|
||||
Reference in New Issue
Block a user