You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 7, 2020. It is now read-only.
I have a .rules file (in OH 2.4.0 and same issue in 2.5.0.-SNAPSHOT) with a value defined within each of the rules as shown below. It is just a string to use as label for logDebug/Info/Warning/Error() functions. Somehow the validator thinks the tag variable is not used (one or two messages, it varies...). It displays the following messages when starting OH:
2019-01-12 10:12:36.063 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'dsmr.rules', using it anyway:
The value of the local variable tag is not used
The value of the local variable tag is not used
2019-01-12 10:12:36.066 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'dsmr.rules'
and sometimes it throws an error:
2019-01-12 10:20:29.315 [ERROR] [xtext.validation.CompositeEValidator] - Error executing EValidator
java.util.ConcurrentModificationException: null
at org.eclipse.emf.common.util.AbstractEList$EIterator.checkModCount(AbstractEList.java:758) ~[?:?]
at org.eclipse.emf.common.util.AbstractEList$EIterator.doNext(AbstractEList.java:712) ~[?:?]
at org.eclipse.emf.common.util.AbstractEList$EIterator.next(AbstractEList.java:692) ~[?:?]
at org.eclipse.emf.common.util.AbstractTreeIterator.next(AbstractTreeIterator.java:133) ~[?:?]
at org.eclipse.xtext.resource.impl.DefaultResourceDescription.computeExportedObjects(DefaultResourceDescription.java:88) ~[?:?]
at org.eclipse.xtext.resource.DerivedStateAwareResourceDescriptionManager$1.getLookUp(DerivedStateAwareResourceDescriptionManager.java:84) ~[?:?]
at org.eclipse.xtext.resource.impl.AbstractResourceDescription.getExportedObjects(AbstractResourceDescription.java:50) ~[?:?]
at org.eclipse.xtext.resource.impl.AbstractCompoundSelectable$4.apply(AbstractCompoundSelectable.java:75) ~[?:?]
at org.eclipse.xtext.resource.impl.AbstractCompoundSelectable$4.apply(AbstractCompoundSelectable.java:71) ~[?:?]
at com.google.common.collect.Iterators$8.transform(Iterators.java:799) ~[22:com.google.guava:18.0.0]
at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48) ~[22:com.google.guava:18.0.0]
at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48) ~[22:com.google.guava:18.0.0]
at com.google.common.collect.Iterators$5.hasNext(Iterators.java:548) ~[22:com.google.guava:18.0.0]
at com.google.common.collect.TransformedIterator.hasNext(TransformedIterator.java:43) ~[22:com.google.guava:18.0.0]
at com.google.common.collect.Iterators.addAll(Iterators.java:361) ~[22:com.google.guava:18.0.0]
at com.google.common.collect.Iterables.addAll(Iterables.java:354) ~[22:com.google.guava:18.0.0]
at com.google.common.collect.Sets.newLinkedHashSet(Sets.java:328) ~[22:com.google.guava:18.0.0]
at org.eclipse.xtext.xbase.lib.IterableExtensions.toSet(IterableExtensions.java:619) ~[160:org.eclipse.xtext.xbase.lib:2.14.0.v20180522-1629]
at org.eclipse.xtext.xbase.validation.UniqueClassNameValidator.checkUniqueInIndex(UniqueClassNameValidator.java:102) ~[?:?]
at org.eclipse.xtext.xbase.validation.UniqueClassNameValidator.doCheckUniqueName(UniqueClassNameValidator.java:95) ~[?:?]
at org.eclipse.xtext.xbase.validation.UniqueClassNameValidator.doCheckUniqueName(UniqueClassNameValidator.java:87) ~[?:?]
at org.eclipse.xtext.xbase.validation.UniqueClassNameValidator.lambda$checkUniqueName$0(UniqueClassNameValidator.java:74) ~[?:?]
at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]
at org.eclipse.xtext.xbase.validation.UniqueClassNameValidator.checkUniqueName(UniqueClassNameValidator.java:76) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
at org.eclipse.xtext.validation.AbstractDeclarativeValidator$MethodWrapper.invoke(AbstractDeclarativeValidator.java:118) ~[154:org.eclipse.xtext:2.14.0.v20180522-1821]
at org.eclipse.xtext.validation.AbstractDeclarativeValidator.internalValidate(AbstractDeclarativeValidator.java:312) ~[154:org.eclipse.xtext:2.14.0.v20180522-1821]
at org.eclipse.xtext.validation.AbstractInjectableValidator.validate(AbstractInjectableValidator.java:71) ~[154:org.eclipse.xtext:2.14.0.v20180522-1821]
at org.eclipse.xtext.validation.CompositeEValidator.validate(CompositeEValidator.java:151) [154:org.eclipse.xtext:2.14.0.v20180522-1821]
at org.eclipse.emf.ecore.util.Diagnostician.doValidate(Diagnostician.java:171) [66:org.eclipse.emf.ecore:2.12.0.v20160420-0247]
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:158) [66:org.eclipse.emf.ecore:2.12.0.v20160420-0247]
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137) [66:org.eclipse.emf.ecore:2.12.0.v20160420-0247]
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:108) [66:org.eclipse.emf.ecore:2.12.0.v20160420-0247]
at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.validateModel(ModelRepositoryImpl.java:282) [128:org.eclipse.smarthome.model.core:0.11.0.201901111358]
at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.addOrRefreshModel(ModelRepositoryImpl.java:95) [128:org.eclipse.smarthome.model.core:0.11.0.201901111358]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.checkFile(FolderObserver.java:239) [128:org.eclipse.smarthome.model.core:0.11.0.201901111358]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.processIgnoredFiles(FolderObserver.java:149) [128:org.eclipse.smarthome.model.core:0.11.0.201901111358]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.addModelParser(FolderObserver.java:95) [128:org.eclipse.smarthome.model.core:0.11.0.201901111358]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
at org.apache.felix.scr.impl.inject.methods.BaseMethod.invokeMethod(BaseMethod.java:228) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.inject.methods.BaseMethod.access$500(BaseMethod.java:41) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.inject.methods.BaseMethod$Resolved.invoke(BaseMethod.java:664) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.inject.methods.BaseMethod.invoke(BaseMethod.java:510) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.inject.methods.BindMethod.invoke(BindMethod.java:42) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.DependencyManager.doInvokeBindMethod(DependencyManager.java:1813) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.DependencyManager.invokeBindMethod(DependencyManager.java:1788) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.SingleComponentManager.invokeBindMethod(SingleComponentManager.java:436) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.DependencyManager$MultipleDynamicCustomizer.addedService(DependencyManager.java:333) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.DependencyManager$MultipleDynamicCustomizer.addedService(DependencyManager.java:302) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1216) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1137) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.trackAdding(ServiceTracker.java:944) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.track(ServiceTracker.java:880) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:1168) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.BundleComponentActivator$ListenerInfo.serviceChanged(BundleComponentActivator.java:125) [39:org.apache.felix.scr:2.1.14]
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109) [?:?]
at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:920) [?:?]
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) [?:?]
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) [?:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:862) [?:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:801) [?:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:127) [?:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:225) [?:?]
at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:469) [?:?]
at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentManager.java:906) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentManager.java:892) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.RegistrationManager.changeRegistration(RegistrationManager.java:128) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.AbstractComponentManager.registerService(AbstractComponentManager.java:959) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:732) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.DependencyManager$SingleStaticCustomizer.addedService(DependencyManager.java:1053) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.DependencyManager$SingleStaticCustomizer.addedService(DependencyManager.java:1007) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1216) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1137) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.trackAdding(ServiceTracker.java:944) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.track(ServiceTracker.java:880) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:1168) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.BundleComponentActivator$ListenerInfo.serviceChanged(BundleComponentActivator.java:125) [39:org.apache.felix.scr:2.1.14]
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109) [?:?]
at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:920) [?:?]
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) [?:?]
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) [?:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:862) [?:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:801) [?:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:127) [?:?]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:225) [?:?]
at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:469) [?:?]
at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentManager.java:906) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentManager.java:892) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.RegistrationManager.changeRegistration(RegistrationManager.java:128) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.AbstractComponentManager.registerService(AbstractComponentManager.java:959) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:732) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.AbstractComponentManager.enableInternal(AbstractComponentManager.java:666) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:432) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.enableComponents(ConfigurableComponentHolder.java:665) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.BundleComponentActivator.initialEnable(BundleComponentActivator.java:339) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:381) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.Activator.access$200(Activator.java:49) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.Activator$ScrExtension.start(Activator.java:263) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.AbstractExtender.createExtension(AbstractExtender.java:196) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.AbstractExtender.modifiedBundle(AbstractExtender.java:169) [39:org.apache.felix.scr:2.1.14]
at org.apache.felix.scr.impl.AbstractExtender.modifiedBundle(AbstractExtender.java:49) [39:org.apache.felix.scr:2.1.14]
at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:482) [?:?]
at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:415) [?:?]
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232) [?:?]
at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444) [?:?]
at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:908) [?:?]
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) [?:?]
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) [?:?]
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:213) [?:?]
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:120) [?:?]
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:112) [?:?]
at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:168) [?:?]
at org.eclipse.osgi.container.Module.publishEvent(Module.java:476) [?:?]
at org.eclipse.osgi.container.Module.start(Module.java:467) [?:?]
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1634) [?:?]
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1614) [?:?]
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1585) [?:?]
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1528) [?:?]
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1) [?:?]
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) [?:?]
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340) [?:?]
2019-01-12 10:20:33.940 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'dsmr.rules', using it anyway:
Error executing EValidator
The value of the local variable tag is not used
2019-01-12 10:20:33.944 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'dsmr.rules'
The rules are quite simple and I'm sure they all reference the tag value:
// Set default Grafana display switches on system start.// Note: It will also be triggered on any configuration file update.//----------------------------------------------------------------------------------------rule"Initialize Power Panel values"whenSystemstartedthenvaltag = "DSMR.Startup"logDebug(tag, ">>> Enter rule")
logInfo(tag, "System start, set DSMR view paramaters to default values")
Pwr_Panel1.postUpdate("PWR_USE")
Pwr_Period1.postUpdate("DAY")
Pwr_Panel2.postUpdate("HIST_USE")
Pwr_Period2.postUpdate("WEEK")
Pwr_Interval2.postUpdate("1d")
Pwr_Period3.postUpdate("DAY")
Pwr_Interval3.postUpdate("1d")
Gas_Panel4.postUpdate("GAS_USE")
logDebug(tag, "<<< Exit rule")
end// Reset day total counters at midnight//----------------------------------------------------------------------------------------rule"Midnight DSMR day counters reset"whenTimeismidnightthenvaltag = "DSMR.Reset.Counters"logDebug(tag, ">>> Enter rule")
logInfo(tag, "Reset DSMR day counters at midnight")
// Save current day total countersif (Pwr_UseDay.stateinstanceofNumber)
Pwr_UseDayTot.postUpdate(Pwr_UseDay.stateasNumber)
if (Pwr_UseDayT1.stateinstanceofNumber)
Pwr_UseDayTotT1.postUpdate(Pwr_UseDayT1.stateasNumber)
if (Pwr_UseDayT2.stateinstanceofNumber)
Pwr_UseDayTotT2.postUpdate(Pwr_UseDayT2.stateasNumber)
if (Pwr_RetDay.stateinstanceofNumber)
Pwr_RetDayTot.postUpdate(Pwr_RetDay.stateasNumber)
if (Pwr_RetDayT1.stateinstanceofNumber)
Pwr_RetDayTotT1.postUpdate(Pwr_RetDayT1.stateasNumber)
if (Pwr_RetDayT2.stateinstanceofNumber)
Pwr_RetDayTotT2.postUpdate(Pwr_RetDayT2.stateasNumber)
// Set base counters to midnight valuesif (Pwr_UseTot.stateinstanceofNumber) {
Pwr_UseLast.postUpdate(Pwr_UseTot.stateasNumber)
logDebug(tag, "Reset Pwr_UseLast to " + Pwr_UseTot)
}
if (Pwr_UseTotT1.stateinstanceofNumber) {
Pwr_UseLastT1.postUpdate(Pwr_UseTotT1.stateasNumber)
logDebug(tag, "Reset UseLastT1 to " + Pwr_UseTotT1)
}
if (Pwr_UseTotT2.stateinstanceofNumber) {
Pwr_UseLastT2.postUpdate(Pwr_UseTotT2.stateasNumber)
logDebug(tag, "Reset Pwr_UseLastT2 to " + Pwr_UseTotT2)
}
if (Gas_UseTot.stateinstanceofNumber) {
Gas_UseLast.postUpdate(Gas_UseTot.stateasNumber)
logDebug(tag, "Reset Gas_UseLast to " + Gas_UseTot)
}
if (Pwr_RetTot.stateinstanceofNumber) {
Pwr_RetLast.postUpdate(Pwr_RetTot.stateasNumber)
logDebug(tag, "Reset Pwr_RetLast to " + Pwr_RetTot)
}
if (Pwr_RetTotT1.stateinstanceofNumber) {
Pwr_RetLastT1.postUpdate(Pwr_RetTotT1.stateasNumber)
logDebug(tag, "Reset Pwr_RetLastT1 to " + Pwr_RetTotT1)
}
if (Pwr_RetTotT2.stateinstanceofNumber) {
Pwr_RetLastT2.postUpdate(Pwr_RetTotT2.stateasNumber)
logDebug(tag, "Reset Pwr_RetLastT2 to " + Pwr_RetTotT2)
}
// Reset day sum countersPwr_UseDay.postUpdate(0)
Pwr_UseDayT1.postUpdate(0)
Pwr_UseDayT2.postUpdate(0)
Pwr_RetDay.postUpdate(0)
Pwr_RetDayT1.postUpdate(0)
Pwr_RetDayT2.postUpdate(0)
Gas_UseDay.postUpdate(0)
logDebug(tag, "<<< Exit rule")
end// Calculate the day total of Gas consumed//----------------------------------------------------------------------------------------rule"Gas usage day total"whenItemGas_UseTotchangedthenvaltag = "DSMR."+triggeringItem.name+".Changed"logDebug(tag, ">>> Enter rule")
logInfo(tag, "Calculate Gas_UseDay")
if (!(Gas_UseLast.stateinstanceofNumber))
logWarn(tag, "Gas_UseLast not yet initialized, skip calculation of Gas_UseDay")
else {
if (Gas_UseTot.stateinstanceofNumber)
Gas_UseDay.postUpdate(Gas_UseTot.stateasNumber - Gas_UseLast.stateasNumber)
elselogWarn(tag, "Gas_UseTot not yet initialized, skip calculation of Gas_UseDay")
}
logDebug(tag, "<<< Exitrule")
end// Calculate the sum of the DSMR counters for Low tariff Power consumption//----------------------------------------------------------------------------------------rule"Power usage T1 day total"whenItemPwr_UseTotT1changedthenvaltag = "DSMR."+triggeringItem.name+".Changed"logDebug(tag, ">>> Enter rule")
logInfo(tag, "Calculate Pwr_UseDayT1")
if (!(Pwr_UseLastT1.stateinstanceofNumber))
logWarn(tag, "Pwr_UseLastT1 not initialized")
elseif (Pwr_UseTotT1.stateinstanceofNumber) {
logInfo(tag, "Pwr_UseDayT1 is being updated")
Pwr_UseDayT1.postUpdate(Pwr_UseTotT1.stateasNumber - Pwr_UseLastT1.stateasNumber)
}
elselogWarn(tag, "Item {} not yet initialized, skip calculation of Pwr_UseDayT1", triggeringItem)
logInfo(tag, "Calculate Pwr_UseTot")
if (Pwr_UseTotT1.stateinstanceofNumber) {
if (Pwr_UseTotT2.stateinstanceofNumber)
Pwr_UseTot.postUpdate(Pwr_UseTotT1.stateasNumber + Pwr_UseTotT2.stateasNumber)
elselogWarn(tag, "Pwr_UseTotT2 not initialized, skip calculation of Pwr_UseTot")
}
elselogWarn(tag, "Pwr_UseTotT1 not initialized, skip calculation of Pwr_UseTot")
logDebug(tag, "<<< Exit rule")
end// Calculate the sum of the DSMR counters for Normal tariff Power consumption//----------------------------------------------------------------------------------------rule"Power usage T2 day total"whenItemPwr_UseTotT2changedthenvaltag = "DSMR."+triggeringItem.name+".Changed"logDebug(tag, ">>> Enter rule")
logInfo(tag, "Calculate Pwr_UseDayT2")
if (!(Pwr_UseLastT2.stateinstanceofNumber))
logWarn(tag, "Day start usage counter T2 not initialized, skip calculation")
elseif (triggeringItem.stateinstanceofNumber) {
Pwr_UseDayT2.postUpdate(triggeringItem.stateasNumber - Pwr_UseLastT2.stateasNumber)
logDebug(tag, "Item Pwr_UseDayT2 is being updated")
}
elselogWarn(tag, "Item {} not yet initialized, skip calculation of Pwr_UseDayT2", triggeringItem.name)
logInfo(tag, "Calculate Pwr_UseTot")
if (Pwr_UseTotT1.stateinstanceofNumber) {
if (Pwr_UseTotT2.stateinstanceofNumber)
Pwr_UseTot.postUpdate(Pwr_UseTotT1.stateasNumber + Pwr_UseTotT2.stateasNumber)
elselogWarn(tag, "Pwr_UseTotT2 not initialized, skip calculation of Pwr_UseTot")
}
elselogWarn(tag, "Pwr_UseTotT1 not initialized, skip calculation of Pwr_UseTot")
logDebug(tag, "<<< Exit rule")
end// Calculate the day total of the DSMR counters for Low & High tariff Power consumption//----------------------------------------------------------------------------------------rule"Power usage total today"whenItemPwr_UseTotchangedthenvaltag = "DSMR."+triggeringItem.name+".Changed"logDebug(tag, ">>> Enter rule")
logInfo(tag, "Calculating updated Pwr_UseDay")
if (!(Pwr_UseTot.stateinstanceofNumber))
logInfo(tag, "Item {} not yet initialized, skip calculation of Pwr_UseDay", triggeringItem.name)
elseif (Pwr_UseTot.stateinstanceofNumber && Pwr_UseLast.stateinstanceofNumber) {
Pwr_UseDay.postUpdate(Pwr_UseTot.stateasNumber - Pwr_UseLast.stateasNumber)
logDebug(tag, "Calculate Pwr_UseDay from Pwr_UseLast = " + Pwr_UseLast.state.toString + ", and Pwr_UseTot = " + Pwr_UseTot.state.toString + ", old = " + Pwr_UseDay.state.toString)
}
elselogWarn(tag, "Pwr_UseLast not initialized, skip calculation of Pwr_UseDay")
logDebug(tag, "<<< Exit rule")
end// Calculate the sum of the DSMR meter counters for Low tariff Power return//----------------------------------------------------------------------------------------rule"Power return T1 day total"whenItemPwr_RetTotT1changedthenvaltag = "DSMR."+triggeringItem.name+".Changed"logDebug(tag, ">>> Enter rule")
logInfo(tag, "Recalculate Pwr_RetDayT1 updated total return")
if (!(Pwr_RetLastT1.stateinstanceofNumber))
logWarn(tag, "Pwr_RetLastT1 not initialized, skip calculation of Pwr_RetDayT1")
else {
if (Pwr_RetTotT1.stateinstanceofNumber) {
Pwr_RetDayT1.postUpdate(Pwr_RetTotT1.stateasNumber - Pwr_RetLastT1.stateasNumber)
logDebug(tag, "Calculate Pwr_RetDayT1 from Pwr_RetLastT1 = " + Pwr_RetLastT1.state.toString + ", and Pwr_RetTotT1 = " + Pwr_RetTotT1.state.toString + ", old = " + Pwr_RetDayT1.state.toString)
}
elselogWarn(tag, "Pwr_RetTotT1 not initialized, skipping calculation")
}
logInfo(tag, "Calculate updated Pwr_RetTot (T1+T2)")
if (Pwr_RetTotT1.stateinstanceofNumber && Pwr_RetTotT2.stateinstanceofNumber)
Pwr_RetTot.postUpdate(Pwr_RetTotT1.stateasNumber + Pwr_RetTotT2.stateasNumber)
elselogWarn(tag, "Pwr_RetTotT2 not initialized, skip calculation of Pwr_RetTot")
logDebug(tag, "<<< Exit rule")
end// Calculate the sum of the DSMR meter counters for High tariff Power return//----------------------------------------------------------------------------------------rule"Power return T2 day total"whenItemPwr_RetTotT2changedthenvaltag = "DSMR."+triggeringItem.name+".Changed"logDebug(tag, ">>> Enter rule")
logInfo(tag, "Recalculate Pwr_RetDayT2 when Pwr_RetTotT2 changed")
if (!(Pwr_RetLastT2.stateinstanceofNumber))
logWarn(tag, "Pwr_RetLastT2 not yet initialized, skip calculation of Pwr_RetDayT2")
else {
if (Pwr_RetTotT2.stateinstanceofNumber) {
Pwr_RetDayT2.postUpdate(Pwr_RetTotT2.stateasNumber - Pwr_RetLastT2.stateasNumber)
logDebug(tag, "Calculate Pwr_RetDayT2 from Pwr_RetLastT2 = " + Pwr_RetLastT2.state.toString + ", and Pwr_RetTotT2 = " + Pwr_RetTotT2.state.toString + ", old = " + Pwr_RetDayT2.state.toString)
}
elselogWarn(tag, "Pwr_RetTotT2 not yet initialized, skip calculation of Pwr_RetDayT2")
}
logInfo(tag, "Calculate updated Pwr_RetTot (T1+T2)")
if (Pwr_RetTotT1.stateinstanceofNumber && Pwr_RetTotT2.stateinstanceofNumber)
Pwr_RetTot.postUpdate(Pwr_RetTotT1.stateasNumber + Pwr_RetTotT2.stateasNumber)
elselogWarn(tag, "Pwr_RetTotT1 not yet initialized, skip calculation of Pwr_RetTot")
logDebug(tag, "<<< Exit rule")
end// Calculate the day total of the DSMR counters for Low & High tariff Power return//----------------------------------------------------------------------------------------rule"Power return today"whenItemPwr_RetTotchangedthenvaltag = "DSMR."+triggeringItem.name+".Changed"logDebug(tag, ">>> Enter rule")
logInfo(tag, "Recalculate Pwr_RetDay when Pwr_RetTot changed")
if (Pwr_RetTot.stateinstanceofNumber && Pwr_RetLast.stateinstanceofNumber) {
Pwr_RetDay.postUpdate(Pwr_RetTot.stateasNumber - Pwr_RetLast.stateasNumber)
logDebug(tag, "Calculate Pwr_RetDay from Pwr_RetLast = " + Pwr_RetLast.state.toString + ", and Pwr_RetTot = " + Pwr_RetTot.state.toString + ", old = " + Pwr_RetDay.state.toString)
}
elselogWarn(tag, "Pwr_RetLast not initialized, skip calculation of Pwr_RetDay")
logDebug(tag, "<<< Exit rule")
end// Calculate the delta of power consumed and power returned//----------------------------------------------------------------------------------------rule"Power delta total"whenItemPwr_RetchangedorItemPwr_Usechangedthenvaltag = "DSMR." + triggeringItem.name + ".Changed"logDebug(tag, ">>> Enter rule")
logDebug(tag, "Recalculating Pwr_Delta when " + triggeringItem.name + " changed")
if (Pwr_Ret.stateinstanceofNumber) {
if (Pwr_Use.stateinstanceofNumber) {
Pwr_Delta.postUpdate(Pwr_Use.stateasNumber - Pwr_Ret.stateasNumber)
logDebug(tag, "Calculate Pwr_Delta from Pwr_Use = " + Pwr_Use.state.toString + ", and Pwr_Ret = " + Pwr_Ret.state.toString + ", old = " + Pwr_Delta.state.toString)
}
elselogWarn(tag, "Pwr_Use not initialized, skip calculation of Pwr_Delta")
}
elselogWarn(tag, "Pwr_Ret not initialized, skip calculation of Pwr_Delta")
logDebug(tag, "<<< Exit rule")
end// Calculate the delta of L1 power consumed and power returned//----------------------------------------------------------------------------------------rule"Power delta L1"whenItemPwr_RetL1changedorItemPwr_UseL1changedthenvaltag = "DSMR." + triggeringItem.name + ".Changed"logDebug(tag, ">>> Enter rule")
logDebug(tag, "Recalculate Pwr_DeltaL1 when Pwr_RetL1 or Pwr_UseL1 changed")
if (Pwr_RetL1.stateinstanceofNumber) {
if (Pwr_UseL1.stateinstanceofNumber) {
Pwr_DeltaL1.postUpdate(Pwr_UseL1.stateasNumber - Pwr_RetL1.stateasNumber)
logDebug(tag, "Calculate Pwr_DeltaL1 from Pwr_UseL1 = " + Pwr_UseL1.state.toString + ", and Pwr_RetL1 = " + Pwr_RetL1.state.toString + ", old = " + Pwr_DeltaL1.state.toString)
}
elselogWarn(tag, "Pwr_UseL1 not initialized, skip calculation of PwrDeltaL1")
}
elselogWarn(tag, "Pwr_RetL1 not initialized, skip calculation of Pwr_DeltaL1")
logDebug(tag, "<<< Exit rule")
end// Calculate the delta of L2 power consumed and power returned//----------------------------------------------------------------------------------------rule"Power delta L2"whenItemPwr_RetL2changedorItemPwr_UseL2changedthenvaltag = "DSMR."+triggeringItem.name+".Changed"logDebug(tag, ">>> Enter rule")
logDebug(tag, "Recalculate Pwr_DeltaL2 when Pwr_RetL2 or Pwe_UseL2 changed")
if (Pwr_RetL2.stateinstanceofNumber) {
if (Pwr_UseL2.stateinstanceofNumber) {
Pwr_DeltaL2.postUpdate(Pwr_UseL2.stateasNumber - Pwr_RetL2.stateasNumber)
logDebug(tag, "Calculate Pwr_DeltaL2 from Pwr_UseL2 = " + Pwr_UseL2.state.toString + ", and Pwr_RetL2 = " + Pwr_RetL2.state.toString + ", old = " + Pwr_DeltaL2.state.toString)
}
elselogWarn(tag, "Pwr_UseL2 not initialized, skip calculation of Pwr_DeltaL2")
}
elselogWarn(tag, "Pwr_RetL2 not initialized, skip calculation of Pwr_DeltaL2")
logDebug(tag, "<<< Exit rule")
end// Calculate the delta of L3 power consumed and power returned//----------------------------------------------------------------------------------------rule"Power delta L3"whenItemPwr_RetL3changedorItemPwr_UseL3changedthenvaltag = "DSMR."+triggeringItem.name+".Changed"logDebug(tag, ">>> Enter rule")
logDebug(tag, "Recalculate Pwr_DeltaL3 when Pwr_RetL3 or PwrUseL3 changed")
if (Pwr_RetL3.stateinstanceofNumber) {
if (Pwr_UseL3.stateinstanceofNumber) {
Pwr_DeltaL3.postUpdate(Pwr_UseL3.stateasNumber - Pwr_RetL3.stateasNumber)
logDebug(tag, "Calculate Pwr_DeltaL3 from Pwr_UseL3 = " + Pwr_UseL3.state.toString + ", and Pwr_RetL3 = " + Pwr_RetL3.state.toString + ", old = " + Pwr_DeltaL3.state.toString)
}
elselogWarn(tag, "Pwr_UseL3 not initialized, skip calculation of Pwr_Delta_L3")
}
elselogWarn(tag, "Pwr_RetL3 not initialized, skip calculation of Pwr_Delta_L3")
logDebug(tag, "<<< Exit rule")
end
The rules are working now, so I could remove the logging. But experience shows that a new OH or ESH version can give new issues, so I would rather leave them in. And anyway, I think it is an error with the validation engine.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I have a .rules file (in OH 2.4.0 and same issue in 2.5.0.-SNAPSHOT) with a
value
defined within each of the rules as shown below. It is just a string to use as label for logDebug/Info/Warning/Error() functions. Somehow the validator thinks thetag
variable is not used (one or two messages, it varies...). It displays the following messages when starting OH:and sometimes it throws an error:
The rules are quite simple and I'm sure they all reference the
tag
value:The rules are working now, so I could remove the logging. But experience shows that a new OH or ESH version can give new issues, so I would rather leave them in. And anyway, I think it is an error with the validation engine.
The text was updated successfully, but these errors were encountered: