Have several rollershutters which have to shut to x% if it is sunny. To prevent opening and shutting by each cloud, I would like to build an average of light intensity for the last minutes.
The values are stored in rrd4j and in OH2 rules it was very easy by using helligkeit_avg = (Wetterstation_ILLUMINATION.averageSince(now.minusMinutes(10)) as Number).intValue
in a rule.
But how to do it in OH3 with blockly?
Sorry, I do not get it.
Thanks for any idea.
I’m building EMCA Script like:
var logger = Java.type(‘org.slf4j.LoggerFactory’).getLogger(‘org.openhab.rule.’ + ctx.ruleUID);
var ZonedDateTime = Java.type(‘java.time.ZonedDateTime’);
var PersistenceExtensions = Java.type(‘org.openhab.core.persistence.extensions.PersistenceExtensions’);
var v_schwellwert_verschattung_lux_avg_max = 6000.0;
var v_aktuelle_helligkeit = itemRegistry.getItem(“WetterstationGarten_Illumination”).getState();