Input for concept

I need a little bit of help for a general concept for the following szenario:

  • Homematic smoke detector is manually tested by physically pushing a test button on the device
  • item SD1_SmokeDetectorTestResult changes from “NONE” to either “SMOKE_TEST_OK” or “SMOKE_TEST_FAILED”
  • device resets its state after 1 minute to “NONE”

GOAL: Show in MainUI the date of test and last test result.

PROBLEM: as written above the test result is overriden by state “NONE” after 1 minute

What is your recommendation?

  • persisting the item and extracting the last value != “NONE” (is this possible anyway?) from persistency database?
  • Is it possible to persist conditionally (e.g. do only persist if value != “NONE”). Sure, there is a way to persist manually, but I’d prefer to have “built-in” into the persistency strategy
  • create a virtual item for each device and write a rule which sets the value when it changes to a value !=“NONE”. But then I need to think about persistency again, is I need the state after a potential restart of OH

That doesn’t help if you want to display your result - it needs to get into an Item for that.

Sounds simple and effective. I’m assuming you’d put the timestamp text in the string content.

see Mapdb for this, if you’re not interested in history, just “last”.

Thanks a lot, Rossko

hmm. I thought I put the test result in the string content and get the timestamp through proxyItem.lastUpdate. Or did I misunderstand you?

Why, will it ever change (until next test)?
See also

I thought you’d want to avoid two Items, one for pass/fail and one for datestamp.

1 Like