Simple Door Status Widget

Screenshot 2022-05-24 100806

All of my (Kyle Mason) (mediatech15) widgets are free to copy modify and edit how you see fit. You may re-post the variants freely (an inspired by is nice)

This is a simple widget. This is a door status card. The features include:

  • Fully Responsive (based on oh-label-cell)
  • Icons based on state
  • Configuration is simple and allows for an external sensor
    • The parts of label are separate properties to allow all locks
    • Allows for a sensor in addition to lock
  • Background color updates based on state

Screenshots

Screenshot 2022-05-24 100729
Screenshot 2022-05-24 100806
Screenshot 2022-05-24 100856

Changelog

Version 1.0

  • initial release

Version 1.1

  • Added Last Updated

Resources

Version latest

Gitlab Snippet (widget code raw for karaf)

Version v1.0

Gitlab Snippet (widget code)

Version v1.1

Gitlab Snippet (widget code)

3 Likes

Nice one! Can you also add a date/time/ hour item? To show the last time the door state changed?

I can add that to the next iteration. Would it be acceptable to append or format the footer text? ATM its based on the label-cell not f7-card so less options available unless I refactor

Humm tbh I’m not sure what’s best. It would be an extra information only, so it doesn’t need to be very prominent at all. But still interesting to, you know, check when was it the last time that the door was opened, or, unlocked. Probably whatever is best is also what’s easiest in this case?

Updated. Need to update screenshots still but v1.1 has that added

1 Like

Nice! It’s looking good!

Now I need to work out an alternative for the lock status. I just have a door sensor, and no lock…

You could put the item for the open close in where it asks for lock and leave the open close one empty. It will hide the text

1 Like

Your use case actually gave me a interesting idea for version 2.

1 Like

Looking forward to seeing it!

I tried like you said but the text didn’t get hidden. Maybe I need to do something else??

I re checked the code and was wrong. Though v2.0 will cover this

1 Like

Cool! :slight_smile:

I’d really appreciate if you could add the ability to toggle the lock. I tried (yes, newbie here) to add actions to allow this but I’m just not understanding (yet) how these widgets work.

  action: toggle
  actionCommand: ON
  actionCommandAlt: OFF
  actionItem: =props.lock

Much appreciated …

These actions fixed it … Hope others find this useful … Thanks again for the widget, love it …

config:
  color: '= (items[props.sensor].state === "OPEN") ? "lightblue" : (items[props.lock].state === "OFF") ? "yellow" : "white"'
  action: toggle
  actionItem: =props.lock
  actionCommand: ON
  actionCommandAlt: OFF
  expandable: false
  footer: '= "Last Updated @ " + dayjs(items[props.updated].state).format("M/D/YY h:m:ss A") + " & Battery level is " + items[props.battery].displayState '
  header: = props.label
  icon: '= (items[props.sensor].state === "OPEN") ? "iconify:ri:door-open-line" : (items[props.lock].state === "ON") ? "iconify:bxs:lock" : "bxs:lock-open"'
  label: = "Door is " + items[props.lock].displayState
  on: true
  subtitle: '= (props.sensor) ? "Door is " + (items[props.sensor].state).toLowerCase().charAt(0).toUpperCase() + (items[props.sensor].state).toLowerCase().slice(1) : ""'
2 Likes

Hi there, I’m new to trying to setup my first layout pages so bear with me if I missed something obvious. :smiley:

Running : openHAB 3.3.0 Release Build on a raspberry

I want to display my garage door status but I don’t have an actual garage door item. I use a dummy item

Contact     garageDoor_contact       "Porte du Garage"                  (gGarageDoor)    ["GarageDoor", "OpenState"]    {autoupdate="true"}

I have a rule that updates that item’s status. So in my model, I can see my door status changing and I guess it’s good enough but I’m still not sure.

Right now what I was able to achieve is this :
image

I cannot remove the “Door is undefined”, also, I tried to change the footer text (I don’t need the battery level, my contact is hardwired) but it’s not reflected in the widget. Here is my yaml code :

component: widget:door_lock_status
config:
  updated: garageDoorLastUpdate
  label: Porte du garage
  footer: = "Last Updated " + dayjs(items[props.updated].state).format("DD/MM/YY
    hh:m:ss")
  sensor: garageDoor_contact
slots: null

What am I missing?
I tried adding “lock: garageDoor_contact” in the configuration but no difference.

Any help is appreciated.

So two things. It looks like you have the version 1 code for the widget vs 1.1 (lastest) not sure how you go that but the problem with seeing door is twice was fixed then. The widget was originally made for things like zwave locks and I did not think about garage doors. The footer text currently is non-hidable. But I could add that in an update. That way if parts of the footer are valid it hides them.

2 Likes

I did plan on this but was side tracked with other things. The one thing is I would want to expand the values to props so that if on and off aren’t right they can be chamged

1 Like

Ok so I got the code by installing the widget from marketplace.
I edited it with the code found here and then I altered it a bit more to suit my needs :wink:
So it’s starting to look more like what I need.
Thank you.
image

Glad you got something you like. I have had my real job pushing deadlines so I had to pause on my contributions here. Trying to remain active on the forums for help though. FYI on all my widgets there are snippets of each version and a “latest”. The latest is always the latest as it is the one karaf (marketplace) keys on since it is a raw yaml file. If you want to share code at any point for me integrate into my widget for all just DM me it and ill work on it.

I understand and thank you for your time.
I don’t think my modifications are worth sharing as I merely removed some stuff (battery and lock I don’t have). It’s the first time I’m trying to do something with widgets but if I do something better later on, I will share. :slight_smile: