Hello,
this thread is for devs or people who know where i can file a bug report.
I created a rule which works like a charm but I always get the entry
[WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model ‘rollerShutter.rules’ is either empty or cannot be parsed correctly!
in my logfile. The SmartHome Designer says in line 35 “Type mismatch: cannot convert from void to Timer”.
Since the rule works this matter isn’t pressing but since I want to improve Openhub I thought I consult the community, best case, we improve it, otherwise I spent some time writing this.
Feel free to ask questions, I’m glad if I could help.
import java.util.HashMap
import java.util.Map
val Functions$Function6<RollershutterItem, Integer, Integer, Integer, Boolean, Map<String, Boolean>, Boolean> rollerShutterFunction = [
RollershutterItem rollerShutter,
int sunAzimuthFrom,
int sunAzimuthTo,
int runtime,
Boolean setHorizontal,
Map<String, Boolean> triggeredMap |
logInfo("RollerShutterLogger", "got triggered with item " + rollerShutter.name);
if(SunAzimuth.state > sunAzimuthFrom && SunAzimuth.state < sunAzimuthTo
&& !triggeredMap.get(rollerShutter.name)
&& NightState.state == OFF
&& isRaining.state == OFF
&& gBrightnessMax.state >= 10000.0
) {
logInfo("RollerShutterLogger", "Lowering " + rollerShutter.name);
triggeredMap.put(rollerShutter.name, true);
rollerShutter.send(DOWN);
if (setHorizontal) {
createTimer(now.plusSeconds(runtime), [ |
rollerShutter.send(UP);
createTimer(now.plusSeconds(2), [ |
rollerShutter.send(STOP);
])
])
}
} else if(SunAzimuth.state >= sunAzimuthTo
&& triggeredMap.get(rollerShutter.name)) {
logInfo("RollerShutterLogger", "Lowering " + rollerShutter.name);
triggeredMap.put(rollerShutter.name, false);
rollerShutter.send(UP);
}
true
]
val double bightnessThreshold = 10000.0
val HashMap< String, Boolean> triggeredMap = newHashMap(
"A2" -> false,
"A25" -> false
)
// lounge
rule "rollershutter lounge"
when
Item SunAzimuth changed
then
logInfo("RollerShutterLogger", "SunAzimuth changed from " + previousState + " to " + SunAzimuth.state);
//OG
rollerShutterFunction.apply(A2, 260, 360, 75, true, triggeredMap); //links neben tür
end
rule "rollershutter open for night"
when
Item DayPhase changed to SUN_SET
then
logInfo("RollerShutterLogger", "night opening Rollershutteres")
A25.send(UP); triggeredMap.put("A25" ,false);
end
** NOTE ** the script as it’s posted is already fixed