I’m trying to use the following lamdba
val duration = [ GenericItem s |
if(now.getHour() > 6)
s.sumSince(now.withHour(6).withMinute(0).withSecond(0))
else
s.sumSince(now.minusDays(1).withHour(6).withMinute(0).withSecond(0))
]
val switchControl = [ GenericItem item | //, Number duration, Number powerRequired, Number powerAvailable |
duration.apply(item_bathroom_radiator) // This line will work
duration.apply(item) // this line with not
]
I found this article:
- cannot see other globals, if you have a lambda that needs to call another lambda you must pass the second one as an argument
Are there any examples of this?