Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a nice solution to handling conditional running of PresenceSimulation without requiring the script interpreter! Just a few review comments. Please let me know if you would like me to try it out on OH2.
@@ -27,6 +27,7 @@ Import-Package: com.google.common.collect;version="1.0.0", | |||
org.osgi.service.cm, | |||
org.osgi.service.component, | |||
org.osgi.service.event, | |||
org.osgi.util.tracker;version="1.5.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless this version constraint is needed, please remove it.
Item item = registry.getItem("PresenceSimulation"); | ||
if (item.getState() != OnOffType.ON) { | ||
logger.info( | ||
"Presence Simulation job detected, but PresenceSimulation is not in ON state. Job is not executed"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be reduced to debug, otherwise there might be many unneeded log entries. WDYT?
} | ||
} catch (ItemNotFoundException e) { | ||
logger.error( | ||
"Presence Simulation job detected, but PresenceSimulation item does not exists. Check configuration"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be reduced to warn, since the situation does not lead to system instability.
State state = TypeParser.parseState(item.getAcceptedDataTypes(), args[2]); | ||
publisher.postUpdate(item.getName(), state); | ||
logger.debug("Published update {}", Arrays.asList(args)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to log a warn here instead of silently doing no postUpdate.
I added requested after review |
Thanks @SirAd! Please report when you think it's good to merge, and I will give it a spin (io and persistence). When the wiki is updated, it will be done and very nice to have it working on OH2! |
I did tests on OH1 - all looks fine. I also put some basic tests in OH2 environment, but it would be great if somebody could do some more tests. Wiki is update. In my opinion PR is ready for merge. |
Great, thanks! |
* GCal - update for OH2 compatibility
Remove
ConsoleInterpreter
class no longer support in OH2. Replaced withEventPublisher
class (described in ticket #4770 )