Skip to content
Snippets Groups Projects

Resolve "Add processing frequency option for items"

Merged Manuel Krombholz requested to merge 32-add-processing-frequency-option-for-items into dev
All threads resolved!
Files
11
@@ -21,6 +21,8 @@ aspect ItemHandling {
eq ItemWithDoubleState.getStateAsString() = Double.toString(getState());
eq ItemWithStringState.getStateAsString() = getState();
syn LastChanged Item.getLastChanged() = new LastChanged();
//--- getStateAsDouble ---
syn double Item.getStateAsDouble();
// TupleHSB and String work like default
@@ -285,7 +287,7 @@ aspect ItemHandling {
//--- stateUpdated ---
/**
* Called, whenever the state of an item is updated. Does various things including:
* Called, whenever the state of an item is updated. Does various things (except it has no parent) including:
* <ul>
* <li>Send the new state via MQTT</li>
* <li>Send the new state to Influx DB</li>
@@ -294,6 +296,7 @@ aspect ItemHandling {
* @param shouldSendState whether to send the new state (currently affects MQTT and Influx)
*/
protected void Item.stateUpdated(boolean shouldSendState) {
if (getParent() == null) { return; }
if (shouldSendState) {
try {
// sendState() refined in MQTT and Influx aspect
@@ -302,9 +305,13 @@ aspect ItemHandling {
logger.catching(e);
}
}
getItemObserver().apply();
if (this.getLastChanged().checkStateProcessingTime(relevantFrequencySetting())) {
this.getLastChanged().afterStateChangeProcessed();
getItemObserver().apply();
}
}
//--- sendState ---
protected void Item.sendState() throws Exception {
for (MachineLearningModel model : getRelevantInMachineLearningModels()) {
@@ -459,6 +466,11 @@ aspect ItemHandling {
}
//--- onReceiveStateChange ---
protected void Item.onReceiveStateChange() {
//Instant lastChange = this.
}
@@ -506,4 +518,6 @@ aspect ItemHandling {
syn String ItemUpdate.getNewStateAsString();
eq ItemUpdateColor.getNewStateAsString() = getNewHSB().toString();
eq ItemUpdateDouble.getNewStateAsString() = Double.toString(getNewValue());
}
Loading