Presence - Card from ScrewPlate

image

Here is a widget with which the presence and absence (also the duration of the absence) can be displayed.

ScrewPlate will be a template set with various widgets, all of which are highly customizable in a unified style. More information on GitHub

I use the following DSL rule to calculate the duration of absence.

if (Handy_Online.state == OFF) {
  val lastUpdate1 = Handy_Online.lastUpdate
  val awaySince1 = lastUpdate1.until(now, java.time.temporal.ChronoUnit.MINUTES)
  VI_Handy_AwaySince.postUpdate(awaySince1)
logInfo("Presence","AwaySince: "+ awaySince1)
} else {
  VI_Handy_AwaySince.postUpdate(0)
}

Screenshots

Changelog

In each widget there is a tag with version, please always make sure to use the latest version.

Change and further information on GitHub

Resources

https://raw.githubusercontent.com/DrScr3w/ScrewPlate/refs/heads/main/templates/Card_Template_Presence.yaml

You could use an expression in the widget for this instead of the rule.

image

component: oh-label-card
config:
  item: MotionSensor_LastMotion
  label: =dayjs(items.MotionSensor_LastMotion.state).fromNow()
  title: Dad's Last Motion Detection