Sample CPU and Shelly power every second for energy runs

This commit is contained in:
Steffen committed 2026-10-08 12:41:48 +02:00
1 parent 79bb6a11cd
commit 17f3b0dbd3
10 files changed
+13 -12

No files matched your search

+1 -1
View File
@@ -81,7 +81,7 @@ def shelly_group(tree):
E.SubElement(E.SubElement(e,'elementProp',name='HTTPsampler.Arguments',elementType='Arguments'),'collectionProp',name='Arguments.arguments')
for k,v in [('HTTPSampler.domain','${__P(shelly_host,192.168.1.44)}'),('HTTPSampler.port','${__P(shelly_port,80)}'),('HTTPSampler.protocol','http'),('HTTPSampler.path','/rpc/Switch.GetStatus?id=${__P(shelly_switch_id,0)}'),('HTTPSampler.method','GET'),('HTTPSampler.implementation','HttpClient4'),('HTTPSampler.connect_timeout','3000'),('HTTPSampler.response_timeout','3000')]:prop(e,k,v)
for k,v in [('HTTPSampler.follow_redirects',False),('HTTPSampler.use_keepalive',True)]:prop(e,k,v,'boolProp')
script(t,'JSR223Timer','Fixed meter cadence', "if (!vars.get('shelly_last_poll_ms')) return 0L; return Math.max(0L, Long.parseLong(vars.get('shelly_last_poll_ms')) + Long.parseLong(props.getProperty('shelly_interval_ms','5000')) - System.currentTimeMillis())")
script(t,'JSR223Timer','Fixed meter cadence', "if (!vars.get('shelly_last_poll_ms')) return 0L; return Math.max(0L, Long.parseLong(vars.get('shelly_last_poll_ms')) + Long.parseLong(props.getProperty('shelly_interval_ms','1000')) - System.currentTimeMillis())")
script(t,'JSR223PreProcessor','Clear stale power values', "['shelly_power_watts','shelly_voltage_volts','shelly_current_amps','shelly_energy_wh'].each { vars.put(it,'') }")
script(t,'JSR223Assertion','Validate and extract plug readings', """vars.put('shelly_last_poll_ms',prev.getStartTime().toString())
try {