[Solved]Calculate duration from number (seconds)

This is the working rule:

rule "Calculate decimal time counter"
when
	Item SB_ARZ_Time changed
then
	val totalSecs = (SB_ARZ_Time.state as Number).intValue
	val sec = totalSecs % 60
	val min = (totalSecs / 60) % 60
	val hrs = (totalSecs / (60*60)) % 24
	val day = totalSecs / (60*60*24)
	logInfo("default.rules", min.toString + ":" + sec.toString)
end

Now I have to investigate for the formating (ss:mm) and how to transfer this to the item. :frowning:

2 Likes