Hi,
I’m trying to calculate the seconds between two times so I can calculate from Power(flow) to kW/h
rule "CalculateGeneratedGrid"
// calculating the total generated power from the grid per day
when
Item FroniusSymoInverter_GridPower changed
then
//calculate the time difference
var timenow = new DateTimeType()
val DateTimeType endTimeState = (Solar_Feed_LastUpdate.state as DateTimeType)
val Instant programmedStart = timenow.toInstant()
val Instant programmedEnd = endTimeState.toInstant()
val Duration programDuration = Duration.between(programmedEnd, programmedStart)
....
but toInstant does’t work nor does
val Duration programDuration = Duration.between(endTimeState, timenow)
Then the error is: Type mismatch: cannot convert from DateTimeType to Temporal(org.eclipse.xtext.xbase.validation.IssueCodes.incompatible_types)
any idea how to get the seconds of time difference?