I give up…i’ve looked through countless entries here; none of them work.
I simple have a string item; let’s call it stringy
It is defined in my items file
All i want to do is assign it the current date and time something like now.GetDateTime
Or one of the other countless ways people are doing it here…which none of them work
17-10-09 19:43:26.469 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'Test.rules’
2017-10-09 19:43:35.088 [ERROR] [.script.engine.ScriptExecutionThread] - Rule ‘Test Rule’: An error occured during the script execution: Could not invoke method: org.eclipse.xtext.xbase.lib.ObjectExtensions.operator_plus(java.lang.Object,java.lang.String) on instance: null
2017-10-09 19:43:35.481 [ERROR] [.script.engine.ScriptExecutionThread] - Rule ‘Test Rule’: An error occured during the script execution: Could not invoke method: org.eclipse.xtext.xbase.lib.ObjectExtensions.operator_plus(java.lang.Object,java.lang.String) on instance: null
2017-10-09 19:43:35.881 [ERROR] [.script.engine.ScriptExecutionThread] - Rule ‘Test Rule’: An error occured during the script execution: Could not invoke method: org.eclipse.xtext.xbase.lib.ObjectExtensions.operator_plus(java.lang.Object,java.lang.String) on instance: null
2017-10-09 19:44:04.713 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'Test.rules’
2017-10-09 19:44:04.715 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model ‘Test.rules’ is either empty or cannot be parsed correctly!
2017-10-09 19:47:51.918 [ERROR] [.script.engine.ScriptExecutionThread] - Rule ‘Test Rule’: An error occured during the script execution: The name ‘datetimeitem’ cannot be resolved to an item or type.
val DateTime strDateTime = now
postUpdate(Garage4in1LastBattOrig, strDateTime)
An error occured during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.actions.BusEvent.postUpdate(org.eclipse.smarthome.core.items.Item,java.lang.String) on instance: null
for how to format the DateTime on your sitemap in a way you want.
The section above the first link I provided has a brief discussion of Type and how you need to convert between types to use certain types of objects to command an Item.
Question:
Am i going down a bad road. My goal is to now take this time and compare it later on in a rule.
Something like (pseudocode coming)
Every day at 8 AM
Compare this item(last updated date time) to now and if it’s >25 hours send me an email.
Will i successfully be able to compare this stored value to the current time and gauge if its > 25 hours old?