Platform information:
- Hardware: Raspberry Pi 3B
- OS: Raspbian Buster
- Java Runtime Environment: Zulu (openjdk version “1.8.0_152”)
I guess this is a rather silly question and similar problems have been discussed here before. I’ve done a lot of reading but for some reason I don’t get it to work.
I have a rule that is supposed to combine the time of the last update with the state of a device into a string. So the desired output in the sitemap is something like
Water Meter: 19:17:23 - OK
So I have a string item
String sWaterMeterStatus "Water Meter: [%s]"
and a rule
rule "rule_waterMeter_status"
when
Item nWaterMeterReading received update
then
var String sWaterMeterStatus = sWaterMeterStatus.state
//var String sWaterMeterLastUpdate = new DateTimeType().toString("HH:mm:ss")
var String sWaterMeterLastUpdate = new DateTimeType().toString()
logInfo("rule_waterMeter_status", "sWaterMeterStatus = " + sWaterMeterStatus )
logInfo("rule_waterMeter_status", "sWaterMeterLastUpdate = " + sWaterMeterLastUpdate)
sWaterMeterStatus.postUpdate(sWaterMeterLastUpdate + sWaterMeterStatus )
end
I’ve tried a lot of different suggestions from the community but I always get errors when converting the dateTime to a string.
Just an example:
Rule ‘rule_waterMeter_status’: An error occurred during the script execution: Cannot resolve proxy: java:/Objects/org.joda.time.format.DateTimeFormatter#org.joda.time.format.DateTimeFormatter
Do I need a special include / import file?
Any help is greatly appreciated!