Hi, I am creating a widget for a garagedoor or an accessgate.
The functions of the widget are as follows: open or close a garage door or an access gate, display different icons when the door or gate is closed or open, show text indicating whether automatic closing is enabled or not (if the garagedoor/gate control has this function). This can be activated or deactivated by a long press on the widget. Provide text about whether the door is opening, closing, open, or closed, if the garagedoor/gate control has this capability.
-
I have the following issues: firstly, in areas where there is text or an icon, the widget cannot be pressed, only in the areas around the text and the icon.
-
Another problem is that I would like to make it possible to choose which Iconify icon is used via props, but I cannot find the right solution and have therefore currently hard-coded it.
-
One last thing is that I want to hide label areas if there are no items that match. As it is now, it says âSet Propsâ and there is a small line where the text indicating what the door is doing appears.
Here is what I have done so far.
uid: Garagedoor_Gate
tags: []
props:
parameters:
- description: Small title on top of the card
label: Title
name: title
required: false
type: TEXT
- description: Name for auto-close in your own language
label: auto-close
name: auto_close
required: false
type: TEXT
- description: Iconify icon for closes state
label: Iconify icon for closes state
name: icon_closed
required: false
type: TEXT
- description: Iconify icon for open state
label: Iconify icon for open state
name: icon_open
required: false
type: TEXT
- description: rgba or HEX
label: Background Color when open
name: bgcolor
required: false
type: TEXT
- context: item
description: sensor Item for open or closed state
label: Item that has state of the door/gate
name: sensor
required: false
type: TEXT
- context: item
description: String item which holds a text state from your garagedoor
label: Item
name: text_state
required: false
type: TEXT
- description: A Word for the actionFeedback in your language
label: actionFeedback
name: name_for_actionFeedback
required: false
- context: item
description: Item controlling the garagedoor/Gate
label: Garagedoor/Gate
name: Garagedoor_control_item
required: false
type: TEXT
- context: item
description: Item controlling auto-close
label: auto-close
name: autoclose_Control_item
required: false
type: TEXT
parameterGroups: []
timestamp: Feb 28, 2024, 7:53:42 PM
component: f7-card
config:
style:
background-color: >
=props.sensor && items[props.sensor].state === 'OPEN' ? props.bgcolor : ''
border-radius: var(--f7-card-expandable-border-radius)
box-shadow: '=(items[props.Garagedoor_control_item].state === "ON") ? "3px 3px 10px 0px rgba(255,255,255,255)" : "var(--f7-card-expandable-box-shadow)"'
class:
- padding: 0px
height: 150px
margin-left: 5px
margin-right: 5px
noShadow: false
slots:
content:
- component: f7-block
config:
style:
display: flex
flex-direction: row
left: 30px
position: absolute
top: -5px
slots:
default:
- component: oh-icon
config:
height: 36
icon: '= (items[props.sensor].state === "OPEN") ? "iconify:mdi:garage-open-variant" : "iconify:mdi:garage-variant"'
style:
margin-right: 10px
visible: "=props.icon_open || props.icon_closed ? true : false"
- component: Label
config:
style:
font-size: 25px
margin-top: 0px
text: "=props.title ? props.title : ''"
- component: f7-block
config:
style:
bottom: -30px
flex-direction: column
left: 30px
position: absolute
slots:
default:
- component: Label
config:
style:
font-size: 20px
font-weight: 600
margin-bottom: 18px
margin-left: 0px
margin-top: 0px
text: >
=props.auto_close ?
(props.autoclose_Control_item && items[props.autoclose_Control_item].state === 'ON' ?
props.auto_close + ' - On' :
props.auto_close + ' - Off')
: 'Set Props'
- component: Label
config:
style:
font-size: 18px
margin-bottom: -50px
margin-left: 32px
margin-top: 0px
text: "=items[props.text_state] ? items[props.text_state].state : ''"
v-if: =props.text_state && items[props.text_state] && items[props.text_state].state !== undefined
- component: oh-button
config:
action: toggle
actionCommand: ON
actionCommandAlt: OFF
actionFeedback: =props.name_for_actionFeedback
actionItem: =props.Garagedoor_control_item
style:
actionPosition: center
height: 150px
left: 0
position: absolute
top: 0
width: 100%
taphold_action: toggle
taphold_actionCommand: ON
taphold_actionCommandAlt: OFF
taphold_actionItem: =props.autoclose_Control_item
The widget is built on the âIntegerâ simple cell card: [OH3] Main UI Examples - #30 by Integer
In advance, thank you for any input you may provide.
Anders