Hello,
i using some smoke detectors and want to show thing status of each smoke detector in habpanel. (show online/offline state of device)
There are a trigger to get the thing status and use a thing to display the actual thing state?
I used the code but i get error messages in logfiles.
Thats the code:
rule "CheckSmokeDetectors"
when
Time cron "*/5 * * * * ?" //Run this rule every 5 minutes
then
// try it with a var:
var result = ThingAction.getThingStatusInfo("mihome:smoke:158d0001xxxxxx").getStatus()
postUpdate(WZSmokeDetector_ThingStatus,result)
// try it directly:
WZSmokeDetector_ThingStatus = ThingAction.getThingStatusInfo("mihome:smoke:158d0001xxxxxx").getStatus()
end
and the result:
directly:
2018-08-06 20:30:05.218 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule 'CheckSmokeDetectors': An error occurred during the script execution: Cannot assign a value in null context.
with a variable:
2018-08-06 20:34:05.089 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule 'CheckSmokeDetectors': An error occurred during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.actions.BusEvent.postUpdate(org.eclipse.smarthome.core.items.Item,org.eclipse.smarthome.core.types.State) on instance: null