- Platform information:
- Hardware: (amd64)
- OS: Windows 10/10.0 (amd64)
- Java Runtime Environment: 11.0.12 (Zulu11.50+19-CA)
- openHAB version: openHAB 3.2.0.M3
I have the following rule which is working perfectly as far as I can tell, however Visual Studio does not like it - and it was not flagged as an issue when I set it up last week?
rule "Battery Voltage Changed" when Item ShellyUNIshellyunie8db84d6b3e510163199230_VoltageADC changed then var DateTimeType upsBattUpdatedPrevious = (ShellyUNI_Battery_Updated.state as DateTimeType).getZonedDateTime() var upsBattUpdatedNew = new DateTimeType() var Number upsBattUpdatedDifference = Duration.between(upsBattUpdatedPrevious, ZonedDateTime.now()).toSeconds() ShellyUNI_Battery_Updated.postUpdate(upsBattUpdatedNew) ShellyUNI_Voltage_Update_Diff.postUpdate(upsBattUpdatedDifference) logDebug("shelly_uni", "Battery Status Updated " + " Previous: " + upsBattUpdatedPrevious + " New: " + upsBattUpdatedNew + " Difference: " + upsBattUpdatedDifference + " seconds.") end
Error from VS:
The rules seems to be working:
14:54:52.950 [DEBUG] [.openhab.core.model.script.shelly_uni] - Battery Status Updated Previous: 2021-10-11T14:54:49.114048600+02:00 New: 2021-10-11T14:54:52.950374900+0200 Difference: 3 seconds.
Any suggestions or advise?