Calculate how many minutes in the last 24 hours the windows of a room have been opened

@anon71759204 probably has the solution but as for calculating with time see the add-on docs. In particular https://www.openhab.org/addons/automation/jsscripting/#time and do not neglect to follow the link there to the joda-js library docs. The class you are looking for will be referenced as time.Duration. These classes are almost exactly the same as the Java classes so tutorials like DateTime Conversion (openHAB 3.x) will also apply almost unchanged. Though you can ignore a lot of the stuff talking about how to convert something to a ZonedDateTime. In JS Scripting time.toZDT() can convert just about anything that can be converted to a ZonedDateTime into a ZonedDateTime for you.